Skip to content

Commit e4a2fea

Browse files
committed
Add scaffolding for duckdb-wasm's HTTP stack
1 parent ba4678d commit e4a2fea

File tree

4 files changed

+488
-0
lines changed

4 files changed

+488
-0
lines changed

lib/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -217,6 +217,7 @@ add_library(
217217
${CMAKE_SOURCE_DIR}/src/arrow_casts.cc
218218
${CMAKE_SOURCE_DIR}/src/arrow_insert_options.cc
219219
${CMAKE_SOURCE_DIR}/src/arrow_stream_buffer.cc
220+
${CMAKE_SOURCE_DIR}/src/http_wasm.cc
220221
${CMAKE_SOURCE_DIR}/src/arrow_type_mapping.cc
221222
${CMAKE_SOURCE_DIR}/src/config.cc
222223
${CMAKE_SOURCE_DIR}/src/csv_insert_options.cc

lib/include/duckdb/web/http_wasm.h

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
#include "duckdb/common/http_util.hpp"
2+
3+
namespace duckdb {
4+
5+
class HTTPLogger;
6+
class FileOpener;
7+
struct FileOpenerInfo;
8+
class HTTPState;
9+
10+
struct HTTPFSParams : public HTTPParams {
11+
HTTPFSParams(HTTPUtil &http_util) : HTTPParams(http_util) {
12+
}
13+
14+
static constexpr bool DEFAULT_ENABLE_SERVER_CERT_VERIFICATION = false;
15+
static constexpr uint64_t DEFAULT_HF_MAX_PER_PAGE = 0;
16+
static constexpr bool DEFAULT_FORCE_DOWNLOAD = false;
17+
18+
bool force_download = DEFAULT_FORCE_DOWNLOAD;
19+
bool enable_server_cert_verification = DEFAULT_ENABLE_SERVER_CERT_VERIFICATION;
20+
idx_t hf_max_per_page = DEFAULT_HF_MAX_PER_PAGE;
21+
string ca_cert_file;
22+
string bearer_token;
23+
shared_ptr<HTTPState> state;
24+
};
25+
26+
class HTTPWasmUtil : public HTTPUtil {
27+
public:
28+
unique_ptr<HTTPParams> InitializeParameters(optional_ptr<FileOpener> opener,
29+
optional_ptr<FileOpenerInfo> info) override {
30+
std::cout << "InitializeParameters\n";
31+
return make_uniq<HTTPFSParams>(*this);
32+
}
33+
unique_ptr<HTTPClient> InitializeClient(HTTPParams &http_params, const string &proto_host_port) override;
34+
35+
//static unordered_map<string, string> ParseGetParameters(const string &text);
36+
37+
string GetName() const override;
38+
};
39+
40+
41+
42+
43+
} // namespace duckdb
44+

0 commit comments

Comments
 (0)