]> granicus.if.org Git - libevent/commitdiff
ws: ignore case while comparing values of Upgrade/Connection headers
authorAzat Khuzhin <azat@libevent.org>
Sat, 12 Nov 2022 17:45:13 +0000 (18:45 +0100)
committerAzat Khuzhin <azat@libevent.org>
Sat, 12 Nov 2022 17:46:43 +0000 (18:46 +0100)
Cc: @widgetii
Fixes: #1373
ws.c

diff --git a/ws.c b/ws.c
index 5acaf78397789380331891d81f82e0a3ebaf20fb..8e2b29583a3a7980894cc6bb0b118c6db43baaa1 100644 (file)
--- a/ws.c
+++ b/ws.c
@@ -353,11 +353,11 @@ evws_new_session(
 
        in_hdrs = evhttp_request_get_input_headers(req);
        upgrade = evhttp_find_header(in_hdrs, "Upgrade");
-       if (upgrade == NULL || strcmp(upgrade, "websocket"))
+       if (upgrade == NULL || evutil_ascii_strcasecmp(upgrade, "websocket"))
                goto error;
 
        connection = evhttp_find_header(in_hdrs, "Connection");
-       if (connection == NULL || strcmp(connection, "Upgrade"))
+       if (connection == NULL || evutil_ascii_strcasecmp(connection, "Upgrade"))
                goto error;
 
        ws_key = evhttp_find_header(in_hdrs, "Sec-WebSocket-Key");