aboutsummaryrefslogtreecommitdiff
path: root/src/net
AgeCommit message (Collapse)Author
18 hoursall: prealloc slice with possible minimum capabilitiesShulhan
19 hoursnet: cancel2 should not be shadowWeixie Cui
Fixes #78531 Change-Id: I7ccd84f9a3ced75c86b7540d84309e094717ffba GitHub-Last-Rev: 03a8ee1fd132a597e1a1e30add7cf7ba00ac114a GitHub-Pull-Request: golang/go#78532 Reviewed-on: https://go-review.googlesource.com/c/go/+/762780 Auto-Submit: Nicholas Husin <husin@google.com> Reviewed-by: Sean Liao <sean@liao.dev> Reviewed-by: Nicholas Husin <husin@google.com> Reviewed-by: Florian Lehner <lehner.florian86@gmail.com> Reviewed-by: David Chase <drchase@google.com> LUCI-TryBot-Result: golang-scoped@luci-project-accounts.iam.gserviceaccount.com <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Nicholas Husin <nsh@golang.org>
31 hoursnet/http: temporarily disable HTTP/3 testsNicholas S. Husin
Tests for HTTP/3 are unfortunately still flaky. The flakes seem to come mostly from two sources: 1. QUIC connections are not shutdown fast enough, causing them to be detected as goroutine leaks. 2. x/net/quic has a race condition where its output buffer are written to without locks (synchronously and intentionally, for optimization), but may be asynchronously written when the QUIC stream receives a STOP_SENDING frame. Therefore, skip http3Mode for now until the above flakes are fixed. For #70914 Fixes #78701 Change-Id: If0c857c0933b977fb10a4481124680726a6a6964 Reviewed-on: https://go-review.googlesource.com/c/go/+/766740 Reviewed-by: Nicholas Husin <husin@google.com> Auto-Submit: Nicholas Husin <husin@google.com> LUCI-TryBot-Result: golang-scoped@luci-project-accounts.iam.gserviceaccount.com <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Carlos Amedee <carlos@golang.org>
37 hoursnet/http: fix wrong context being used when shutting down HTTP/3 serverNicholas S. Husin
t.Context was accidentally used within a t.Cleanup. This is a mistake since t.Context will always have been cancelled by the time t.Cleanup runs. This is likely the reason for flakiness in some builders: our HTTP/3 finishes before QUIC connections can finish closing asynchronously, which are then detected as goroutine leaks. To account for this, also make the shutdown context timeout more generous. For #70914 Change-Id: I0e5f06a47ef25c5df535543fc1e602f16a6a6964 Reviewed-on: https://go-review.googlesource.com/c/go/+/766620 LUCI-TryBot-Result: golang-scoped@luci-project-accounts.iam.gserviceaccount.com <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Nicholas Husin <husin@google.com> Reviewed-by: Damien Neil <dneil@google.com>
43 hoursnet: dnsdata should be p not rWeixie Cui
Change-Id: I9091ea54b2f3d78827d380214147cd04b951c1cc GitHub-Last-Rev: 06dbeb9d24f7f53827de56a53b3ad4bce0d84453 GitHub-Pull-Request: golang/go#78606 Reviewed-on: https://go-review.googlesource.com/c/go/+/764362 Reviewed-by: Nicholas Husin <husin@google.com> Reviewed-by: Damien Neil <dneil@google.com> Auto-Submit: Nicholas Husin <nsh@golang.org> Reviewed-by: Nicholas Husin <nsh@golang.org> LUCI-TryBot-Result: golang-scoped@luci-project-accounts.iam.gserviceaccount.com <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
4 daysnet/http: run tests for HTTP/3 where it can already passNicholas S. Husin
By default, our test harnesses (run and runSynctest) now use http3Mode, in addition to http1Mode and http2Mode, when no []testMode were explicitly defined for a given test. Tests that cannot currently pass for HTTP/3 have been modified to use http3SkippedMode, which serves as a convenient alias for the old default of []testMode{http1Mode, http2Mode}. We changed the default mode and defined http3SkippedMode so we have a clear list of TODOs in terms of how much changes are still needed before our HTTP/3 implementation reaches basic feature parity with HTTP/1 and HTTP/2. For #70914 Change-Id: I719d5d66399a51f7c3d96180ebed9b606a6a6964 Reviewed-on: https://go-review.googlesource.com/c/go/+/765320 Reviewed-by: Damien Neil <dneil@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Nicholas Husin <husin@google.com>
4 daysnet/http: fix data race in TestClientRedirectUseResponseNicholas S. Husin
There is a data race between the assignment of ts, and the access of ts.URL in the server handler. The data race seems to be more common when running the test against our HTTP/3 implementation. Fix the issue by deriving ts.URL via the given Request in the server handler. For #70914 Change-Id: Ic1924bf2c814517bae6b2e999d5f7efa6a6a6964 Reviewed-on: https://go-review.googlesource.com/c/go/+/765443 LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Nicholas Husin <husin@google.com> Reviewed-by: Damien Neil <dneil@google.com>
5 daysnet: drop always nil (*netFD).netFD error return valueTobias Klauser
Drop the always-nil error to simplify callers. This was missed in CL 764620. Change-Id: I7a93640b5422d7441234e226aa8b541888b2ebea Reviewed-on: https://go-review.googlesource.com/c/go/+/765220 Auto-Submit: Tobias Klauser <tobias.klauser@gmail.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Nicholas Husin <husin@google.com> Reviewed-by: David Chase <drchase@google.com> Reviewed-by: Nicholas Husin <nsh@golang.org>
5 daysnet: should close the netfd not listen fdWeixie Cui
Change-Id: I58e4ca136df73cd79ae2bcc7794c867d2e53261b GitHub-Last-Rev: 5381773704ba35819e5c723525ee3428c939b582 GitHub-Pull-Request: golang/go#78607 Reviewed-on: https://go-review.googlesource.com/c/go/+/764363 Reviewed-by: Nicholas Husin <nsh@golang.org> Auto-Submit: Nicholas Husin <nsh@golang.org> Reviewed-by: Nicholas Husin <husin@google.com> Reviewed-by: Ian Lance Taylor <iant@golang.org> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: David Chase <drchase@google.com>
5 daysnet/http: add support for running HTTP tests against HTTP/3Nicholas S. Husin
Add support within clientserver_test.go to bring up a test HTTP/3 server and client when http3Mode testMode option is passed. To be able to reuse net/http/httptest, net/http/httptest.Server.StartTLS (and Start) have been modified so they can be called with a nil Listener. In such cases, both methods will behave identically as usual, but will not actually make its server serve or set its transport dialer, both of which requires having a listener. This should be a no-op for regular users of the package, whose entrypoint via functions such as NewServer will automatically set a local listener. Actually enabling HTTP/3 for our tests will be done in a separate CL. For #70914 Change-Id: Ibc5fc83287b6a04b46e668a54924761a92b620a4 Reviewed-on: https://go-review.googlesource.com/c/go/+/740122 Reviewed-by: Damien Neil <dneil@google.com> Reviewed-by: Nicholas Husin <husin@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
6 daysnet: remove always-nil newFD error return valueTobias Klauser
newFD never returns an error on any of the platforms that define it. Drop the always-nil error to simplify callers. Change-Id: I727e95a0dac51ef70497ea1295276a8a6dce7f08 Reviewed-on: https://go-review.googlesource.com/c/go/+/764620 LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Damien Neil <dneil@google.com> Auto-Submit: Tobias Klauser <tobias.klauser@gmail.com> Reviewed-by: David Chase <drchase@google.com>
6 daysnet/http/internal/http2: prevent alloc when writing status code for responsesNicholas S. Husin
Previously, writing responses with non-200 and non-404 status code requires an allocation. Now that CL 762040 prevents header names and values from escaping, we can modify writeFrame to not allocate status codes on the heap. Change-Id: I230bed1b83627c1fb389c0507106d8e16a6a6964 Reviewed-on: https://go-review.googlesource.com/c/go/+/762140 Reviewed-by: Nicholas Husin <husin@google.com> Reviewed-by: Damien Neil <dneil@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
7 daysnet: document LookupSRV cname return valueyongqijia
Document that the first return value of LookupSRV is the canonical name of the DNS target that was looked up, which may differ from the input name due to CNAME records. Fixes #49982 Change-Id: I574e0f5cdc381d3d9b11b5bd7a5acbea2c9e185d GitHub-Last-Rev: 9c756d48d55587f373c7cf273aa64c960a7a94a8 GitHub-Pull-Request: golang/go#77475 Reviewed-on: https://go-review.googlesource.com/c/go/+/742660 Reviewed-by: Nicholas Husin <husin@google.com> Reviewed-by: Nicholas Husin <nsh@golang.org> Reviewed-by: Damien Neil <dneil@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
9 daysnet/mail: fix quadratic complexity in consumeCommentmohammadmseet-hue
consumeComment builds the comment string by repeated string concatenation inside a loop. Each concatenation copies the entire string built so far, making the function O(n^2) in the depth of nested comments. Replace the concatenation with a strings.Builder, which amortizes allocation by doubling its internal buffer. This reduces consumeComment from O(n^2) to O(n). This is the same bug class as the consumeDomainLiteral fix in CVE-2025-61725. Benchmark results (benchstat, 8 runs): name old time/op new time/op delta ConsumeComment/depth10 2.481us 1.838us -25.92% ConsumeComment/depth100 86.58us 6.498us -92.50% ConsumeComment/depth1000 7.963ms 52.82us -99.34% ConsumeComment/depth10000 897.8ms 521.3us -99.94% The quadratic cost becomes visible at depth 100 and dominant by depth 1000. At depth 10000, the fix is roughly 1700x faster. Change-Id: I3c927f02646fcab7bab167cb82fd46d3327d6d34 GitHub-Last-Rev: 7742dad716ee371766543f88e82bd163bd9d7ac2 GitHub-Pull-Request: golang/go#78393 Reviewed-on: https://go-review.googlesource.com/c/go/+/759940 Reviewed-by: Sean Liao <sean@liao.dev> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Auto-Submit: Sean Liao <sean@liao.dev> Reviewed-by: David Chase <drchase@google.com> Reviewed-by: Junyang Shao <shaojunyang@google.com>
9 daysnet/http: fix shadow var frameWeixie Cui
Change-Id: Ib03f65992b065e169fa6ccd08664336bec559c1d GitHub-Last-Rev: bd597d4325c713c53a9f22cb93892d90f393c6ac GitHub-Pull-Request: golang/go#78527 Reviewed-on: https://go-review.googlesource.com/c/go/+/762700 Reviewed-by: Nicholas Husin <nsh@golang.org> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Auto-Submit: Damien Neil <dneil@google.com> Reviewed-by: Florian Lehner <lehner.florian86@gmail.com> Reviewed-by: Damien Neil <dneil@google.com> Reviewed-by: Nicholas Husin <husin@google.com>
2026-03-31net/http/internal/http2: prevent hanging Transport due to bad SETTINGS frameNicholas S. Husin
When processing SETTINGS frame, Transport currently only checks if the frame is valid for SETTINGS_ENABLE_CONNECT_PROTOCOL. As a result, a SETTINGS_MAX_FRAME_SIZE with the invalid value of 0 is erroneously accepted. This will then result in Transport being stuck in an infinite loop writing CONTINUATION frames. This CL fixes the issue by ensuring that SETTINGS frame are always validated, regardless of the SETTINGS parameter. Thanks to Marwan Atia (marwansamir688@gmail.com) for reporting this issue. Fixes #78476 Fixes CVE-2026-33814 Change-Id: I8b6219431e87454d34bca738fbcb59b66a6a6964 Reviewed-on: https://go-review.googlesource.com/c/go/+/761581 LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Damien Neil <dneil@google.com> Reviewed-by: Nicholas Husin <husin@google.com>
2026-03-31net/http: support passing Server Shutdown context to HTTP/3 implementationsNicholas S. Husin
Currently, when Server.Shutdown is called with a given context, an HTTP/3 server implementation does not have access to said context. This forces HTTP/3 server implementations to guess a reasonable fixed timeout when attempting to gracefully shutdown, which is not ideal. Therefore, add ShutdownContext method to http3ServerHandler to handle this. For #77440 Change-Id: Ib15b615f646fd08788981eb06f3a70606a6a6964 Reviewed-on: https://go-review.googlesource.com/c/go/+/761480 Reviewed-by: Nicholas Husin <husin@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Damien Neil <dneil@google.com>
2026-03-30net/http/internal/http2: don't reuse ClientRequest streamsDamien Neil
The ClientRequest type (unlike http.Request) is not reusable across RoundTrip attempts because it includes a single-use clientStream. (It's possible for RoundTrip to return while some goroutines are still accessing the clientStream.) Always clone the ClientRequest on retries. Fixes #78202 Fixes #78187 Change-Id: I4012bb4e017a9516278c873ec5a589086a6a6964 Reviewed-on: https://go-review.googlesource.com/c/go/+/761301 Reviewed-by: Nicholas Husin <husin@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Michael Pratt <mpratt@google.com> Auto-Submit: Damien Neil <dneil@google.com> Reviewed-by: Nicholas Husin <nsh@golang.org>
2026-03-25net/url: escape // at start of Path when OmitHost setDamien Neil
When a URL has OmitHost set and a Path starting with //, escape the first / in the path to avoid emitting a URL with the host set from the Path. For example for u := url.URL{Scheme: "file", OmitHost: true, Path: "//host/path"} u.String is now "file:%2F/host/path", not "file://host/path". Fixes #78328 Change-Id: I017af26724cc55f8b7e6f7c969f1495b6a6a6964 Reviewed-on: https://go-review.googlesource.com/c/go/+/758881 Auto-Submit: Damien Neil <dneil@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Alan Donovan <adonovan@google.com>
2026-03-24net/url: permit colons in the host subcomponent of non-http/https URLsDamien Neil
Too many systems seem to rely on net/url accepting invalid URLs with colons in the host subcomponent. Rather than adding exceptions for each (PostgreSQL, MongoDB, Redis, etc.), limit the strict validation to http/https only. For #78077 Change-Id: I1bff324395cce6d7abf816cc875c79676a6a6964 Reviewed-on: https://go-review.googlesource.com/c/go/+/758900 Reviewed-by: Roland Shoemaker <roland@golang.org> Auto-Submit: Damien Neil <dneil@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2026-03-24net/url: reattach package doc commentDamien Neil
Fixes #78326 Change-Id: I70a411c33820f6498bec5f4e4a4ec7666a6a6964 Reviewed-on: https://go-review.googlesource.com/c/go/+/758880 Auto-Submit: Nicholas Husin <nsh@golang.org> Reviewed-by: Nicholas Husin <husin@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Nicholas Husin <nsh@golang.org>
2026-03-24net/http/internal/http2: use fake net for TestTransportBlockingRequestWriteDamien Neil
This test has been intermittently flaky. Exact cause isn't clear, but switch it to use a fake network to eliminate local network flakiness as a cause. Fixes #78209 Fixes #78213 Fixes #78263 Change-Id: I481553107e8557fda0707069856bafcc6a6a6964 Reviewed-on: https://go-review.googlesource.com/c/go/+/758063 Reviewed-by: Nicholas Husin <husin@google.com> Auto-Submit: Damien Neil <dneil@google.com> Reviewed-by: Nicholas Husin <nsh@golang.org> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2026-03-24net/http: add a test for starting a server with no HTTP/2 and no TLS configDamien Neil
Test for the fix in CL 758560. Change-Id: I34edf9f14dc5d6a569f20aa3d55d9d136a6a6964 Reviewed-on: https://go-review.googlesource.com/c/go/+/758661 Auto-Submit: Damien Neil <dneil@google.com> Reviewed-by: Nicholas Husin <nsh@golang.org> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Nicholas Husin <husin@google.com>
2026-03-24net/http: fix panic in ServeTLS on nil TLSConfigchressie
Change-Id: I9bc588128ec36bb3725d15e52400b76a94e5cb3a Reviewed-on: https://go-review.googlesource.com/c/go/+/758560 LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Nicholas Husin <nsh@golang.org> Reviewed-by: Nicholas Husin <husin@google.com>
2026-03-23net/http/internal/http2: remove inaccessible write schedulersNicholas S. Husin
RFC 7540 and random write schedulers are not accessible from std, and are essentially dead code at this point. Change-Id: Ib1e9e6e9ae7962b451bc36c0dad3c503f56dc1c0 Reviewed-on: https://go-review.googlesource.com/c/go/+/757380 Reviewed-by: Damien Neil <dneil@google.com> Reviewed-by: Nicholas Husin <husin@google.com> Auto-Submit: Nicholas Husin <nsh@golang.org> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2026-03-23net/http: make ResponseWriter.ReadFrom respect declared Content-LengthNicholas S. Husin
Unlike ResponseWriter.Write, ResponseWriter.ReadFrom does not currently respect declared Content-Length header. As a result, it is possible for a server handler to inadvertently write more bytes for their response body than has been declared via Content-Length. These excess bytes are written to the wire, and could potentially be misinterpreted by a client as a separate response. That said, this is not a concern security-wise. This edge case can only be exercised by someone who has a relatively complete control of a server handler—by which point, worse things can be done with less effort. Regardless, this is still a bug. Therefore, make sure that ResponseWriter.ReadFrom respects declared Content-Length too for consistency. Fixes #78179 Change-Id: I469b064e43e49e467b907d23fc1ee879066569f0 Reviewed-on: https://go-review.googlesource.com/c/go/+/755701 Reviewed-by: Nicholas Husin <husin@google.com> Auto-Submit: Nicholas Husin <nsh@golang.org> Reviewed-by: Damien Neil <dneil@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2026-03-23net: avoid wrapping io.EOF in UnixConn read methodsBasavaraj PB
The io.Reader contract requires that Read methods return io.EOF directly instead of wrapping it in another error. Currently UnixConn.ReadFromUnix, ReadFrom, and ReadMsgUnix wrap io.EOF inside net.OpError, causing callers checking for io.EOF to fail. Fix by avoiding wrapping when err == io.EOF. Fixes #78137 Change-Id: Ibb4e67cfb4c727c668ad79d1fb9e205f9b7e1903 Reviewed-on: https://go-review.googlesource.com/c/go/+/754960 Reviewed-by: Dmitri Shuralyov <dmitshur@google.com> Reviewed-by: Carlos Amedee <carlos@golang.org> Reviewed-by: Nicholas Husin <nsh@golang.org> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Basavaraj P <basavarajbankolli76@gmail.com> Reviewed-by: Ian Lance Taylor <iant@golang.org> Auto-Submit: Nicholas Husin <nsh@golang.org>
2026-03-23net/http/internal/http2: modernize the packageqiulaidongfeng
This CL is mostly generated by running go fix. Manual edits have also been selectively done to modernize the package where doing so is straightforward; for example, using slices.Contains in lieu of strSliceContains. Change-Id: Ie2942481672c56c370e2df0f172cf3e480a12bc5 Reviewed-on: https://go-review.googlesource.com/c/go/+/757220 Reviewed-by: Nicholas Husin <husin@google.com> Reviewed-by: Nicholas Husin <nsh@golang.org> Reviewed-by: Dmitri Shuralyov <dmitshur@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2026-03-18net/url: allow commas in hostnames for mongodb urlsyueyoum
A valid MongoDB URL can contain commas to include multiple host:port pairs. The current parseHost function splits the port starting from the first colon (:), but for MongoDB URLs that contain multiple host:port pairs, it needs to split from the last colon (:). Fixes #78077 Change-Id: I9a11f9295d0bc940626d3c6e9db2704237019b51 GitHub-Last-Rev: 5ca22763248214b2ea3f22d56c82fc01df9f8dba GitHub-Pull-Request: golang/go#77933 Reviewed-on: https://go-review.googlesource.com/c/go/+/751360 Reviewed-by: Carlos Amedee <carlos@golang.org> Reviewed-by: Sean Liao <sean@liao.dev> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Auto-Submit: Sean Liao <sean@liao.dev> Reviewed-by: Damien Neil <dneil@google.com>
2026-03-16net/http/internal/http2: deflake TestServer_Rejects_Too_Many_StreamsDamien Neil
This test contains a race condition in the server handler: inHandler <- streamID <-leaveHandler We assume that all requests queue reading from leaveHandler in order, but it is possible for the second request (stream id 3) to arrive at leaveHandler before the first (stream id 1). We could fix the race with a judicious synctest.Wait, but rewrite the test to use serverHandlerCall to manipulate server handlers, which permits us to precisely pick which request to unblock. Fixes #78117 Change-Id: Icd393c81e019a0b5176976a6b50145a26a6a6964 Reviewed-on: https://go-review.googlesource.com/c/go/+/755320 Reviewed-by: Nicholas Husin <nsh@golang.org> Reviewed-by: Nicholas Husin <husin@google.com> Auto-Submit: Nicholas Husin <husin@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2026-03-12net/http/internal/http2: drop benchmarks which use synctestDamien Neil
Drop a number of low-level benchmarks which use internal test APIs that now use synctest. Synctest and benchmarks don't really mix; we don't necessarily expect bubbled code to perform in the same fashion as unbubbled code. Fixes #78114 Change-Id: I23f0a5d296ffeabc836f3865e08778eb6a6a6964 Reviewed-on: https://go-review.googlesource.com/c/go/+/754940 Reviewed-by: Nicholas Husin <nsh@golang.org> Reviewed-by: Nicholas Husin <husin@google.com> Auto-Submit: Damien Neil <dneil@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2026-03-12net/http: use net/http/internal/http2 rather than h2_bundle.goDamien Neil
Rework net/http/internal/http2 to use internally-defined types rather than net/http types (to avoid an import cycle). Remove h2_bundle.go, and replace it with calls into net/http/internal/http2 instead. For #67810 Change-Id: I56a1b28dbd0e302ab15a30f819dd46256a6a6964 Reviewed-on: https://go-review.googlesource.com/c/go/+/751304 Reviewed-by: Nicholas Husin <nsh@golang.org> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Auto-Submit: Damien Neil <dneil@google.com> Reviewed-by: Nicholas Husin <husin@google.com>
2026-03-12net/http/internal/http2: skip TestTransportNewClientConnCloseOnWriteErrorDamien Neil
Rewrote this test to use newTestClientConn, discovered that the assertion that it's supposed to make (if a write to a conn fails, the conn is closed) doesn't hold for all writes. Skip the amended test for now. For #67810 Change-Id: I1b696afcd2ba86ed631ee5f32c48b2366a6a6964 Reviewed-on: https://go-review.googlesource.com/c/go/+/753842 Reviewed-by: Mark Freeman <markfreeman@google.com> Auto-Submit: Damien Neil <dneil@google.com> Reviewed-by: Nicholas Husin <nsh@golang.org> Reviewed-by: Nicholas Husin <husin@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2026-03-12net/http/internal/http2: remove fake connection autowaitDamien Neil
Fake connections have an option to "autowait", where the connection calls synctest.Wait before a read or after a write. This causes some confusing problems in cases when a connection might be used elsewhere than the main test goroutine, possibly resulting in two synctest.Wait calls at the same time. Drop the autowait feature, and add some more explicit Waits as required. For #67810 Change-Id: I3ba96b2af3b3a2f171c44bfe47be1d7f6a6a6964 Reviewed-on: https://go-review.googlesource.com/c/go/+/753841 Auto-Submit: Damien Neil <dneil@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Nicholas Husin <nsh@golang.org> Reviewed-by: Nicholas Husin <husin@google.com>
2026-03-12net/http/internal/http2: make server write errors stickyDamien Neil
After encountering a write error on a server's connection, remember the error and reuse it for future writes. Fixes a rare flakiness in TestServerWriteByteTimeout, where we can sometimes attempt to flush the write buffer after encountering a write timeout. Change-Id: I01649ae41185d6109180e222d4e8f8426a6a6964 Reviewed-on: https://go-review.googlesource.com/c/go/+/753720 Auto-Submit: Damien Neil <dneil@google.com> Reviewed-by: Nicholas Husin <nsh@golang.org> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Nicholas Husin <husin@google.com>
2026-03-12net/http/internal/http2: remove ServeConnOpts.UpgradeRequestDamien Neil
UpgradeRequest is used by the x/net/http2/h2c package for upgrading HTTP/1.1 requests to unencrypted HTTP/2. net/http only supports unencrypted HTTP/2 "with prior knowledge", not upgrade. Drop the field. For #67810 Change-Id: Iae48386e2e299dbf3b433954b87b6eb86a6a6964 Reviewed-on: https://go-review.googlesource.com/c/go/+/753320 Reviewed-by: Nicholas Husin <nsh@golang.org> Auto-Submit: Damien Neil <dneil@google.com> Reviewed-by: Nicholas Husin <husin@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2026-03-12net/http: move DetectContentType into net/http/internalDamien Neil
The http2 package needs access to DetectContentType, so move it into a common location. For #67810 Change-Id: Ibff3d57a4931106c2f69c5717c06bd5f6a6a6964 Reviewed-on: https://go-review.googlesource.com/c/go/+/751701 Reviewed-by: Nicholas Husin <nsh@golang.org> Auto-Submit: Damien Neil <dneil@google.com> Reviewed-by: Nicholas Husin <husin@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2026-03-12net/http/internal/http2: remove TestClientConnPingDamien Neil
Ping is no longer a public API. For #67810 Change-Id: I7df19d443634ada23cf4137b96cb25676a6a6964 Reviewed-on: https://go-review.googlesource.com/c/go/+/751311 LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Auto-Submit: Damien Neil <dneil@google.com> Reviewed-by: Nicholas Husin <nsh@golang.org> Reviewed-by: Nicholas Husin <husin@google.com>
2026-03-12net/http/internal/http2: remove TestConfigureTransportDamien Neil
ConfigureTransport is no longer a public API. For #67810 Change-Id: I8dae19bc0635c77bafa202841ef468356a6a6964 Reviewed-on: https://go-review.googlesource.com/c/go/+/751310 Reviewed-by: Nicholas Husin <husin@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Auto-Submit: Damien Neil <dneil@google.com> Reviewed-by: Nicholas Husin <nsh@golang.org>
2026-03-12net/http/internal/http2: remove TestTransportGroupsPendingDialsDamien Neil
This test exercises dials in the client connection pool inside http2.Transport, but in the merged-into-std world dials are always handled by the net/http.Transport. For #67810 Change-Id: Ic047ec3628c48116f1eda3c145bf5a566a6a6964 Reviewed-on: https://go-review.googlesource.com/c/go/+/751309 Reviewed-by: Nicholas Husin <nsh@golang.org> Reviewed-by: Nicholas Husin <husin@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Auto-Submit: Damien Neil <dneil@google.com>
2026-03-12net/http/internal/http2: remove TestServerUpgradeRequestPrefaceFailureDamien Neil
This test exercises the h2c upgrade path, where a client sends an HTTP/1 requests and receives an HTTP/2 response. We don't support this path any more, so drop the test. For #67810 Change-Id: Ib100c3afb18a98f613c19023cb2d5a026a6a6964 Reviewed-on: https://go-review.googlesource.com/c/go/+/751308 Reviewed-by: Nicholas Husin <nsh@golang.org> Auto-Submit: Damien Neil <dneil@google.com> Reviewed-by: Nicholas Husin <husin@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2026-03-12net/http/internal/http2: remove TestServerHandleCustomConnDamien Neil
This test exercises the ability to provide a non-*tls.Conn to the HTTP/2 server. This is not currently supported by net/http.Server (although it would be nice to have), so drop the test. For #67810 Change-Id: Ica5b0bcceddbb75dcc2b4d5f69fad8676a6a6964 Reviewed-on: https://go-review.googlesource.com/c/go/+/751307 Reviewed-by: Nicholas Husin <nsh@golang.org> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Auto-Submit: Damien Neil <dneil@google.com> Reviewed-by: Nicholas Husin <husin@google.com>
2026-03-12net/http/internal/http2: use newServerTester in TestIssue53Damien Neil
Replace older test infrastructure with the new shiny. Simplifies keeping this test post merge into std. For #67810 Change-Id: Idd876af67265ae8b6ab5b82f9ac376d26a6a6964 Reviewed-on: https://go-review.googlesource.com/c/go/+/751306 Auto-Submit: Damien Neil <dneil@google.com> Reviewed-by: Nicholas Husin <husin@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Nicholas Husin <nsh@golang.org>
2026-03-12net/http/internal/http2: remove TestServeConnNilOptsDamien Neil
ServeConn is no longer a public API, so there is no need to test this path. For #67810 Change-Id: I2f740ebf95777d5d44ea26f27aa812f46a6a6964 Reviewed-on: https://go-review.googlesource.com/c/go/+/751305 Reviewed-by: Nicholas Husin <nsh@golang.org> Reviewed-by: Nicholas Husin <husin@google.com> Auto-Submit: Damien Neil <dneil@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2026-03-12net/http/internal/http2: remove ExportSetH2GoawayTimeoutDamien Neil
This was used by one test. Rewrite that test to use synctest (faster!) and not care about the timeout. For #67810 Change-Id: I61496e575ae8a16ff778470f3f9d711e6a6a6964 Reviewed-on: https://go-review.googlesource.com/c/go/+/751303 Reviewed-by: Nicholas Husin <husin@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Auto-Submit: Damien Neil <dneil@google.com> Reviewed-by: Nicholas Husin <nsh@golang.org>
2026-03-12net/http/internal/http2: use net/http Transport and Server in testsDamien Neil
Update http2 tests to use a net/http Transport or Server where possible, rather than the http2 versions of these types. This changes tests which exercised configuring the http2 package types to now exercise the net/http configuration path. For example, tests which set http2.Transport.DisableCompression will now set http.Transport.DisableCompression. We don't care about the old http2-internal configuration paths, since they aren't accessible to users. For #67810 Change-Id: I942c6812321fbd24c94b8aa7215dc60d6a6a6964 Reviewed-on: https://go-review.googlesource.com/c/go/+/751302 Reviewed-by: Nicholas Husin <nsh@golang.org> Auto-Submit: Damien Neil <dneil@google.com> Reviewed-by: Nicholas Husin <husin@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2026-03-12net/http/internal/http2: make tests passDamien Neil
Remove the "//go:build ignore" lines from the initial import and make the minimal changes required for tests to pass in the new package location. For #67810 Change-Id: I243f4d4a2e269266786a22a7eb8fb17d6a6a6964 Reviewed-on: https://go-review.googlesource.com/c/go/+/751700 Auto-Submit: Damien Neil <dneil@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Nicholas Husin <husin@google.com> Reviewed-by: Nicholas Husin <nsh@golang.org>
2026-03-12net/http/internal/http2: initial importDamien Neil
This copies the contents of golang.org/x/net/http2 at 38019a2dbc2645a4c06a1e983681eefb041171c8 into net/http/internal/http2. Files which are not built at go1.27 (e.g., config_go125.go) are not included. A "//go:build ignore" comment has been added to each file. For #67810 Change-Id: If3e52767eea31adf4e2fdcff0dfa67e46a6a6964 Reviewed-on: https://go-review.googlesource.com/c/go/+/751300 Auto-Submit: Damien Neil <dneil@google.com> Reviewed-by: Nicholas Husin <husin@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Nicholas Husin <nsh@golang.org>
2026-03-11net/http: document which headers Request.Write handles speciallykovan
Document that Header values for Host, Content-Length, Transfer-Encoding, and Trailer are not used by Write, as these are derived from other Request fields. Also document that User-Agent defaults to "Go-http-client/1.1" if not set in Header. Fixes #68635 Change-Id: Ie182777ae094657cf3971fed989af1bd5e875d9f Reviewed-on: https://go-review.googlesource.com/c/go/+/741442 LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Dmitri Shuralyov <dmitshur@google.com> Auto-Submit: Damien Neil <dneil@google.com> Reviewed-by: Damien Neil <dneil@google.com>
2026-03-11net, net/netip: document the lack of security properties of IsPrivateDamien Neil
IsPrivate reports whether an address is in one of the address blocks reserved for private use. This is not a security property of an address. Add some additional text to hopefully make this clearer. Change-Id: Ib34e67947095fe256b305e429da185707aca039b Reviewed-on: https://go-review.googlesource.com/c/go/+/583935 Auto-Submit: Roland Shoemaker <roland@golang.org> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Roland Shoemaker <roland@golang.org> Reviewed-by: Sean Liao <sean@liao.dev>