mirror of
https://github.com/ading2210/libcurl.js.git
synced 2025-05-11 13:30:01 -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
|
@ -111,14 +111,12 @@ class CurlWebSocket extends CurlSession {
|
|||
}
|
||||
|
||||
cleanup(error=0) {
|
||||
if (this.http_handle) {
|
||||
this.remove_request(this.http_handle);
|
||||
this.http_handle = null;
|
||||
super.close();
|
||||
}
|
||||
else return;
|
||||
|
||||
clearInterval(this.recv_loop);
|
||||
if (!this.connected)
|
||||
return;
|
||||
if (this.recv_loop)
|
||||
clearInterval(this.recv_loop);
|
||||
|
||||
super.close();
|
||||
this.connected = false;
|
||||
|
||||
if (error) {
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "libcurl.js",
|
||||
"version": "0.6.22",
|
||||
"version": "0.7.0",
|
||||
"description": "A port of libcurl to WebAssembly, for proxying HTTPS requests from the browser with full TLS encryption",
|
||||
"main": "libcurl.mjs",
|
||||
"exports": {
|
||||
|
|
|
@ -14,7 +14,7 @@ NGHTTP2_PREFIX=$(realpath build/nghttp2-wasm)
|
|||
|
||||
cd build
|
||||
rm -rf curl
|
||||
git clone -b curl-8_10_1 --depth=1 https://github.com/curl/curl
|
||||
git clone -b curl-8_11_1 --depth=1 https://github.com/curl/curl
|
||||
cd curl
|
||||
|
||||
autoreconf -fi
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue