File tree Expand file tree Collapse file tree 4 files changed +68
-46
lines changed Expand file tree Collapse file tree 4 files changed +68
-46
lines changed Original file line number Diff line number Diff line change 77#include < sys/stat.h>
88#include " duckdb/common/exception/http_exception.hpp"
99
10+ #ifndef EMSCRIPTEN
11+ #include " httpfs_curl_client.hpp"
12+ #endif
13+
1014namespace duckdb {
1115
1216// we statically compile in libcurl, which means the cert file location of the build machine is the
Original file line number Diff line number Diff line change 99#include " crypto.hpp"
1010#endif // OVERRIDE_ENCRYPTION_UTILS
1111
12+ #ifndef EMSCRIPTEN
13+ #include " httpfs_curl_client.hpp"
14+ #endif
15+
1216namespace duckdb {
1317
1418static void SetHttpfsClientImplementation (DBConfig &config, const string &value) {
@@ -98,6 +102,7 @@ static void LoadInternal(ExtensionLoader &loader) {
98102 throw InvalidInputException (" Unsupported option for httpfs_client_implementation, only `wasm` and "
99103 " `default` are currently supported for duckdb-wasm" );
100104 }
105+ #ifndef EMSCRIPTEN
101106 if (value == " curl" ) {
102107 if (!config.http_util || config.http_util ->GetName () != " HTTPFSUtil-Curl" ) {
103108 config.http_util = make_shared_ptr<HTTPFSCurlUtil>();
@@ -110,6 +115,7 @@ static void LoadInternal(ExtensionLoader &loader) {
110115 }
111116 return ;
112117 }
118+ #endif
113119 throw InvalidInputException (" Unsupported option for httpfs_client_implementation, only `curl`, `httplib` and "
114120 " `default` are currently supported" );
115121 };
Original file line number Diff line number Diff line change 11#pragma once
22
33#include " duckdb/common/http_util.hpp"
4- #include < curl/curl.h>
54
65namespace duckdb {
76class HTTPLogger ;
@@ -50,51 +49,6 @@ class HTTPFSCurlUtil : public HTTPFSUtil {
5049 string GetName () const override ;
5150};
5251
53- class CURLHandle {
54- public:
55- CURLHandle (const string &token, const string &cert_path);
56- ~CURLHandle ();
57-
58- public:
59- operator CURL *() {
60- return curl;
61- }
62- CURLcode Execute () {
63- return curl_easy_perform (curl);
64- }
65-
66- private:
67- CURL *curl = NULL ;
68- };
69-
70- class CURLRequestHeaders {
71- public:
72- CURLRequestHeaders (vector<std::string> &input) {
73- for (auto &header : input) {
74- Add (header);
75- }
76- }
77- CURLRequestHeaders () {}
78-
79- ~CURLRequestHeaders () {
80- if (headers) {
81- curl_slist_free_all (headers);
82- }
83- headers = NULL ;
84- }
85- operator bool () const {
86- return headers != NULL ;
87- }
88-
89- public:
90- void Add (const string &header) {
91- headers = curl_slist_append (headers, header.c_str ());
92- }
93-
94- public:
95- curl_slist *headers = NULL ;
96- };
97-
9852struct HeaderCollector {
9953 std::vector<HTTPHeaders> header_collection;
10054};
Original file line number Diff line number Diff line change 1+ #pragma once
2+
3+ #include " duckdb/common/http_util.hpp"
4+
5+ namespace duckdb {
6+ class HTTPLogger ;
7+ class FileOpener ;
8+ struct FileOpenerInfo ;
9+ class HTTPState ;
10+
11+ #include < curl/curl.h>
12+ class CURLHandle {
13+ public:
14+ CURLHandle (const string &token, const string &cert_path);
15+ ~CURLHandle ();
16+
17+ public:
18+ operator CURL *() {
19+ return curl;
20+ }
21+ CURLcode Execute () {
22+ return curl_easy_perform (curl);
23+ }
24+
25+ private:
26+ CURL *curl = NULL ;
27+ };
28+
29+ class CURLRequestHeaders {
30+ public:
31+ CURLRequestHeaders (vector<std::string> &input) {
32+ for (auto &header : input) {
33+ Add (header);
34+ }
35+ }
36+ CURLRequestHeaders () {}
37+
38+ ~CURLRequestHeaders () {
39+ if (headers) {
40+ curl_slist_free_all (headers);
41+ }
42+ headers = NULL ;
43+ }
44+ operator bool () const {
45+ return headers != NULL ;
46+ }
47+
48+ public:
49+ void Add (const string &header) {
50+ headers = curl_slist_append (headers, header.c_str ());
51+ }
52+
53+ public:
54+ curl_slist *headers = NULL ;
55+ };
56+
57+ } // namespace duckdb
58+
You can’t perform that action at this time.
0 commit comments