]> Cypherpunks.ru repositories - gostls13.git/commitdiff
vendor, net/http: update golang.org/x/net to tip
authorJorropo <jorropo.pgm@gmail.com>
Sat, 30 Apr 2022 10:52:13 +0000 (10:52 +0000)
committerGopher Robot <gobot@golang.org>
Mon, 2 May 2022 04:45:15 +0000 (04:45 +0000)
Needed for CL 400236.

Change-Id: Ia0b4a5963724ed92be27f557ad141335b389e97f
GitHub-Last-Rev: b0e72cb26de251865ef865bf92a6b8ff9dbf7b04
GitHub-Pull-Request: golang/go#52621
Reviewed-on: https://go-review.googlesource.com/c/go/+/403136
Reviewed-by: Damien Neil <dneil@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Ian Lance Taylor <iant@google.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>

src/go.mod
src/go.sum
src/net/http/h2_bundle.go
src/vendor/golang.org/x/net/dns/dnsmessage/message.go
src/vendor/golang.org/x/net/http/httpguts/httplex.go
src/vendor/golang.org/x/net/http/httpproxy/proxy.go
src/vendor/golang.org/x/net/idna/trieval.go
src/vendor/modules.txt

index 8830dc09896d9ccab5c9d1d8d83e50d7817f0076..e154befe6ce55819417f3bba4ae8e406cadbd70c 100644 (file)
@@ -4,7 +4,7 @@ go 1.19
 
 require (
        golang.org/x/crypto v0.0.0-20220315160706-3147a52a75dd
-       golang.org/x/net v0.0.0-20220225172249-27dd8689420f
+       golang.org/x/net v0.0.0-20220421235706-1d1ef9303861
 )
 
 require (
index 70a22b98a3b6e3f9737f2fece1e944278ba3953d..a804d39d891c937c0c51c74d0c8427f01283ce59 100644 (file)
@@ -1,7 +1,7 @@
 golang.org/x/crypto v0.0.0-20220315160706-3147a52a75dd h1:XcWmESyNjXJMLahc3mqVQJcgSTDxFxhETVlfk9uGc38=
 golang.org/x/crypto v0.0.0-20220315160706-3147a52a75dd/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4=
-golang.org/x/net v0.0.0-20220225172249-27dd8689420f h1:oA4XRj0qtSt8Yo1Zms0CUlsT3KG69V2UGQWPBxujDmc=
-golang.org/x/net v0.0.0-20220225172249-27dd8689420f/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk=
+golang.org/x/net v0.0.0-20220421235706-1d1ef9303861 h1:yssD99+7tqHWO5Gwh81phT+67hg+KttniBr6UnEXOY8=
+golang.org/x/net v0.0.0-20220421235706-1d1ef9303861/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk=
 golang.org/x/sys v0.0.0-20220317061510-51cd9980dadf h1:Fm4IcnUL803i92qDlmB0obyHmosDrxZWxJL3gIeNqOw=
 golang.org/x/sys v0.0.0-20220317061510-51cd9980dadf/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
 golang.org/x/text v0.3.8-0.20220124021120-d1c84af989ab h1:eHo2TTVBaAPw9lDGK2Gb9GyPMXT6g7O63W6sx3ylbzU=
index 4a76e6afe8ce1a803b12c332b9cf295b5b188994..2f3eb9c5738732073d06573da229f804b1b5ec6b 100644 (file)
@@ -30,7 +30,6 @@ import (
        "errors"
        "fmt"
        "io"
-       "io/ioutil"
        "log"
        "math"
        mathrand "math/rand"
@@ -1294,7 +1293,7 @@ func (e http2headerFieldNameError) Error() string {
 type http2headerFieldValueError string
 
 func (e http2headerFieldValueError) Error() string {
-       return fmt.Sprintf("invalid header field value %q", string(e))
+       return fmt.Sprintf("invalid header field value for %q", string(e))
 }
 
 var (
@@ -2864,7 +2863,8 @@ func (fr *http2Framer) readMetaFrame(hf *http2HeadersFrame) (*http2MetaHeadersFr
                        fr.debugReadLoggerf("http2: decoded hpack field %+v", hf)
                }
                if !httpguts.ValidHeaderFieldValue(hf.Value) {
-                       invalid = http2headerFieldValueError(hf.Value)
+                       // Don't include the value in the error, because it may be sensitive.
+                       invalid = http2headerFieldValueError(hf.Name)
                }
                isPseudo := strings.HasPrefix(hf.Name, ":")
                if isPseudo {
@@ -3583,8 +3583,8 @@ 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 '/'
-//     *) the string '*', for OPTIONS requests.
+//   - 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.
@@ -4119,7 +4119,7 @@ func (s *http2Server) ServeConn(c net.Conn, opts *http2ServeConnOpts) {
        if s.NewWriteScheduler != nil {
                sc.writeSched = s.NewWriteScheduler()
        } else {
-               sc.writeSched = http2NewRandomWriteScheduler()
+               sc.writeSched = http2NewPriorityWriteScheduler(nil)
        }
 
        // These start at the RFC-specified defaults. If there is a higher
@@ -6040,17 +6040,18 @@ type http2requestBody struct {
        _             http2incomparable
        stream        *http2stream
        conn          *http2serverConn
-       closed        bool       // for use by Close only
+       closeOnce     sync.Once  // for use by Close only
        sawEOF        bool       // for use by Read only
        pipe          *http2pipe // non-nil if we have a HTTP entity message body
        needsContinue bool       // need to send a 100-continue
 }
 
 func (b *http2requestBody) Close() error {
-       if b.pipe != nil && !b.closed {
-               b.pipe.BreakWithError(http2errClosedBody)
-       }
-       b.closed = true
+       b.closeOnce.Do(func() {
+               if b.pipe != nil {
+                       b.pipe.BreakWithError(http2errClosedBody)
+               }
+       })
        return nil
 }
 
@@ -7221,12 +7222,14 @@ func (t *http2Transport) RoundTripOpt(req *Request, opt http2RoundTripOpt) (*Res
                        if req, err = http2shouldRetryRequest(req, err); err == nil {
                                // After the first retry, do exponential backoff with 10% jitter.
                                if retry == 0 {
+                                       t.vlogf("RoundTrip retrying after failure: %v", err)
                                        continue
                                }
                                backoff := float64(uint(1) << (uint(retry) - 1))
                                backoff += backoff * (0.1 * mathrand.Float64())
                                select {
                                case <-time.After(time.Second * time.Duration(backoff)):
+                                       t.vlogf("RoundTrip retrying after failure: %v", err)
                                        continue
                                case <-req.Context().Done():
                                        err = req.Context().Err()
@@ -7452,10 +7455,13 @@ func (cc *http2ClientConn) healthCheck() {
        // trigger the healthCheck again if there is no frame received.
        ctx, cancel := context.WithTimeout(context.Background(), pingTimeout)
        defer cancel()
+       cc.vlogf("http2: Transport sending health check")
        err := cc.Ping(ctx)
        if err != nil {
+               cc.vlogf("http2: Transport health check failure: %v", err)
                cc.closeForLostPing()
-               return
+       } else {
+               cc.vlogf("http2: Transport health check success")
        }
 }
 
@@ -8485,7 +8491,8 @@ func (cc *http2ClientConn) encodeHeaders(req *Request, addGzipHeader bool, trail
                }
                for _, v := range vv {
                        if !httpguts.ValidHeaderFieldValue(v) {
-                               return nil, fmt.Errorf("invalid HTTP header value %q for header %q", v, k)
+                               // Don't include the value in the error, because it may be sensitive.
+                               return nil, fmt.Errorf("invalid HTTP header value for header %q", k)
                        }
                }
        }
@@ -9618,7 +9625,13 @@ func (t *http2Transport) logf(format string, args ...interface{}) {
        log.Printf(format, args...)
 }
 
-var http2noBody io.ReadCloser = ioutil.NopCloser(bytes.NewReader(nil))
+var http2noBody io.ReadCloser = http2noBodyReader{}
+
+type http2noBodyReader struct{}
+
+func (http2noBodyReader) Close() error { return nil }
+
+func (http2noBodyReader) Read([]byte) (int, error) { return 0, io.EOF }
 
 type http2missingBody struct{}
 
@@ -9639,7 +9652,9 @@ type http2erringRoundTripper struct{ err error }
 
 func (rt http2erringRoundTripper) RoundTripErr() error { return rt.err }
 
-func (rt http2erringRoundTripper) RoundTrip(*Request) (*Response, error) { return nil, rt.err }
+func (rt http2erringRoundTripper) RoundTrip(*Request) (*Response, error) {
+       return nil, rt.err
+}
 
 // gzipReader wraps a response body so it can lazily
 // call gzip.NewReader on the first call to Read
index 8c24430c5ce05260c8af7601b38bb72e957c70ed..0cdf89f9ff6048d8ca72edc619a1ec305ae31ef8 100644 (file)
@@ -1173,6 +1173,7 @@ func (m *Message) GoString() string {
 // A Builder allows incrementally packing a DNS message.
 //
 // Example usage:
+//
 //     buf := make([]byte, 2, 514)
 //     b := NewBuilder(buf, Header{...})
 //     b.EnableCompression()
index c79aa73f28bb9a522de0d653b01637083c631e85..6e071e8524328e2f2455d42188d282c1903ef84d 100644 (file)
@@ -173,13 +173,15 @@ func tokenEqual(t1, t2 string) bool {
 
 // isLWS reports whether b is linear white space, according
 // to http://www.w3.org/Protocols/rfc2616/rfc2616-sec2.html#sec2.2
-//      LWS            = [CRLF] 1*( SP | HT )
+//
+//     LWS            = [CRLF] 1*( SP | HT )
 func isLWS(b byte) bool { return b == ' ' || b == '\t' }
 
 // isCTL reports whether b is a control byte, according
 // to http://www.w3.org/Protocols/rfc2616/rfc2616-sec2.html#sec2.2
-//      CTL            = <any US-ASCII control character
-//                       (octets 0 - 31) and DEL (127)>
+//
+//     CTL            = <any US-ASCII control character
+//                      (octets 0 - 31) and DEL (127)>
 func isCTL(b byte) bool {
        const del = 0x7f // a CTL
        return b < ' ' || b == del
@@ -189,12 +191,13 @@ func isCTL(b byte) bool {
 // HTTP/2 imposes the additional restriction that uppercase ASCII
 // letters are not allowed.
 //
-//  RFC 7230 says:
-//   header-field   = field-name ":" OWS field-value OWS
-//   field-name     = token
-//   token          = 1*tchar
-//   tchar = "!" / "#" / "$" / "%" / "&" / "'" / "*" / "+" / "-" / "." /
-//           "^" / "_" / "`" / "|" / "~" / DIGIT / ALPHA
+// RFC 7230 says:
+//
+//     header-field   = field-name ":" OWS field-value OWS
+//     field-name     = token
+//     token          = 1*tchar
+//     tchar = "!" / "#" / "$" / "%" / "&" / "'" / "*" / "+" / "-" / "." /
+//             "^" / "_" / "`" / "|" / "~" / DIGIT / ALPHA
 func ValidHeaderFieldName(v string) bool {
        if len(v) == 0 {
                return false
@@ -267,27 +270,28 @@ var validHostByte = [256]bool{
 // ValidHeaderFieldValue reports whether v is a valid "field-value" according to
 // http://www.w3.org/Protocols/rfc2616/rfc2616-sec4.html#sec4.2 :
 //
-//        message-header = field-name ":" [ field-value ]
-//        field-value    = *( field-content | LWS )
-//        field-content  = <the OCTETs making up the field-value
-//                         and consisting of either *TEXT or combinations
-//                         of token, separators, and quoted-string>
+//     message-header = field-name ":" [ field-value ]
+//     field-value    = *( field-content | LWS )
+//     field-content  = <the OCTETs making up the field-value
+//                      and consisting of either *TEXT or combinations
+//                      of token, separators, and quoted-string>
 //
 // http://www.w3.org/Protocols/rfc2616/rfc2616-sec2.html#sec2.2 :
 //
-//        TEXT           = <any OCTET except CTLs,
-//                          but including LWS>
-//        LWS            = [CRLF] 1*( SP | HT )
-//        CTL            = <any US-ASCII control character
-//                         (octets 0 - 31) and DEL (127)>
+//     TEXT           = <any OCTET except CTLs,
+//                       but including LWS>
+//     LWS            = [CRLF] 1*( SP | HT )
+//     CTL            = <any US-ASCII control character
+//                      (octets 0 - 31) and DEL (127)>
 //
 // RFC 7230 says:
-//  field-value    = *( field-content / obs-fold )
-//  obj-fold       =  N/A to http2, and deprecated
-//  field-content  = field-vchar [ 1*( SP / HTAB ) field-vchar ]
-//  field-vchar    = VCHAR / obs-text
-//  obs-text       = %x80-FF
-//  VCHAR          = "any visible [USASCII] character"
+//
+//     field-value    = *( field-content / obs-fold )
+//     obj-fold       =  N/A to http2, and deprecated
+//     field-content  = field-vchar [ 1*( SP / HTAB ) field-vchar ]
+//     field-vchar    = VCHAR / obs-text
+//     obs-text       = %x80-FF
+//     VCHAR          = "any visible [USASCII] character"
 //
 // http2 further says: "Similarly, HTTP/2 allows header field values
 // that are not valid. While most of the values that can be encoded
index d2c8c87eab918904907781c8cbcfe6aee639c066..16994ac1347b05c3587bbdaf0176e4023484c043 100644 (file)
@@ -267,6 +267,9 @@ func (c *config) init() {
                        matchHost = true
                        phost = "." + phost
                }
+               if v, err := idnaASCII(phost); err == nil {
+                       phost = v
+               }
                c.domainMatchers = append(c.domainMatchers, domainMatch{host: phost, port: pport, matchHost: matchHost})
        }
 }
index 7a8cf889b5bc74c441b54261cd12feb8b158de5f..9c070a44b377ad412ddb7644d19b225231256d83 100644 (file)
@@ -17,23 +17,23 @@ package idna
 //
 // The per-rune values have the following format:
 //
-//   if mapped {
-//     if inlinedXOR {
-//       15..13 inline XOR marker
-//       12..11 unused
-//       10..3  inline XOR mask
-//     } else {
-//       15..3  index into xor or mapping table
-//     }
-//   } else {
-//       15..14 unused
-//       13     mayNeedNorm
-//       12..11 attributes
-//       10..8  joining type
-//        7..3  category type
-//   }
-//      2  use xor pattern
-//   1..0  mapped category
+//     if mapped {
+//       if inlinedXOR {
+//         15..13 inline XOR marker
+//         12..11 unused
+//         10..3  inline XOR mask
+//       } else {
+//         15..3  index into xor or mapping table
+//       }
+//     } else {
+//         15..14 unused
+//         13     mayNeedNorm
+//         12..11 attributes
+//         10..8  joining type
+//          7..3  category type
+//     }
+//        2  use xor pattern
+//     1..0  mapped category
 //
 // See the definitions below for a more detailed description of the various
 // bits.
index f9ae2c6aa8dd48c00e91bd8ef0d0a325a2a9e063..3bc423205939d5035c1b188a16764c4b502c76b4 100644 (file)
@@ -9,7 +9,7 @@ golang.org/x/crypto/curve25519/internal/field
 golang.org/x/crypto/hkdf
 golang.org/x/crypto/internal/poly1305
 golang.org/x/crypto/internal/subtle
-# golang.org/x/net v0.0.0-20220225172249-27dd8689420f
+# golang.org/x/net v0.0.0-20220421235706-1d1ef9303861
 ## explicit; go 1.17
 golang.org/x/net/dns/dnsmessage
 golang.org/x/net/http/httpguts