1
0
Fork 0
mirror of https://github.com/warmcat/libwebsockets.git synced 2025-03-09 00:00:04 +01:00

parse-and-reject-extensions-header.patch

Signed-off-by: Andy Green <andy@linaro.org>
This commit is contained in:
Andy Green 2011-02-09 08:58:42 +00:00 committed by Andy Green
parent bfb051f3a3
commit 18910c5920
3 changed files with 10 additions and 0 deletions

View file

@ -248,6 +248,11 @@ handshake_0405(struct libwebsocket *wsi)
goto bail;
}
if (wsi->utf8_token[WSI_TOKEN_EXTENSIONS].token_len) {
fprintf(stderr, "extensions not supported\n");
goto bail;
}
if (wsi->utf8_token[WSI_TOKEN_KEY].token_len >=
MAX_WEBSOCKET_04_KEY_LEN) {
fprintf(stderr, "Client sent handshake key longer "

View file

@ -29,6 +29,7 @@ const struct lws_tokens lws_tokens[WSI_TOKEN_COUNT] = {
[WSI_TOKEN_KEY2] = { "Sec-WebSocket-Key2:", 19 },
[WSI_TOKEN_PROTOCOL] = { "Sec-WebSocket-Protocol:", 23 },
[WSI_TOKEN_UPGRADE] = { "Upgrade:", 8 },
[WSI_TOKEN_EXTENSIONS] = { "Sec-WebSocket-Extensions:", 25 },
[WSI_TOKEN_ORIGIN] = { "Origin:", 7 },
[WSI_TOKEN_DRAFT] = { "Sec-WebSocket-Draft:", 20 },
[WSI_TOKEN_CHALLENGE] = { "\x0d\x0a", 2 },
@ -63,6 +64,7 @@ int libwebsocket_parse(struct libwebsocket *wsi, unsigned char c)
case WSI_TOKEN_VERSION:
case WSI_TOKEN_ACCEPT:
case WSI_TOKEN_NONCE:
case WSI_TOKEN_EXTENSIONS:
case WSI_TOKEN_HTTP:
debug("WSI_TOKEN_(%d) '%c'\n", wsi->parser_state, c);

View file

@ -115,6 +115,9 @@ enum lws_token_indexes {
WSI_TOKEN_VERSION,
WSI_TOKEN_SWORIGIN,
/* new for 05 */
WSI_TOKEN_EXTENSIONS,
/* client receives these */
WSI_TOKEN_ACCEPT,
WSI_TOKEN_NONCE,