mirror of
https://github.com/warmcat/libwebsockets.git
synced 2025-03-09 00:00:04 +01:00
eliminate dummy 76 challenge content in 04 plus
Signed-off-by: Andy Green <andy@warmcat.com>
This commit is contained in:
parent
4b6fbe125e
commit
abbf461998
1 changed files with 13 additions and 1 deletions
|
@ -119,12 +119,21 @@ int libwebsocket_parse(struct libwebsocket *wsi, unsigned char c)
|
|||
wsi->utf8_token[wsi->parser_state].token_len != 8)
|
||||
break;
|
||||
|
||||
/* <= 03 has old handshake with version header */
|
||||
/* <= 03 has old handshake with version header needs 8 bytes */
|
||||
if (wsi->utf8_token[WSI_TOKEN_VERSION].token_len &&
|
||||
atoi(wsi->utf8_token[WSI_TOKEN_VERSION].token) < 4 &&
|
||||
wsi->utf8_token[wsi->parser_state].token_len != 8)
|
||||
break;
|
||||
|
||||
/* no payload challenge in 01 + */
|
||||
|
||||
if (wsi->utf8_token[WSI_TOKEN_VERSION].token_len &&
|
||||
atoi(wsi->utf8_token[WSI_TOKEN_VERSION].token) > 0) {
|
||||
wsi->utf8_token[wsi->parser_state].token_len = 0;
|
||||
free(wsi->utf8_token[wsi->parser_state].token);
|
||||
wsi->utf8_token[wsi->parser_state].token = NULL;
|
||||
}
|
||||
|
||||
/* For any supported protocol we have enough payload */
|
||||
|
||||
debug("Setting WSI_PARSING_COMPLETE\n");
|
||||
|
@ -185,6 +194,9 @@ int libwebsocket_parse(struct libwebsocket *wsi, unsigned char c)
|
|||
atoi(wsi->utf8_token[WSI_TOKEN_VERSION].token) >= 4) {
|
||||
debug("04 header completed\n");
|
||||
wsi->parser_state = WSI_PARSING_COMPLETE;
|
||||
wsi->utf8_token[WSI_TOKEN_CHALLENGE].token_len = 0;
|
||||
free(wsi->utf8_token[WSI_TOKEN_CHALLENGE].token);
|
||||
wsi->utf8_token[WSI_TOKEN_CHALLENGE].token = NULL;
|
||||
}
|
||||
|
||||
/* client parser? */
|
||||
|
|
Loading…
Add table
Reference in a new issue