mirror of
https://github.com/ading2210/libcurl.js.git
synced 2025-05-12 14:00:01 -04:00
return the correct headers object
This commit is contained in:
parent
563a2b7310
commit
0b14c32b25
4 changed files with 16 additions and 2 deletions
|
@ -6,6 +6,9 @@ This is an experimental port of [libcurl](https://curl.se/libcurl/) to WebAssemb
|
|||
- Fetch compatible API
|
||||
- End to end encryption between the browser and the destination server
|
||||
- Support for up to TLS 1.3
|
||||
- Support for tunneling HTTP/2 connections
|
||||
- Bypass CORS restrictions
|
||||
- Low latency via multiplexing and reusing open connections
|
||||
|
||||
## Building:
|
||||
You can build this project by running the following commands:
|
||||
|
@ -70,7 +73,7 @@ This project is licensed under the GNU AGPL v3.
|
|||
|
||||
### Copyright Notice:
|
||||
```
|
||||
ading2210/libcurl.js - A port of libcurl to WASM
|
||||
ading2210/libcurl.js - A port of libcurl to WASM for the browser.
|
||||
Copyright (C) 2023 ading2210
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
|
|
|
@ -4,6 +4,6 @@ err\("__syscall_getsockname " ?\+ ?fd\);
|
|||
|
||||
|
||||
/* INSERT
|
||||
function _emscripten_console_error\(str\) {
|
||||
function _emscripten_console_error\(str\) ?{
|
||||
*/
|
||||
if (UTF8ToString(str).endsWith("__syscall_setsockopt\\n")) return;
|
|
@ -122,6 +122,7 @@ function create_response(response_data, response_info) {
|
|||
response_info.ok = response_info.status >= 200 && response_info.status < 300;
|
||||
response_info.statusText = status_messages[response_info.status] || "";
|
||||
|
||||
//construct base response object
|
||||
let response_obj = new Response(response_data, response_info);
|
||||
for (let key in response_info) {
|
||||
if (key == "headers") continue;
|
||||
|
@ -130,6 +131,13 @@ function create_response(response_data, response_info) {
|
|||
value: response_info[key]
|
||||
});
|
||||
}
|
||||
|
||||
//create headers object
|
||||
Object.defineProperty(response_obj, "headers", {
|
||||
writable: false,
|
||||
value: new Headers(response_info.headers)
|
||||
});
|
||||
|
||||
return response_obj;
|
||||
}
|
||||
|
||||
|
|
|
@ -16,6 +16,9 @@ for fragment_file in fragments_path.iterdir():
|
|||
matches = re.findall(match_regex, fragment_text, re.S)
|
||||
|
||||
for mode, patch_regex, patch_text, _ in matches:
|
||||
fragment_matches = re.findall(patch_regex, target_text)
|
||||
if not fragment_matches:
|
||||
print(f"warning: regex did not match anything - '{patch_regex}'");
|
||||
if mode == "DELETE":
|
||||
target_text = re.sub(patch_regex, "", target_text)
|
||||
elif mode == "REPLACE":
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue