mirror of
https://github.com/ading2210/libcurl.js.git
synced 2025-05-13 22:40:01 -04:00
improve speeds and fix invalid mime type in blobs
This commit is contained in:
parent
0897769f70
commit
8e5a23adf2
4 changed files with 17 additions and 3 deletions
|
@ -1,5 +1,9 @@
|
||||||
# Libcurl.js Changelog:
|
# Libcurl.js Changelog:
|
||||||
|
|
||||||
|
## v0.6.19 (11/1/24):
|
||||||
|
- Improve download speeds even more by reducing memory copies
|
||||||
|
- Fix wrong mime type being reported in response blob
|
||||||
|
|
||||||
## v0.6.18 (10/29/24):
|
## v0.6.18 (10/29/24):
|
||||||
- Improve download speeds by increasing libcurl's internal buffer size and listening directly for websocket messages
|
- Improve download speeds by increasing libcurl's internal buffer size and listening directly for websocket messages
|
||||||
|
|
||||||
|
|
|
@ -157,6 +157,17 @@ class HTTPSession extends CurlSession {
|
||||||
for (let [header_name, header_value] of response_info.headers) {
|
for (let [header_name, header_value] of response_info.headers) {
|
||||||
response_obj.headers.append(header_name, header_value);
|
response_obj.headers.append(header_name, header_value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//hack to fix invalid blob type
|
||||||
|
let response_proto = Object.getPrototypeOf(response_obj);
|
||||||
|
response_obj.blob = async () => {
|
||||||
|
let blob = await response_proto.blob.call(response_obj);
|
||||||
|
let mime_type = blob.type.split(";")[0].trim();
|
||||||
|
Object.defineProperty(blob, "type", {
|
||||||
|
value: mime_type
|
||||||
|
});
|
||||||
|
return blob;
|
||||||
|
}
|
||||||
|
|
||||||
return response_obj;
|
return response_obj;
|
||||||
}
|
}
|
||||||
|
|
|
@ -41,8 +41,7 @@ class CurlSession {
|
||||||
|
|
||||||
data_callback(request_id, chunk_ptr, chunk_size) {
|
data_callback(request_id, chunk_ptr, chunk_size) {
|
||||||
let data = Module.HEAPU8.subarray(chunk_ptr, chunk_ptr + chunk_size);
|
let data = Module.HEAPU8.subarray(chunk_ptr, chunk_ptr + chunk_size);
|
||||||
let chunk = new Uint8Array(data);
|
this.request_callbacks[request_id].data(data);
|
||||||
this.request_callbacks[request_id].data(chunk);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
headers_callback(request_id, chunk_ptr, chunk_size) {
|
headers_callback(request_id, chunk_ptr, chunk_size) {
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "libcurl.js",
|
"name": "libcurl.js",
|
||||||
"version": "0.6.18",
|
"version": "0.6.19",
|
||||||
"description": "A port of libcurl to WebAssembly, for proxying HTTPS requests from the browser with full TLS encryption",
|
"description": "A port of libcurl to WebAssembly, for proxying HTTPS requests from the browser with full TLS encryption",
|
||||||
"main": "libcurl.mjs",
|
"main": "libcurl.mjs",
|
||||||
"exports": {
|
"exports": {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue