Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
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
4 changes: 4 additions & 0 deletions docs/root/configuration/observability/access_log/usage.rst
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,10 @@ The following command operators are supported:
HTTP response code. Note that a response code of '0' means that the server never sent the
beginning of a response. This generally means that the (downstream) client disconnected.

Note that in the case of 100-continue responses, only the response code of the final headers
will be logged. If a 100-continue is followed by a 200, the logged response will be 200.
If a 100-continue results in a disconnect, the 100 will be logged.

TCP
Not implemented ("-").

Expand Down
14 changes: 13 additions & 1 deletion test/integration/http_integration.cc
Original file line number Diff line number Diff line change
Expand Up @@ -829,7 +829,9 @@ void HttpIntegrationTest::testGrpcRetry() {
}

void HttpIntegrationTest::testEnvoyHandling100Continue(bool additional_continue_from_upstream,
const std::string& via) {
const std::string& via,
bool disconnect_after_100) {
useAccessLog("%RESPONSE_CODE%");
initialize();
codec_client_ = makeHttpConnection(lookupPort("http"));

Expand Down Expand Up @@ -865,6 +867,15 @@ void HttpIntegrationTest::testEnvoyHandling100Continue(bool additional_continue_
upstream_request_->encode100ContinueHeaders(
Http::TestResponseHeaderMapImpl{{":status", "100"}});
}

if (disconnect_after_100) {
response->waitForContinueHeaders();
codec_client_->close();
ASSERT_TRUE(fake_upstream_connection_->close());
EXPECT_THAT(waitForAccessLog(access_log_name_), HasSubstr("100"));
return;
}

upstream_request_->encodeHeaders(default_response_headers_, false);
upstream_request_->encodeData(12, true);

Expand All @@ -879,6 +890,7 @@ void HttpIntegrationTest::testEnvoyHandling100Continue(bool additional_continue_
} else {
EXPECT_EQ(via.c_str(), response->headers().getViaValue());
}
EXPECT_THAT(waitForAccessLog(access_log_name_), HasSubstr("200"));
}

void HttpIntegrationTest::testEnvoyProxying1xx(bool continue_before_upstream_complete,
Expand Down
2 changes: 1 addition & 1 deletion test/integration/http_integration.h
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,7 @@ class HttpIntegrationTest : public BaseIntegrationTest {
void testGrpcRetry();

void testEnvoyHandling100Continue(bool additional_continue_from_upstream = false,
const std::string& via = "");
const std::string& via = "", bool disconnect_after_100 = false);
void testEnvoyProxying1xx(bool continue_before_upstream_complete = false,
bool with_encoder_filter = false,
bool with_multiple_1xx_headers = false);
Expand Down
8 changes: 8 additions & 0 deletions test/integration/protocol_integration_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -993,6 +993,14 @@ TEST_P(ProtocolIntegrationTest, HittingEncoderFilterLimit) {
test_server_->waitForCounterEq("http.config_test.downstream_rq_5xx", 1);
}

// The downstream connection is closed when it is read disabled, and on OSX the
// connection error is not detected under these circumstances.
#if !defined(__APPLE__)
TEST_P(ProtocolIntegrationTest, 100ContinueAndClose) {
testEnvoyHandling100Continue(false, "", true);
}
#endif

TEST_P(ProtocolIntegrationTest, EnvoyHandling100Continue) { testEnvoyHandling100Continue(); }

TEST_P(ProtocolIntegrationTest, EnvoyHandlingDuplicate100Continue) {
Expand Down