From 296f09aa3817abc1ddff7703799bf9babb7bbd16 Mon Sep 17 00:00:00 2001 From: Michael Fraenkel Date: Fri, 20 Jan 2023 15:28:00 -0700 Subject: [PATCH] http2: case insensitive handling for 100-continue 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 Run-TryBot: Damien Neil Reviewed-by: Damien Neil Reviewed-by: Matthew Dempsky TryBot-Result: Gopher Robot --- http2/server.go | 2 +- http2/server_test.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/http2/server.go b/http2/server.go index b624dc0a70..9bd7035bfe 100644 --- a/http2/server.go +++ b/http2/server.go @@ -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") } diff --git a/http2/server_test.go b/http2/server_test.go index 178c28b058..fd62dcb931 100644 --- a/http2/server_test.go +++ b/http2/server_test.go @@ -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, })