diff --git a/README.md b/README.md index a8f56db..3dd62f2 100644 --- a/README.md +++ b/README.md @@ -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 diff --git a/client/fragments/silence_socket.js b/client/fragments/silence_socket.js index 2178f6a..de7bf00 100644 --- a/client/fragments/silence_socket.js +++ b/client/fragments/silence_socket.js @@ -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; \ No newline at end of file diff --git a/client/main.js b/client/main.js index 28eab38..3b65176 100644 --- a/client/main.js +++ b/client/main.js @@ -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; } diff --git a/client/patcher.py b/client/patcher.py index bf06c6d..1ae1ad0 100644 --- a/client/patcher.py +++ b/client/patcher.py @@ -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":