Skip to content

Commit

Permalink
http2: case insensitive handling for 100-continue
Browse files Browse the repository at this point in the history
rfc 9110, section 10.1.1 states that the Expect field value is
case-insensitive.

Fixes golang/go#57824

Change-Id: Ie0e2662c58a2933087e0d35935c04ec61026a41d
Reviewed-on: https://go-review.googlesource.com/c/net/+/463096
Auto-Submit: Damien Neil <[email protected]>
Run-TryBot: Damien Neil <[email protected]>
Reviewed-by: Damien Neil <[email protected]>
Reviewed-by: Matthew Dempsky <[email protected]>
TryBot-Result: Gopher Robot <[email protected]>
  • Loading branch information
fraenkel authored and gopherbot committed Jan 26, 2023
1 parent f8411da commit 296f09a
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion http2/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -2192,7 +2192,7 @@ func (sc *serverConn) newWriterAndRequestNoBody(st *stream, rp requestParam) (*r
tlsState = sc.tlsState
}

needsContinue := rp.header.Get("Expect") == "100-continue"
needsContinue := httpguts.HeaderValuesContainsToken(rp.header["Expect"], "100-continue")
if needsContinue {
rp.header.Del("Expect")
}
Expand Down
2 changes: 1 addition & 1 deletion http2/server_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2332,7 +2332,7 @@ func TestServer_Response_Automatic100Continue(t *testing.T) {
}, func(st *serverTester) {
st.writeHeaders(HeadersFrameParam{
StreamID: 1, // clients send odd numbers
BlockFragment: st.encodeHeader(":method", "POST", "expect", "100-continue"),
BlockFragment: st.encodeHeader(":method", "POST", "expect", "100-Continue"),
EndStream: false,
EndHeaders: true,
})
Expand Down

0 comments on commit 296f09a

Please sign in to comment.