diff options
author | Myles Borins <myles.borins@gmail.com> | 2016-06-09 19:31:45 +0300 |
---|---|---|
committer | Myles Borins <mborins@us.ibm.com> | 2016-06-14 21:10:49 +0300 |
commit | f1d10713618bd3307ef8c0b64d49bf69f551efe5 (patch) | |
tree | 80fbc25600a4265554465e7c160bbeaa35d04f94 /src/inspector_socket.cc | |
parent | 08ea9ee56d0223fc9214821c75a72ba94fe17a74 (diff) |
src: make Sec-WebSocket-Key check case-insensitive
Current case sensitive comparison is breaking netty-based WS clients.
replace strncmp with strncasecmp
Fixes: https://github.com/nodejs/node/issues/7247
PR-URL: https://github.com/nodejs/node/pull/7248
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Ali Ijaz Sheikh <ofrobots@google.com>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Diffstat (limited to 'src/inspector_socket.cc')
-rw-r--r-- | src/inspector_socket.cc | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/src/inspector_socket.cc b/src/inspector_socket.cc index cb248ec59fe..fa2b6734e9e 100644 --- a/src/inspector_socket.cc +++ b/src/inspector_socket.cc @@ -1,4 +1,6 @@ #include "inspector_socket.h" +#include "util.h" +#include "util-inl.h" #define NODE_WANT_INTERNALS 1 #include "base64.h" @@ -445,9 +447,10 @@ static int header_value_cb(http_parser* parser, const char* at, size_t length) { struct http_parsing_state_s* state = (struct http_parsing_state_s*) (reinterpret_cast<inspector_socket_t*>(parser->data))->http_parsing_state; state->parsing_value = true; - if (state->current_header && strncmp(state->current_header, - SEC_WEBSOCKET_KEY_HEADER, - sizeof(SEC_WEBSOCKET_KEY_HEADER)) == 0) { + if (state->current_header && + node::StringEqualNoCaseN(state->current_header, + SEC_WEBSOCKET_KEY_HEADER, + sizeof(SEC_WEBSOCKET_KEY_HEADER))) { append(&state->ws_key, at, length); } return 0; |