Skip to content
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

rpcdaemon: negotiation and validation of HTTP compression scheme #1914

Merged
merged 5 commits into from
Mar 19, 2024

Conversation

lupin012
Copy link
Contributor

No description provided.

@lupin012 lupin012 added the enhancement New feature or improvement label Mar 17, 2024
@lupin012 lupin012 changed the title rpcdaemon;: Algo negotation and validation rpcdaemon: Algo negotation and validation Mar 17, 2024
@lupin012 lupin012 requested a review from canepat March 17, 2024 16:15
@canepat canepat changed the title rpcdaemon: Algo negotation and validation rpcdaemon: negotiation and validation of HTTP compression scheme Mar 18, 2024
@@ -42,6 +43,7 @@ namespace silkworm::rpc::http {
static constexpr std::string_view kMaxAge{"600"};
static constexpr auto kMaxPayloadSize{30 * kMebi}; // 30MiB
static constexpr std::array kAcceptedContentTypes{"application/json", "application/jsonrequest", "application/json-rpc"};
static std::vector<std::string> SupportedCompressionList{"gzip"}; // specify the compression algo in priority level
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Given that we need to support just one compression scheme (i.e. gzip), it's better to avoid handling a list of schemes: we will do it in the future if necessary. No need to do the changes here, next PR is fine

boost::iostreams::filtering_ostream out;
out.push(boost::iostreams::gzip_compressor());
out.push(boost::iostreams::back_inserter(compressed_data));
boost::iostreams::copy(boost::make_iterator_range(clear_data), out);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can probably improve here by keeping the boost::iostreams::filtering_ostream instance and the compressed data buffer as state variables in http::Connection in order to have gzip initialisation/finalisation happen only once per connection (as opposed to doing it for every data compression). Next PR

@canepat canepat merged commit 2f34e83 into master Mar 19, 2024
4 checks passed
@canepat canepat deleted the algo_negotation_and_validation branch March 19, 2024 12:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or improvement
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants