Skip to content

Commit 2fc788a

Browse files
committed
Format lib/include/duckdb/web/http_wasm.h
1 parent 963f007 commit 2fc788a

File tree

3 files changed

+27
-32
lines changed

3 files changed

+27
-32
lines changed

lib/include/duckdb/web/http_wasm.h

Lines changed: 22 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -8,37 +8,32 @@ struct FileOpenerInfo;
88
class HTTPState;
99

1010
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;
11+
HTTPFSParams(HTTPUtil &http_util) : HTTPParams(http_util) {}
12+
13+
static constexpr bool DEFAULT_ENABLE_SERVER_CERT_VERIFICATION = false;
14+
static constexpr uint64_t DEFAULT_HF_MAX_PER_PAGE = 0;
15+
static constexpr bool DEFAULT_FORCE_DOWNLOAD = false;
16+
17+
bool force_download = DEFAULT_FORCE_DOWNLOAD;
18+
bool enable_server_cert_verification = DEFAULT_ENABLE_SERVER_CERT_VERIFICATION;
19+
idx_t hf_max_per_page = DEFAULT_HF_MAX_PER_PAGE;
20+
string ca_cert_file;
21+
string bearer_token;
22+
shared_ptr<HTTPState> state;
2423
};
2524

2625
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;
26+
public:
27+
unique_ptr<HTTPParams> InitializeParameters(optional_ptr<FileOpener> opener,
28+
optional_ptr<FileOpenerInfo> info) override {
29+
std::cout << "InitializeParameters\n";
30+
return make_uniq<HTTPFSParams>(*this);
31+
}
32+
unique_ptr<HTTPClient> InitializeClient(HTTPParams &http_params, const string &proto_host_port) override;
3433

35-
//static unordered_map<string, string> ParseGetParameters(const string &text);
34+
// static unordered_map<string, string> ParseGetParameters(const string &text);
3635

37-
string GetName() const override;
36+
string GetName() const override;
3837
};
3938

40-
41-
42-
43-
} // namespace duckdb
44-
39+
} // namespace duckdb

lib/src/http_wasm.cc

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ class HTTPFSClient : public HTTPClient {
4646
exe = (char *)EM_ASM_PTR(
4747
{
4848
var url = (UTF8ToString($0));
49-
if (typeof XMLHttpRequest == = "undefined") {
49+
if (typeof XMLHttpRequest === "undefined") {
5050
return 0;
5151
}
5252
const xhr = new XMLHttpRequest();
@@ -62,7 +62,7 @@ class HTTPFSClient : public HTTPClient {
6262
try {
6363
xhr.setRequestHeader(encodeURI(UTF8ToString(ptr1)), encodeURI(UTF8ToString(ptr2)));
6464
} catch (error) {
65-
console.warn("Error while performing XMLHttpRequest.setRequestHeader(), error);
65+
console.warn("Error while performing XMLHttpRequest.setRequestHeader()", error);
6666
}
6767
i += 2;
6868
}
@@ -161,7 +161,7 @@ class HTTPFSClient : public HTTPClient {
161161
exe = (char *)EM_ASM_PTR(
162162
{
163163
var url = (UTF8ToString($0));
164-
if (typeof XMLHttpRequest == = "undefined") {
164+
if (typeof XMLHttpRequest === "undefined") {
165165
return 0;
166166
}
167167
const xhr = new XMLHttpRequest();
@@ -177,7 +177,7 @@ class HTTPFSClient : public HTTPClient {
177177
try {
178178
xhr.setRequestHeader(encodeURI(UTF8ToString(ptr1)), encodeURI(UTF8ToString(ptr2)));
179179
} catch (error) {
180-
console.warn("Error while performing XMLHttpRequest.setRequestHeader(), error);
180+
console.warn("Error while performing XMLHttpRequest.setRequestHeader()", error);
181181
}
182182
i += 2;
183183
}

lib/src/webdb.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
#define RAPIDJSON_HAS_STDSTRING 1
22

33
#include "duckdb/web/webdb.h"
4-
#include "duckdb/web/http_wasm.h"
54

65
#include <emscripten/val.h>
76

@@ -53,6 +52,7 @@
5352
#include "duckdb/web/extensions/json_extension.h"
5453
#include "duckdb/web/extensions/parquet_extension.h"
5554
#include "duckdb/web/functions/table_function_relation.h"
55+
#include "duckdb/web/http_wasm.h"
5656
#include "duckdb/web/io/arrow_ifstream.h"
5757
#include "duckdb/web/io/buffered_filesystem.h"
5858
#include "duckdb/web/io/file_page_buffer.h"

0 commit comments

Comments
 (0)