vendor: golang.org/x/net v0.57.0

Relevant changes (in vendor):

- bpf: add security considerations to package docs
- http2: initialize Transport on NewClientConn
  fixes: x/net/http2: zero Transport not ready for use
- idna: reject all-ASCII xn-- labels on all Go versions
  fixes x/net/idna: ToUnicode accepts Punycode labels encoding pure ASCII labels

full diff: https://github.com/golang/net/compare/v0.56.0...v0.57.0

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
This commit is contained in:
Sebastiaan van Stijn
2026-07-27 21:28:05 +02:00
parent e03b83ef06
commit 487686142c
5 changed files with 22 additions and 16 deletions
+1 -1
View File
@@ -104,7 +104,7 @@ require (
go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.44.0 // indirect go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.44.0 // indirect
go.opentelemetry.io/proto/otlp v1.10.0 // indirect go.opentelemetry.io/proto/otlp v1.10.0 // indirect
golang.org/x/mod v0.38.0 // indirect golang.org/x/mod v0.38.0 // indirect
golang.org/x/net v0.56.0 // indirect golang.org/x/net v0.57.0 // indirect
golang.org/x/time v0.15.0 // indirect golang.org/x/time v0.15.0 // indirect
google.golang.org/genproto/googleapis/api v0.0.0-20260526163538-3dc84a4a5aaa // indirect google.golang.org/genproto/googleapis/api v0.0.0-20260526163538-3dc84a4a5aaa // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20260526163538-3dc84a4a5aaa // indirect google.golang.org/genproto/googleapis/rpc v0.0.0-20260526163538-3dc84a4a5aaa // indirect
+2 -2
View File
@@ -241,8 +241,8 @@ golang.org/x/net v0.0.0-20190613194153-d28f0bde5980/go.mod h1:z5CRVTTTmAJ677TzLL
golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
golang.org/x/net v0.0.0-20200226121028-0de0cce0169b/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20200226121028-0de0cce0169b/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU=
golang.org/x/net v0.56.0 h1:Rw8j/hFzGvJUZwNBXnAtf5sVDVt+65SK2C7IxCxZt5o= golang.org/x/net v0.57.0 h1:K5+3DljvIuDG9/Jv9rvyMywYNFCQ9RSUY6OOTTkT+tE=
golang.org/x/net v0.56.0/go.mod h1:D3Ku6r+V6JROoZK144D2XfMHFcMq/0zSfLelVTCFKec= golang.org/x/net v0.57.0/go.mod h1:KpXc8iv+r3XplLAG/f7Jsf9RPszJzdR0f58q9vGOuEU=
golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
+13 -11
View File
@@ -55,7 +55,7 @@ type transportConfig struct {
// Registered is called by net/http.Transport.RegisterProtocol, // Registered is called by net/http.Transport.RegisterProtocol,
// to let us know that it understands the registration mechanism we're using. // to let us know that it understands the registration mechanism we're using.
func (t transportConfig) Registered(t1 *http.Transport) { func (t transportConfig) Registered(t1 *http.Transport) {
t.t.t1 = t1 t.t.lazyt1 = t1
} }
func (t transportConfig) DisableCompression() bool { func (t transportConfig) DisableCompression() bool {
@@ -145,29 +145,30 @@ func (t transportConfig) DialFromContext(ctx context.Context, network, address s
type transportInternal struct { type transportInternal struct {
initOnce sync.Once initOnce sync.Once
t1 *http.Transport lazyt1 *http.Transport
} }
func (t *Transport) init() { func (t *Transport) init() *http.Transport {
t.initOnce.Do(func() { t.initOnce.Do(func() {
if t.t1 != nil { if t.lazyt1 != nil {
return return
} }
t1 := &http.Transport{} t1 := &http.Transport{}
t.configure(t1) t.configure(t1)
}) })
return t.lazyt1
} }
func (t *Transport) configure(t1 *http.Transport) { func (t *Transport) configure(t1 *http.Transport) {
t1.RegisterProtocol("http/2", transportConfig{t}) t1.RegisterProtocol("http/2", transportConfig{t})
// tr2.t1 is set by transportConfig.Registered. // tr2.lazyt1 is set by transportConfig.Registered.
if t.t1 != t1 { if t.lazyt1 != t1 {
panic("http2: net/http does not support this version of x/net/http2") panic("http2: net/http does not support this version of x/net/http2")
} }
} }
func (t *Transport) roundTripOpt(req *http.Request, opt RoundTripOpt) (*http.Response, error) { func (t *Transport) roundTripOpt(req *http.Request, opt RoundTripOpt) (*http.Response, error) {
t.init() t1 := t.init()
if req.URL.Scheme == "http" && !t.AllowHTTP { if req.URL.Scheme == "http" && !t.AllowHTTP {
return nil, errors.New("http2: unencrypted HTTP/2 not enabled") return nil, errors.New("http2: unencrypted HTTP/2 not enabled")
@@ -188,22 +189,23 @@ func (t *Transport) roundTripOpt(req *http.Request, opt RoundTripOpt) (*http.Res
ctx := context.WithValue(req.Context(), http2TransportContextKey{}, t) ctx := context.WithValue(req.Context(), http2TransportContextKey{}, t)
req = req.WithContext(ctx) req = req.WithContext(ctx)
return t.t1.RoundTrip(req) return t1.RoundTrip(req)
} }
func (t *Transport) closeIdleConnections() { func (t *Transport) closeIdleConnections() {
t.init() t1 := t.init()
t.t1.CloseIdleConnections() t1.CloseIdleConnections()
} }
func (t *Transport) newUserClientConn(c net.Conn) (*ClientConn, error) { func (t *Transport) newUserClientConn(c net.Conn) (*ClientConn, error) {
t1 := t.init()
// http.Transport's NewClientConn doesn't provide a supported way to create // http.Transport's NewClientConn doesn't provide a supported way to create
// a connection from a net.Conn. (This might be useful to add in the future?) // a connection from a net.Conn. (This might be useful to add in the future?)
// We're going to craftily sneak one in via the context key, with the // We're going to craftily sneak one in via the context key, with the
// scheme of "http/2" telling NewClientConn to look for it. // scheme of "http/2" telling NewClientConn to look for it.
ctx := context.WithValue(context.Background(), netConnContextKey{}, c) ctx := context.WithValue(context.Background(), netConnContextKey{}, c)
nhcc, err := t.t1.NewClientConn(ctx, "http/2", "") nhcc, err := t1.NewClientConn(ctx, "http/2", "")
if err != nil { if err != nil {
return nil, err return nil, err
} }
+5 -1
View File
@@ -400,7 +400,11 @@ func (p *Profile) process(s string, toASCII bool) (string, error) {
// Spec says keep the old label. // Spec says keep the old label.
continue continue
} }
if unicode16 && err == nil && len(u) > 0 && isASCII(u) { if err == nil && len(u) > 0 && isASCII(u) {
// UTS 43 pre-revision 33 doesn't classify a xn-- label
// which contains only ASCII characters as an error,
// but that's a specification bug and a security issue.
// Always return an error in this case.
err = punyError(enc) err = punyError(enc)
} }
isBidi = isBidi || bidirule.DirectionString(u) != bidi.LeftToRight isBidi = isBidi || bidirule.DirectionString(u) != bidi.LeftToRight
+1 -1
View File
@@ -398,7 +398,7 @@ golang.org/x/mod/internal/lazyregexp
golang.org/x/mod/modfile golang.org/x/mod/modfile
golang.org/x/mod/module golang.org/x/mod/module
golang.org/x/mod/semver golang.org/x/mod/semver
# golang.org/x/net v0.56.0 # golang.org/x/net v0.57.0
## explicit; go 1.25.0 ## explicit; go 1.25.0
golang.org/x/net/http/httpguts golang.org/x/net/http/httpguts
golang.org/x/net/http2 golang.org/x/net/http2