-
Notifications
You must be signed in to change notification settings - Fork 39
Wasm HTTPUtil on main #76
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
3251e7c
Override http_util only if not already named 'WasmHTTPUtils'
carlopi 4548495
Extract some code to hash_functions.cpp/hpp
carlopi ae7230f
Feature select: no crytpo.cpp and no override of encryption_utils in …
carlopi bb583db
Bundle-in mbedtls
carlopi 9bf98ef
Re-enable wasm compilation
carlopi 104bec6
Skip conditionally also httpfs_client.cpp
carlopi a2cc411
Separate minimal HTTPFSUtil implementations into httpfs_client and ht…
carlopi File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,28 @@ | ||
| #include "mbedtls_wrapper.hpp" | ||
| #include "hash_functions.hpp" | ||
|
|
||
| namespace duckdb { | ||
|
|
||
| void sha256(const char *in, size_t in_len, hash_bytes &out) { | ||
| duckdb_mbedtls::MbedTlsWrapper::ComputeSha256Hash(in, in_len, (char *)out); | ||
| } | ||
|
|
||
| void hmac256(const std::string &message, const char *secret, size_t secret_len, hash_bytes &out) { | ||
| duckdb_mbedtls::MbedTlsWrapper::Hmac256(secret, secret_len, message.data(), message.size(), (char *)out); | ||
| } | ||
|
|
||
| void hmac256(std::string message, hash_bytes secret, hash_bytes &out) { | ||
| hmac256(message, (char *)secret, sizeof(hash_bytes), out); | ||
| } | ||
|
|
||
| void hex256(hash_bytes &in, hash_str &out) { | ||
| const char *hex = "0123456789abcdef"; | ||
| unsigned char *pin = in; | ||
| unsigned char *pout = out; | ||
| for (; pin < in + sizeof(in); pout += 2, pin++) { | ||
| pout[0] = hex[(*pin >> 4) & 0xF]; | ||
| pout[1] = hex[*pin & 0xF]; | ||
| } | ||
| } | ||
|
|
||
| } // namespace duckdb |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,16 @@ | ||
| #include "httpfs_client.hpp" | ||
| #include "http_state.hpp" | ||
|
|
||
| namespace duckdb { | ||
|
|
||
| unique_ptr<HTTPClient> HTTPFSUtil::InitializeClient(HTTPParams &http_params, const string &proto_host_port) { | ||
| throw InternalException("HTTPFSUtil::InitializeClient is not expected to be called"); | ||
| } | ||
|
|
||
| unordered_map<string, string> HTTPFSUtil::ParseGetParameters(const string &text) { | ||
| unordered_map<string, string> result; | ||
| //TODO: HTTPFSUtil::ParseGetParameters is currently not implemented | ||
| return result; | ||
| } | ||
|
|
||
| } // namespace duckdb |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,18 @@ | ||
| #pragma once | ||
|
|
||
| #include "duckdb/common/helper.hpp" | ||
|
|
||
| namespace duckdb { | ||
|
|
||
| typedef unsigned char hash_bytes[32]; | ||
| typedef unsigned char hash_str[64]; | ||
|
|
||
| void sha256(const char *in, size_t in_len, hash_bytes &out); | ||
|
|
||
| void hmac256(const std::string &message, const char *secret, size_t secret_len, hash_bytes &out); | ||
|
|
||
| void hmac256(std::string message, hash_bytes secret, hash_bytes &out); | ||
|
|
||
| void hex256(hash_bytes &in, hash_str &out); | ||
|
|
||
| } // namespace duckdb |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this necessary here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unfortunately, yes, I have not found a clean way to clean this up.
It should picked up from CMake, but that requires some changes in duckdb/duckdb that are not there (and unsure if they can land today).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I can fix this up, question is: it's a blocker?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't know what problems it causes but it seems hacky - maybe it's fine. I'll leave it up to you
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It does smell badly, you are right, now triggered to find the actual fix.