Skip to content

Commit 23da3e9

Browse files
committed
Add s3_tables opt-in also to other request types
1 parent 1b3bfeb commit 23da3e9

File tree

1 file changed

+36
-0
lines changed

1 file changed

+36
-0
lines changed

lib/src/http_wasm.cc

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -166,6 +166,18 @@ class HTTPWasmClient : public HTTPClient {
166166

167167
string path = host_port + info.url;
168168
path = info.url;
169+
if (!web::experimental_s3_tables_global_proxy.empty()) {
170+
if (info.url.rfind(web::experimental_s3_tables_global_proxy, 0) != 0) {
171+
auto id_table = path.find("--table-s3.s3.");
172+
auto id_aws = path.find(".amazonaws.com/");
173+
if (id_table != std::string::npos && id_aws != std::string::npos && id_table < id_aws) {
174+
path = web::experimental_s3_tables_global_proxy + path.substr(8);
175+
}
176+
}
177+
}
178+
if (path.rfind("https://", 0 != 0)) {
179+
path = "https://" + path;
180+
}
169181

170182
int n = 0;
171183
for (auto h : info.headers) {
@@ -298,6 +310,18 @@ class HTTPWasmClient : public HTTPClient {
298310

299311
string path = host_port + info.url;
300312
path = info.url;
313+
if (!web::experimental_s3_tables_global_proxy.empty()) {
314+
if (info.url.rfind(web::experimental_s3_tables_global_proxy, 0) != 0) {
315+
auto id_table = path.find("--table-s3.s3.");
316+
auto id_aws = path.find(".amazonaws.com/");
317+
if (id_table != std::string::npos && id_aws != std::string::npos && id_table < id_aws) {
318+
path = web::experimental_s3_tables_global_proxy + path.substr(8);
319+
}
320+
}
321+
}
322+
if (path.rfind("https://", 0 != 0)) {
323+
path = "https://" + path;
324+
}
301325

302326
int n = 0;
303327
for (auto h : info.headers) {
@@ -440,6 +464,18 @@ class HTTPWasmClient : public HTTPClient {
440464

441465
string path = host_port + info.url;
442466
path = info.url;
467+
if (!web::experimental_s3_tables_global_proxy.empty()) {
468+
if (info.url.rfind(web::experimental_s3_tables_global_proxy, 0) != 0) {
469+
auto id_table = path.find("--table-s3.s3.");
470+
auto id_aws = path.find(".amazonaws.com/");
471+
if (id_table != std::string::npos && id_aws != std::string::npos && id_table < id_aws) {
472+
path = web::experimental_s3_tables_global_proxy + path.substr(8);
473+
}
474+
}
475+
}
476+
if (path.rfind("https://", 0 != 0)) {
477+
path = "https://" + path;
478+
}
443479

444480
int n = 0;
445481
for (auto h : info.headers) {

0 commit comments

Comments
 (0)