From d81dd1290665aea2de8d4d5284be26ea0bfe4cd2 Mon Sep 17 00:00:00 2001 From: Dmitri Shuralyov Date: Mon, 16 May 2022 17:53:36 -0400 Subject: all: update vendored golang.org/x dependencies for Go 1.19 release The Go 1.19 code freeze has recently started. This is a time to update all golang.org/x/... module versions that contribute packages to the std and cmd modules in the standard library to latest master versions. This CL updates the rest of the modules with x/build/cmd/updatestd. For #36905. Change-Id: I4751ca477365b036a8e5ad6a9256293b44ddcd2f Reviewed-on: https://go-review.googlesource.com/c/go/+/406356 Reviewed-by: Dmitri Shuralyov Run-TryBot: Dmitri Shuralyov TryBot-Result: Gopher Robot Reviewed-by: Matthew Dempsky Auto-Submit: Dmitri Shuralyov --- src/net/http/h2_bundle.go | 35 +++++++++++++++++++++++++++-------- 1 file changed, 27 insertions(+), 8 deletions(-) (limited to 'src/net/http') diff --git a/src/net/http/h2_bundle.go b/src/net/http/h2_bundle.go index 0b6001539e..dfb1adbf30 100644 --- a/src/net/http/h2_bundle.go +++ b/src/net/http/h2_bundle.go @@ -6369,8 +6369,7 @@ func http2checkWriteHeaderCode(code int) { // Issue 22880: require valid WriteHeader status codes. // For now we only enforce that it's three digits. // In the future we might block things over 599 (600 and above aren't defined - // at http://httpwg.org/specs/rfc7231.html#status.codes) - // and we might block under 200 (once we have more mature 1xx support). + // at http://httpwg.org/specs/rfc7231.html#status.codes). // But for now any three digits. // // We used to send "HTTP/1.1 000 0" on the wire in responses but there's @@ -6391,13 +6390,33 @@ func (w *http2responseWriter) WriteHeader(code int) { } func (rws *http2responseWriterState) writeHeader(code int) { - if !rws.wroteHeader { - http2checkWriteHeaderCode(code) - rws.wroteHeader = true - rws.status = code - if len(rws.handlerHeader) > 0 { - rws.snapHeader = http2cloneHeader(rws.handlerHeader) + if rws.wroteHeader { + return + } + + http2checkWriteHeaderCode(code) + + // Handle informational headers + if code >= 100 && code <= 199 { + // Per RFC 8297 we must not clear the current header map + h := rws.handlerHeader + + if rws.conn.writeHeaders(rws.stream, &http2writeResHeaders{ + streamID: rws.stream.id, + httpResCode: code, + h: h, + endStream: rws.handlerDone && !rws.hasTrailers(), + }) != nil { + rws.dirty = true } + + return + } + + rws.wroteHeader = true + rws.status = code + if len(rws.handlerHeader) > 0 { + rws.snapHeader = http2cloneHeader(rws.handlerHeader) } } -- cgit v1.3-5-g9baa