mirror of
https://github.com/warmcat/libwebsockets.git
synced 2025-03-09 00:00:04 +01:00
libwebsockets_read: update 'len' after lws_handshake_server invocation
This commit is contained in:
parent
c1fdd10ff8
commit
7c67634fec
1 changed files with 12 additions and 5 deletions
|
@ -132,11 +132,18 @@ http_postbody:
|
|||
if (lws_handshake_client(wsi, &buf, len))
|
||||
goto bail;
|
||||
|
||||
switch (lws_handshake_server(context, wsi, &buf, len)) {
|
||||
case 1:
|
||||
goto bail;
|
||||
case 2:
|
||||
goto http_postbody;
|
||||
/* It's possible that we've exhausted our data already, but
|
||||
* lws_handshake_server doesn't update len for us. Figure out how
|
||||
* much was read, so that we can proceed appropriately: */
|
||||
{
|
||||
unsigned char *last_char = buf;
|
||||
switch (lws_handshake_server(context, wsi, &buf, len)) {
|
||||
case 1:
|
||||
goto bail;
|
||||
case 2:
|
||||
len -= (buf - last_char);
|
||||
goto http_postbody;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue