Skip to content

Commit 4790bc7

Browse files
authoredNov 27, 2024··
Added https support (#14)
1 parent d3a3dee commit 4790bc7

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed
 

‎src/http_client_extension.cpp

+9-2
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ namespace duckdb {
2323

2424
// Helper function to parse URL and setup client
2525
static std::pair<duckdb_httplib_openssl::Client, std::string> SetupHttpClient(const std::string &url) {
26-
std::string scheme, domain, path;
26+
std::string scheme, domain, path, client_url;
2727
size_t pos = url.find("://");
2828
std::string mod_url = url;
2929
if (pos != std::string::npos) {
@@ -40,8 +40,15 @@ static std::pair<duckdb_httplib_openssl::Client, std::string> SetupHttpClient(co
4040
path = "/";
4141
}
4242

43+
// Construct client url with https if specified
44+
if (scheme == "https") {
45+
client_url = scheme + "://" + domain;
46+
} else {
47+
client_url = domain;
48+
}
49+
4350
// Create client and set a reasonable timeout (e.g., 10 seconds)
44-
duckdb_httplib_openssl::Client client(domain.c_str());
51+
duckdb_httplib_openssl::Client client(client_url);
4552
client.set_read_timeout(10, 0); // 10 seconds
4653
client.set_follow_location(true); // Follow redirects
4754

0 commit comments

Comments
 (0)
Please sign in to comment.