Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
c447fd8
http: proxying 104s `Upload Resumption Supported`
Nealsoni00 Jun 13, 2024
2f3ca2f
[HF] lint
Nealsoni00 Jun 13, 2024
3f4fdba
[FIX] test name
Nealsoni00 Jun 13, 2024
5af1f17
[FIX] unimplemented test is 105 now
Nealsoni00 Jun 13, 2024
9471370
[ADD] runtime guard `envoy.reloadable_features.proxy_104` for 104 res…
Nealsoni00 Jun 17, 2024
c9bd729
[HF] failing to build
Nealsoni00 Jun 18, 2024
f452999
[HF] `;`
Nealsoni00 Jun 18, 2024
1969887
Merge remote-tracking branch 'upstream/main' into 104-upload-resumpti…
Nealsoni00 Jun 18, 2024
6dcaa6c
[ADD] envoy in current.yaml version change
Nealsoni00 Jun 18, 2024
950aedd
[HF] no trailing spaces
Nealsoni00 Jun 18, 2024
6244dfc
[ADD] runtime guard to `runtime_features.cc`
Nealsoni00 Jun 19, 2024
338b311
[HF] wrong feature categorization
Nealsoni00 Jun 19, 2024
c2e8fc4
[FIX] alphabetical ordering
Nealsoni00 Jun 19, 2024
a2f271e
[FIX] add `` around runtime guard to be picked up by CI
Nealsoni00 Jun 20, 2024
b86a01a
[HF] ensure 104 informational responses
Nealsoni00 Jun 28, 2024
6b84e7e
Merge remote-tracking branch 'upstream/main' into 104-upload-resumpti…
Nealsoni00 Jun 28, 2024
588d144
Merge branch 'main' into 104-upload-resumption-supported
Nealsoni00 Jul 2, 2024
b90bbb3
Merge remote-tracking branch 'upstream/main' into 104-upload-resumpti…
Nealsoni00 Jul 2, 2024
307070b
Merge remote-tracking branch 'upstream/main' into 104-upload-resumpti…
Nealsoni00 Jul 3, 2024
ada8151
[HF] lint
Nealsoni00 Jul 3, 2024
12344f2
[HF] lint again
Nealsoni00 Jul 3, 2024
a3aa025
[HF] add spelling
Nealsoni00 Jul 4, 2024
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
6 changes: 6 additions & 0 deletions changelogs/current.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,12 @@ minor_behavior_changes:
change: |
Changing HTTP/2 semi-colon prefixed headers to being sanitized by Envoy code rather than nghttp2. Should be a functional no-op but
guarded by ``envoy.reloadable_features.sanitize_http2_headers_without_nghttp2``.
- area: http
change: |
http: envoy will now proxy 104 headers from upstream, though as with 100s only the first 1xx response
headers will be sent.104 headers are designated by ietf's draft-ietf-httpbis-resumable-upload rfc.
This behavioral can be temporarily reverted by setting runtime guard
``envoy.reloadable_features.proxy_104`` to ``false``.
- area: jwt_authn
change: |
Changes the behavior of the
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -604,6 +604,7 @@ Http::Http1::CallbackResult Http1ClientCodec::onMessageCompleteImpl() {
// 101 Switching Protocols response. Ignore it because we don't support upgrade for now.
// 102 Processing response. Ignore it.
// 103 Early Hints response. Ignore it.
// 104 Upload Resumption Supported response. Ignore it.

// Return success to continue parsing the actual response.
return Http::Http1::CallbackResult::Success;
Expand Down
6 changes: 4 additions & 2 deletions envoy/http/codec.h
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,8 @@ class ResponseEncoder : public virtual StreamEncoder {
public:
/**
* Encode supported 1xx headers.
* Currently 100-Continue, 102-Processing, and 103-Early-Data headers are supported.
* Currently 100-Continue, 102-Processing, 103-Early-Data, and 104-Upload-Resumption-Supported
* headers are supported.
* @param headers supplies the 1xx header map to encode.
*/
virtual void encode1xxHeaders(const ResponseHeaderMap& headers) PURE;
Expand Down Expand Up @@ -270,7 +271,8 @@ class ResponseDecoder : public virtual StreamDecoder {
public:
/**
* Called with decoded 1xx headers.
* Currently 100-Continue, 102-Processing, and 103-Early-Data headers are supported.
* Currently 100-Continue, 102-Processing, 103-Early-Data, and 104-Upload-Resumption-Supported
* headers are supported.
* @param headers supplies the decoded 1xx headers map.
*/
virtual void decode1xxHeaders(ResponseHeaderMapPtr&& headers) PURE;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ private static Map<Integer, String> buildReasonMap() {
map.put(101, "Switching Protocols");
map.put(102, "Processing");
map.put(103, "Early Hints");
map.put(104, "Upload Resumption Supported");
map.put(200, "OK");
map.put(201, "Created");
map.put(202, "Accepted");
Expand Down
4 changes: 4 additions & 0 deletions source/common/http/header_utility.cc
Original file line number Diff line number Diff line change
Expand Up @@ -242,6 +242,10 @@ bool HeaderUtility::authorityIsValid(const absl::string_view header_value) {
}

bool HeaderUtility::isSpecial1xx(const ResponseHeaderMap& response_headers) {
if (Runtime::runtimeFeatureEnabled("envoy.reloadable_features.proxy_104") &&
response_headers.Status()->value() == "104") {
return true;
}
return response_headers.Status()->value() == "100" ||
response_headers.Status()->value() == "102" || response_headers.Status()->value() == "103";
}
Expand Down
1 change: 1 addition & 0 deletions source/common/runtime/runtime_features.cc
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ RUNTIME_GUARD(envoy_reloadable_features_no_extension_lookup_by_name);
RUNTIME_GUARD(envoy_reloadable_features_normalize_host_for_preresolve_dfp_dns);
RUNTIME_GUARD(envoy_reloadable_features_oauth_use_url_encoding);
RUNTIME_GUARD(envoy_reloadable_features_original_dst_rely_on_idle_timeout);
RUNTIME_GUARD(envoy_reloadable_features_proxy_104);
RUNTIME_GUARD(envoy_reloadable_features_proxy_status_mapping_more_core_response_flags);
RUNTIME_GUARD(envoy_reloadable_features_quic_fix_filter_manager_uaf);
RUNTIME_GUARD(envoy_reloadable_features_quic_receive_ecn);
Expand Down
34 changes: 34 additions & 0 deletions test/common/http/http1/codec_impl_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -2914,6 +2914,40 @@ TEST_P(Http1ClientConnectionImplTest, EarlyHintHeaders) {
EXPECT_TRUE(status.ok());
}

// 104 response followed by 200 results in a [decode1xxHeaders, decodeHeaders] sequence.
TEST_P(Http1ClientConnectionImplTest, UploadResumptionSupportedHeaders) {
initialize();

NiceMock<MockResponseDecoder> response_decoder;
Http::RequestEncoder& request_encoder = codec_->newStream(response_decoder);
TestRequestHeaderMapImpl headers{{":method", "GET"}, {":path", "/"}, {":authority", "host"}};
EXPECT_TRUE(request_encoder.encodeHeaders(headers, true).ok());

// As per Resumable Uploads for HTTP draft, the upload-draft-interop-version header
// must be passed through with 104 responses.
EXPECT_CALL(response_decoder, decode1xxHeaders_(_))
.WillOnce(Invoke([&](ResponseHeaderMapPtr& headers) {
EXPECT_EQ(headers->get(Http::LowerCaseString("upload-draft-interop-version")).size(), 1);
EXPECT_EQ(headers->get(Http::LowerCaseString("upload-draft-interop-version"))[0]
->value()
.getStringView(),
"4");
}));
EXPECT_CALL(response_decoder, decodeData(_, _)).Times(0);

Buffer::OwnedImpl initial_response(
"HTTP/1.1 104 Upload Resumption Supported\r\nUpload-Draft-Interop-Version: 4\r\n\r\n");
auto status = codec_->dispatch(initial_response);
EXPECT_TRUE(status.ok());

EXPECT_CALL(response_decoder, decodeHeaders_(_, false));
EXPECT_CALL(response_decoder, decodeData(_, _)).Times(0);

Buffer::OwnedImpl response("HTTP/1.1 200 OK\r\n\r\n");
status = codec_->dispatch(response);
EXPECT_TRUE(status.ok());
}

// Multiple 100 responses are passed to the response encoder (who is responsible for coalescing).
TEST_P(Http1ClientConnectionImplTest, MultipleContinueHeaders) {
initialize();
Expand Down
4 changes: 2 additions & 2 deletions test/common/http/http2/codec_impl_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -766,7 +766,7 @@ TEST_P(Http2CodecImplTest, MultipleContinueHeaders) {
driveToCompletion();
};

// 104 headers etc. are passed to the response encoder (who is responsibly for deciding to
// 105 headers etc. are passed to the response encoder (who is responsibly for deciding to
// upgrade, ignore, etc.).
TEST_P(Http2CodecImplTest, Unsupported1xxHeader) {
initialize();
Expand All @@ -777,7 +777,7 @@ TEST_P(Http2CodecImplTest, Unsupported1xxHeader) {
EXPECT_TRUE(request_encoder_->encodeHeaders(request_headers, true).ok());
driveToCompletion();

TestResponseHeaderMapImpl other_headers{{":status", "104"}};
TestResponseHeaderMapImpl other_headers{{":status", "105"}};
EXPECT_CALL(response_decoder_, decodeHeaders_(_, false));
response_encoder_->encodeHeaders(other_headers, false);
driveToCompletion();
Expand Down
4 changes: 4 additions & 0 deletions test/integration/protocol_integration_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1553,6 +1553,10 @@ TEST_P(ProtocolIntegrationTest, EnvoyProxying103) {
testEnvoyProxying1xx(false, false, false, "103");
}

TEST_P(ProtocolIntegrationTest, EnvoyProxying104) {
testEnvoyProxying1xx(false, false, false, "104");
}

TEST_P(ProtocolIntegrationTest, TwoRequests) { testTwoRequests(); }

TEST_P(ProtocolIntegrationTest, TwoRequestsWithForcedBackup) { testTwoRequests(true); }
Expand Down
2 changes: 2 additions & 0 deletions tools/spelling/spelling_dictionary.txt
Original file line number Diff line number Diff line change
Expand Up @@ -876,6 +876,7 @@ inotify
inserter
instantiation
instantiations
interop
interpretable
intra
ints
Expand Down Expand Up @@ -1208,6 +1209,7 @@ resolv
resolvers
responder
restarter
resumable
resync
ret
retransmissions
Expand Down