Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions source/common/router/router.cc
Original file line number Diff line number Diff line change
Expand Up @@ -720,7 +720,10 @@ void Filter::handleNon5xxResponseHeaders(const Http::HeaderMap& headers,
}
}

void Filter::onUpstream100ContinueHeaders(Http::HeaderMapPtr&& headers) {
void Filter::onUpstream100ContinueHeaders(Http::HeaderMapPtr&& headers,
UpstreamRequest& upstream_request) {
const uint64_t response_code = Http::Utility::getResponseStatus(*headers);

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Do we need response_code, or can we assume it to be 100 at this point?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I was trying to future-proof for 1xx but it looks like we're pretty strict elsewhere that it's exactly 100 so I'll go with that :-)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thanks for the clarification. :)

chargeUpstreamCode(response_code, *headers, upstream_request.upstream_host_, false);
ENVOY_STREAM_LOG(debug, "upstream 100 continue", *callbacks_);

downstream_response_started_ = true;
Expand Down Expand Up @@ -1030,7 +1033,7 @@ Filter::UpstreamRequest::~UpstreamRequest() {

void Filter::UpstreamRequest::decode100ContinueHeaders(Http::HeaderMapPtr&& headers) {
ASSERT(100 == Http::Utility::getResponseStatus(*headers));
parent_.onUpstream100ContinueHeaders(std::move(headers));
parent_.onUpstream100ContinueHeaders(std::move(headers), *this);
}

void Filter::UpstreamRequest::decodeHeaders(Http::HeaderMapPtr&& headers, bool end_stream) {
Expand Down
3 changes: 2 additions & 1 deletion source/common/router/router.h
Original file line number Diff line number Diff line change
Expand Up @@ -382,7 +382,8 @@ class Filter : Logger::Loggable<Logger::Id::router>,
void onPerTryTimeout(UpstreamRequest& upstream_request);
void onRequestComplete();
void onResponseTimeout();
void onUpstream100ContinueHeaders(Http::HeaderMapPtr&& headers);
void onUpstream100ContinueHeaders(Http::HeaderMapPtr&& headers,
UpstreamRequest& upstream_request);
// Handle an upstream request aborted due to a local timeout.
void onUpstreamTimeoutAbort(StreamInfo::ResponseFlag response_flag);
// Handle an "aborted" upstream request, meaning we didn't see response
Expand Down
3 changes: 3 additions & 0 deletions test/common/router/router_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1585,6 +1585,9 @@ TEST_F(RouterTest, RetryUpstreamReset100ContinueResponseStarted) {
EXPECT_CALL(callbacks_, encode100ContinueHeaders_(_));
Http::HeaderMapPtr continue_headers(new Http::TestHeaderMapImpl{{":status", "100"}});
response_decoder->decode100ContinueHeaders(std::move(continue_headers));
EXPECT_EQ(
1U,
cm_.thread_local_cluster_.cluster_.info_->stats_store_.counter("upstream_rq_100").value());
EXPECT_CALL(cm_.conn_pool_.host_->outlier_detector_, putHttpResponseCode(503));
encoder1.stream_.resetStream(Http::StreamResetReason::RemoteReset);
}
Expand Down