Skip to content

Commit

Permalink
Comments
Browse files Browse the repository at this point in the history
Signed-off-by: Brian Sonnenberg <bsonnenberg@google.com>
  • Loading branch information
briansonnenberg committed Jan 8, 2025
1 parent d0b0b7d commit fe4664d
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@ Filter::Filter(const ConfigSharedPtr config)
if (Runtime::runtimeFeatureEnabled("envoy.reloadable_features.http_inspector_use_balsa_parser")) {
// Set both allow_custom_methods and enable_trailers to true with BalsaParser.
parser_ = std::make_unique<Http::Http1::BalsaParser>(
Http::Http1::MessageType::Request, &no_op_callbacks_,
Config::MAX_INSPECT_SIZE + max_request_headers_kb_, true, true);
Http::Http1::MessageType::Request, &no_op_callbacks_, Config::MAX_INSPECT_SIZE + 1024, true,
true);
} else {
parser_ = std::make_unique<Http::Http1::LegacyHttpParserImpl>(Http::Http1::MessageType::Request,
&no_op_callbacks_);
Expand All @@ -55,7 +55,7 @@ Network::FilterStatus Filter::onData(Network::ListenerFilterBuffer& buffer) {

// If we have requested the maximum amount of data, then close the connection
// the request line is too large to determine the http version.
if (static_cast<size_t>(nread_) == Config::MAX_INSPECT_SIZE) {
if (static_cast<size_t>(nread_) >= Config::MAX_INSPECT_SIZE) {
ENVOY_LOG(warn, "http inspector: reached max buffer without determining HTTP version, "
"dropping connection");
config_->stats().read_error_.inc();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ class Filter : public Network::ListenerFilter, Logger::Loggable<Logger::Id::filt
std::unique_ptr<Http::Http1::Parser> parser_;
NoOpParserCallbacks no_op_callbacks_;
ssize_t nread_ = 0;
size_t requested_read_bytes_;
size_t requested_read_bytes_ = 0;
uint32_t max_request_headers_kb_{Http::DEFAULT_MAX_REQUEST_HEADERS_KB};
};

Expand Down

0 comments on commit fe4664d

Please sign in to comment.