-
Notifications
You must be signed in to change notification settings - Fork 70
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
Conversation
silkworm/rpc/http/connection.cpp
Outdated
@@ -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 |
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.
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); |
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.
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
No description provided.