Skip to content

Commit

Permalink
build: miscellaneous hygiene fixes (#7888)
Browse files Browse the repository at this point in the history
Signed-off-by: Alex Konradi <[email protected]>
  • Loading branch information
akonradi authored and mattklein123 committed Aug 12, 2019
1 parent 93f87c3 commit 1cf877d
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 7 deletions.
9 changes: 5 additions & 4 deletions source/common/http/http1/codec_impl.cc
Original file line number Diff line number Diff line change
Expand Up @@ -326,12 +326,13 @@ const ToLowerTable& ConnectionImpl::toLowerTable() {
}

ConnectionImpl::ConnectionImpl(Network::Connection& connection, Stats::Scope& stats,
http_parser_type type, uint32_t max_headers_kb)
http_parser_type type, uint32_t max_request_headers_kb)
: connection_(connection), stats_{ALL_HTTP1_CODEC_STATS(POOL_COUNTER_PREFIX(stats, "http1."))},
output_buffer_([&]() -> void { this->onBelowLowWatermark(); },
[&]() -> void { this->onAboveHighWatermark(); }),
max_headers_kb_(max_headers_kb), strict_header_validation_(Runtime::runtimeFeatureEnabled(
"envoy.reloadable_features.strict_header_validation")) {
max_request_headers_kb_(max_request_headers_kb),
strict_header_validation_(
Runtime::runtimeFeatureEnabled("envoy.reloadable_features.strict_header_validation")) {
output_buffer_.setWatermarks(connection.bufferLimit());
http_parser_init(&parser_, type);
parser_.data = this;
Expand Down Expand Up @@ -452,7 +453,7 @@ void ConnectionImpl::onHeaderValue(const char* data, size_t length) {

const uint32_t total =
current_header_field_.size() + current_header_value_.size() + current_header_map_->byteSize();
if (total > (max_headers_kb_ * 1024)) {
if (total > (max_request_headers_kb_ * 1024)) {
error_code_ = Http::Code::RequestHeaderFieldsTooLarge;
sendProtocolError();
throw CodecProtocolException("headers size exceeds limit");
Expand Down
2 changes: 1 addition & 1 deletion source/common/http/http1/codec_impl.h
Original file line number Diff line number Diff line change
Expand Up @@ -300,7 +300,7 @@ class ConnectionImpl : public virtual Connection, protected Logger::Loggable<Log
Buffer::RawSlice reserved_iovec_;
char* reserved_current_{};
Protocol protocol_{Protocol::Http11};
const uint32_t max_headers_kb_;
const uint32_t max_request_headers_kb_;

bool strict_header_validation_;
};
Expand Down
1 change: 1 addition & 0 deletions source/common/singleton/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -30,4 +30,5 @@ envoy_cc_library(
name = "threadsafe_singleton",
hdrs = ["threadsafe_singleton.h"],
external_deps = ["abseil_base"],
deps = ["//source/common/common:assert_lib"],
)
2 changes: 2 additions & 0 deletions source/common/singleton/threadsafe_singleton.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

#include <memory>

#include "common/common/assert.h"

#include "absl/base/call_once.h"

namespace Envoy {
Expand Down
4 changes: 2 additions & 2 deletions source/common/stats/symbol_table_impl.h
Original file line number Diff line number Diff line change
Expand Up @@ -652,7 +652,7 @@ class StatNameSet {
void rememberBuiltin(absl::string_view str);

/**
* Finds a StatName by name. If 'str' has been remembered as a built-in, then
* Finds a StatName by name. If 'token' has been remembered as a built-in, then
* no lock is required. Otherwise we first consult dynamic_stat_names_ under a
* lock that's private to the StatNameSet. If that's empty, we need to create
* the StatName in the pool, which requires taking a global lock.
Expand All @@ -661,7 +661,7 @@ class StatNameSet {
* set's mutex and also the SymbolTable mutex which must be taken during
* StatNamePool::add().
*/
StatName getStatName(absl::string_view str);
StatName getStatName(absl::string_view token);

/**
* Adds a StatName using the pool, but without remembering it in any maps.
Expand Down

0 comments on commit 1cf877d

Please sign in to comment.