mirror of
https://github.com/ading2210/libcurl.js.git
synced 2025-05-13 14:30:02 -04:00
update curl and fix memory error with websockets
This commit is contained in:
parent
8b53625743
commit
5c3c591a41
4 changed files with 19 additions and 13 deletions
|
@ -18,9 +18,17 @@ struct WSResult* recv_from_websocket(CURL* http_handle, int buffer_size) {
|
|||
result->buffer_size = result_len;
|
||||
result->buffer = buffer;
|
||||
result->res = (int) res;
|
||||
result->closed = (ws_meta->flags & CURLWS_CLOSE);
|
||||
result->is_text = (ws_meta->flags & CURLWS_TEXT);
|
||||
result->bytes_left = ws_meta->bytesleft;
|
||||
//ws_meta will be null if the recv is not successful, so don't try reading it otherwise
|
||||
if (res == CURLE_OK) {
|
||||
result->closed = (ws_meta->flags & CURLWS_CLOSE);
|
||||
result->is_text = (ws_meta->flags & CURLWS_TEXT);
|
||||
result->bytes_left = ws_meta->bytesleft;
|
||||
}
|
||||
else {
|
||||
result->closed = -1;
|
||||
result->is_text = -1;
|
||||
result->bytes_left = -1;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue