From 8c4bec8fb7fb4f2ad1eb7ed027fac466244b0f4d Mon Sep 17 00:00:00 2001 From: Brad Fitzpatrick Date: Tue, 13 Jun 2017 17:08:02 +0000 Subject: [PATCH] net/http: update bundled http2 Update x/net/http2 to git rev 6b17b9baf5 for: http2: stop rejecting outgoing paths beginning with two slashes https://golang.org/cl/45773 This also uses an updated version of x/tools/cmd/bundle (CL 45190) that fixes an edge case where it used to drop some comments. Updates #20627 Fixes #19103 Change-Id: I450d61485e66098f4f8a79954f729f7bcd85856f Reviewed-on: https://go-review.googlesource.com/45700 Run-TryBot: Brad Fitzpatrick Reviewed-by: Chris Broadfoot --- src/net/http/h2_bundle.go | 26 +++++++++++++++++++------- 1 file changed, 19 insertions(+), 7 deletions(-) diff --git a/src/net/http/h2_bundle.go b/src/net/http/h2_bundle.go index 12a25afb05..671e0f719e 100644 --- a/src/net/http/h2_bundle.go +++ b/src/net/http/h2_bundle.go @@ -48,6 +48,9 @@ import ( "golang_org/x/net/lex/httplex" ) +// A list of the possible cipher suite ids. Taken from +// http://www.iana.org/assignments/tls-parameters/tls-parameters.txt + const ( http2cipher_TLS_NULL_WITH_NULL_NULL uint16 = 0x0000 http2cipher_TLS_RSA_WITH_NULL_MD5 uint16 = 0x0001 @@ -1206,11 +1209,16 @@ type http2goAwayFlowError struct{} func (http2goAwayFlowError) Error() string { return "connection exceeded flow control window size" } +// connError represents an HTTP/2 ConnectionError error code, along +// with a string (for debugging) explaining why. +// // Errors of this type are only returned by the frame parser functions -// and converted into ConnectionError(ErrCodeProtocol). +// and converted into ConnectionError(Code), after stashing away +// the Reason into the Framer's errDetail field, accessible via +// the (*Framer).ErrorDetail method. type http2connError struct { - Code http2ErrCode - Reason string + Code http2ErrCode // the ConnectionError error code + Reason string // additional reason } func (e http2connError) Error() string { @@ -3562,14 +3570,18 @@ func (s *http2sorter) SortStrings(ss []string) { // validPseudoPath reports whether v is a valid :path pseudo-header // value. It must be either: // -// *) a non-empty string starting with '/', but not with with "//", +// *) a non-empty string starting with '/' // *) the string '*', for OPTIONS requests. // // For now this is only used a quick check for deciding when to clean // up Opaque URLs before sending requests from the Transport. // See golang.org/issue/16847 +// +// We used to enforce that the path also didn't start with "//", but +// Google's GFE accepts such paths and Chrome sends them, so ignore +// that part of the spec. See golang.org/issue/19103. func http2validPseudoPath(v string) bool { - return (len(v) > 0 && v[0] == '/' && (len(v) == 1 || v[1] != '/')) || v == "*" + return (len(v) > 0 && v[0] == '/') || v == "*" } // pipe is a goroutine-safe io.Reader/io.Writer pair. It's like @@ -8694,7 +8706,7 @@ func (p *http2writeGoAway) writeFrame(ctx http2writeContext) error { return err } -func (*http2writeGoAway) staysWithinBuffer(max int) bool { return false } +func (*http2writeGoAway) staysWithinBuffer(max int) bool { return false } // flushes type http2writeData struct { streamID uint32 @@ -9205,7 +9217,7 @@ func (p *http2writeQueuePool) get() *http2writeQueue { } // RFC 7540, Section 5.3.5: the default weight is 16. -const http2priorityDefaultWeight = 15 +const http2priorityDefaultWeight = 15 // 16 = 15 + 1 // PriorityWriteSchedulerConfig configures a priorityWriteScheduler. type http2PriorityWriteSchedulerConfig struct {