Repository navigation
http: tighten handling of non-{100,101} 1xx and multiple 100 headers. - #12037
Conversation
This revisits envoyproxy#11448 in light of envoyproxy#11433 (comment). There's still some outstanding questions in envoyproxy#11433 to resolve. Risk level: Medium Testing: Will write more unit/integration tests once we the approach is settled. Signed-off-by: Harvey Tuch <[email protected]>
838157a to
a25d927
Compare
|
@alyssawilk @mattklein123 this is now ready for review. Do you think we should runtime guard? |
| enum class StreamState { PendingHeaders, PendingDataOrTrailers, Closed }; | ||
| enum class StreamState { | ||
| PendingHeaders, | ||
| PendingNonInformationalHeaders, |
Signed-off-by: Harvey Tuch <[email protected]>
mattklein123
left a comment
There was a problem hiding this comment.
At a high level this LGTM but I would prefer that @alyssawilk reviews on Monday. Also needs a master merge.
/wait
alyssawilk
left a comment
There was a problem hiding this comment.
Thanks again for tackling this! Some thoughts below.
| // We can continue to receive 1xx, we forward to HCM and allow it to coalesce. | ||
| stream->decodeHeaders(true); | ||
| } else { | ||
| ASSERT(stream->remote_end_stream_); |
There was a problem hiding this comment.
So if a non-nghttp2 codec sends
100
200 (with body)
100
will nghttp2 force end stream or will this assert fail? Unit test maybe?
There was a problem hiding this comment.
Looking at nghttp2 source code, it appears that nghttp2 rejects pseudo-headers including :status in trailers, see https://github.com/nghttp2/nghttp2/blob/bb519154fe62f7ff7e5eb7269e05043dec6d3682/lib/nghttp2_http.c#L117.
Looks like we can do an encode sequence like this, so I can add a simple unit test to show.
Signed-off-by: Harvey Tuch <[email protected]>
|
@alyssawilk updated, PTAL. |
alyssawilk
left a comment
There was a problem hiding this comment.
Looking better and better!
Signed-off-by: Harvey Tuch <[email protected]>
alyssawilk
left a comment
There was a problem hiding this comment.
Thanks for all the iterations - I think the last change especially made this much easier to read!
|
TSAN failure is |
envoyproxy#12037) This PR provides intentional semantics for: Multiple-100 headers; these are always coalesced to a single 100 header when proxying. 101 headers: these are always passed to decodeHeaders(). Non-{100,101} 1xx headers, e.g. 102/103, are always ignored by Envoy. UpstreamRequest is responsible for guaranteeing that HCM observes the above properties. Codecs should pass 100 headers to decode100ContinueHeaders and all other 1xx to decodeHeaders. This PR follows the discussion in envoyproxy#11433 (comment). Risk level: Medium Testing: Unit tests for codecs and UpstreamRequest added. Integration tests for non-101 and multiple 101 headers added. Fixes OSS-fuzz issue https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=21628. Fixes envoyproxy#11433 Signed-off-by: Harvey Tuch <[email protected]> Signed-off-by: Kevin Baichoo <[email protected]>
envoyproxy#12037) This PR provides intentional semantics for: Multiple-100 headers; these are always coalesced to a single 100 header when proxying. 101 headers: these are always passed to decodeHeaders(). Non-{100,101} 1xx headers, e.g. 102/103, are always ignored by Envoy. UpstreamRequest is responsible for guaranteeing that HCM observes the above properties. Codecs should pass 100 headers to decode100ContinueHeaders and all other 1xx to decodeHeaders. This PR follows the discussion in envoyproxy#11433 (comment). Risk level: Medium Testing: Unit tests for codecs and UpstreamRequest added. Integration tests for non-101 and multiple 101 headers added. Fixes OSS-fuzz issue https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=21628. Fixes envoyproxy#11433 Signed-off-by: Harvey Tuch <[email protected]> Signed-off-by: chaoqinli <[email protected]>
This PR provides intentional semantics for:
UpstreamRequest is responsible for guaranteeing that HCM observes the above properties. Codecs should pass 100 headers to decode100ContinueHeaders and all other 1xx to decodeHeaders.
This PR follows the discussion in #11433 (comment).
Risk level: Medium
Testing: Unit tests for codecs and UpstreamRequest added. Integration tests for non-101 and multiple 101 headers added.
Fixes OSS-fuzz issue https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=21628.
Fixes #11433
Signed-off-by: Harvey Tuch [email protected]