From b7d6e0498455b035c715a01ee1884a1f4643504d Mon Sep 17 00:00:00 2001 From: Carlo Piovesan Date: Fri, 26 Sep 2025 14:40:41 +0200 Subject: [PATCH] Fixup conditionally prepending host_port --- lib/src/http_wasm.cc | 25 +++++++++++++++---------- 1 file changed, 15 insertions(+), 10 deletions(-) diff --git a/lib/src/http_wasm.cc b/lib/src/http_wasm.cc index dc39aa557..0bf73b585 100644 --- a/lib/src/http_wasm.cc +++ b/lib/src/http_wasm.cc @@ -20,10 +20,12 @@ class HTTPWasmClient : public HTTPClient { unique_ptr Get(GetRequestInfo &info) override { // clang-format off + unique_ptr res; - string path = host_port + info.url; - path = info.url; + string path = info.url; + if (path[0] == '/') path = host_port + info.url; + if (!web::experimental_s3_tables_global_proxy.empty()) { if (info.url.rfind(web::experimental_s3_tables_global_proxy, 0) != 0) { auto id_table = path.find("--table-s3.s3."); @@ -165,8 +167,9 @@ class HTTPWasmClient : public HTTPClient { unique_ptr Head(HeadRequestInfo &info) override { unique_ptr res; - string path = host_port + info.url; - path = info.url; + string path = info.url; + if (path[0] == '/') path = host_port + info.url; + if (!web::experimental_s3_tables_global_proxy.empty()) { if (info.url.rfind(web::experimental_s3_tables_global_proxy, 0) != 0) { auto id_table = path.find("--table-s3.s3."); @@ -405,8 +408,9 @@ res->headers.Insert(head, tail); unique_ptr Post(PostRequestInfo &info) override { unique_ptr res; - string path = host_port + info.url; - path = info.url; + string path = info.url; + if (path[0] == '/') path = host_port + info.url; + if (!web::experimental_s3_tables_global_proxy.empty()) { if (info.url.rfind(web::experimental_s3_tables_global_proxy, 0) != 0) { auto id_table = path.find("--table-s3.s3."); @@ -559,8 +563,9 @@ res->headers.Insert(head, tail); unique_ptr Put(PutRequestInfo &info) override { unique_ptr res; - string path = host_port + info.url; - path = info.url; + string path = info.url; + if (path[0] == '/') path = host_port + info.url; + if (!web::experimental_s3_tables_global_proxy.empty()) { if (info.url.rfind(web::experimental_s3_tables_global_proxy, 0) != 0) { auto id_table = path.find("--table-s3.s3."); @@ -713,8 +718,8 @@ res->headers.Insert(head, tail); unique_ptr Delete(DeleteRequestInfo &info) override { unique_ptr res; - string path = host_port + info.url; - path = info.url; + string path = info.url; + if (path[0] == '/') path = host_port + info.url; if (!web::experimental_s3_tables_global_proxy.empty()) { if (info.url.rfind(web::experimental_s3_tables_global_proxy, 0) != 0) {