aboutsummaryrefslogtreecommitdiff
path: root/src/net/http
diff options
context:
space:
mode:
authorDmitri Shuralyov <dmitshur@golang.org>2022-05-16 17:53:36 -0400
committerDmitri Shuralyov <dmitshur@golang.org>2022-05-16 22:26:23 +0000
commitd81dd1290665aea2de8d4d5284be26ea0bfe4cd2 (patch)
tree0a5efd16d8e1bd23f221d36a392fc5b6b351e058 /src/net/http
parent420a1fb223da8830ca8b30e503fd9bfa7d99be3b (diff)
downloadgo-d81dd1290665aea2de8d4d5284be26ea0bfe4cd2.tar.xz
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 <dmitshur@google.com> Run-TryBot: Dmitri Shuralyov <dmitshur@golang.org> TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: Matthew Dempsky <mdempsky@google.com> Auto-Submit: Dmitri Shuralyov <dmitshur@golang.org>
Diffstat (limited to 'src/net/http')
-rw-r--r--src/net/http/h2_bundle.go35
1 files changed, 27 insertions, 8 deletions
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)
}
}