mirror of
https://github.com/cesanta/mongoose.git
synced 2024-12-28 07:28:13 +08:00
Fix WS frame length encoding for len 0xffff
This commit is contained in:
parent
3895678bee
commit
abfd81cb9d
@ -3892,7 +3892,7 @@ size_t mg_ws_send(struct mg_connection *c, const char *buf, size_t len,
|
||||
if (len < 126) {
|
||||
header[1] = (unsigned char) len;
|
||||
header_len = 2;
|
||||
} else if (len < 65535) {
|
||||
} else if (len < 65536) {
|
||||
uint16_t tmp = mg_htons((uint16_t) len);
|
||||
header[1] = 126;
|
||||
memcpy(&header[2], &tmp, sizeof(tmp));
|
||||
|
2
src/ws.c
2
src/ws.c
@ -72,7 +72,7 @@ size_t mg_ws_send(struct mg_connection *c, const char *buf, size_t len,
|
||||
if (len < 126) {
|
||||
header[1] = (unsigned char) len;
|
||||
header_len = 2;
|
||||
} else if (len < 65535) {
|
||||
} else if (len < 65536) {
|
||||
uint16_t tmp = mg_htons((uint16_t) len);
|
||||
header[1] = 126;
|
||||
memcpy(&header[2], &tmp, sizeof(tmp));
|
||||
|
Loading…
x
Reference in New Issue
Block a user