Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: golang/net
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 7bbe320
Choose a base ref
...
head repository: golang/net
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: e1fcd82
Choose a head ref

Commits on Apr 4, 2024

  1. quic: don't consider goroutines running when tests start as leaked

    Change-Id: I138e284ee74c9402402f564d25e50ab753c51e9e
    Reviewed-on: https://go-review.googlesource.com/c/net/+/576536
    Reviewed-by: Chressie Himpel <chressie@google.com>
    LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
    neild committed Apr 4, 2024
    Copy the full SHA
    a130fcc View commit details

Commits on Apr 5, 2024

  1. http2: send correct LastStreamID in stream-caused GOAWAY

    When closing a connection because a stream contained a request we
    didn't like (for example, because the request headers exceed
    the maximum we will accept), set the LastStreamID in the GOAWAY
    frame to include the offending stream. This informs the client
    that retrying the request is unlikely to succeed, and avoids
    retry loops.
    
    This change requires passing the stream ID of the offending
    stream from Framer.ReadFrame up to the caller. The most sensible
    way to do this would probably be in the error. However,
    ReadFrame currently returns a defined error type for
    connection-ending errors (ConnectionError), and that type is a
    uint32 with no place to put the stream ID. Rather than changing
    the returned errors, ReadFrame now returns an error along with
    a non-nil Frame containing the stream ID, when a stream is
    responsible for a connection-ending error.
    
    For golang/go#66668
    
    Change-Id: Iba07ccbd70ab4939aa56903605474d01703ac6e4
    Reviewed-on: https://go-review.googlesource.com/c/net/+/576756
    Reviewed-by: Jonathan Amsterdam <jba@google.com>
    Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
    Auto-Submit: Damien Neil <dneil@google.com>
    LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
    neild authored and gopherbot committed Apr 5, 2024
    Copy the full SHA
    b67a0f0 View commit details
  2. http2: don't retry the first request on a connection on GOAWAY error

    When a server sends a GOAWAY frame, it indicates the ID of the
    last stream it processed. We use this to mark any requests after
    that stream as being safe to retry on a new connection.
    
    Change this to not retry the first request on a connection if we
    get a GOAWAY with an error, even if the GOAWAY has a stream ID
    of 0 indicating that it didn't process that request.
    If we're getting an error as the first result on a new connection,
    then there's either something wrong with the server or something
    wrong with our request; either way, retrying isn't likely to be
    productive and may be unsafe.
    
    This matches the behavior of the HTTP/1 client, which
    also avoids retrying the first request on a new connection.
    
    For golang/go#66668
    Fixes golang/go#60636
    
    Change-Id: I90ea7cfce2974dd413f7cd8b78541678850376a5
    Reviewed-on: https://go-review.googlesource.com/c/net/+/576895
    LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
    Reviewed-by: Jonathan Amsterdam <jba@google.com>
    neild committed Apr 5, 2024
    Copy the full SHA
    ec05fdc View commit details

Commits on Apr 15, 2024

  1. http/httpguts: speed up ValidHeaderFieldName

    Eliminate bounds checks and eschews UTF-8 decoding in ValidHeaderFieldName,
    thereby doubling its speed without introducing any allocations.
    Also eliminate bounds checks in IsTokenRune.
    
    Add tests and benchmarks for both ValidHeaderFieldName and IsTokenRune.
    
    goos: darwin
    goarch: amd64
    pkg: golang.org/x/net/http/httpguts
    cpu: Intel(R) Core(TM) i7-6700HQ CPU @ 2.60GHz
                           │   before    │                after                │
                           │   sec/op    │   sec/op     vs base                │
    IsTokenRune-8            315.2n ± 0%   316.2n ± 1%        ~ (p=0.245 n=20)
    ValidHeaderFieldName-8   62.77n ± 0%   29.16n ± 0%  -53.55% (p=0.000 n=20)
    geomean                  140.7n        96.02n       -31.73%
    
                           │    before    │                after               │
                           │     B/op     │    B/op     vs base                │
    IsTokenRune-8            0.000 ± 0%     0.000 ± 0%       ~ (p=1.000 n=20)
    ValidHeaderFieldName-8   0.000 ± 0%     0.000 ± 0%       ~ (p=1.000 n=20)
    geomean                             ²               +0.00%
    
                           │    before    │                after               │
                           │  allocs/op   │ allocs/op   vs base                │
    IsTokenRune-8            0.000 ± 0%     0.000 ± 0%       ~ (p=1.000 n=20)
    ValidHeaderFieldName-8   0.000 ± 0%     0.000 ± 0%       ~ (p=1.000 n=20)
    geomean                             ²               +0.00%
    
    Fixes golang/go#66700
    
    Change-Id: Ia3ea80e5f0d173e3a69eb7429023587fd7bc5933
    GitHub-Last-Rev: 1f1d25d
    GitHub-Pull-Request: #207
    Reviewed-on: https://go-review.googlesource.com/c/net/+/578075
    Run-TryBot: Emmanuel Odeke <emmanuel@orijtech.com>
    Reviewed-by: Damien Neil <dneil@google.com>
    Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
    TryBot-Result: Gopher Robot <gobot@golang.org>
    LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
    jub0bs authored and neild committed Apr 15, 2024
    Copy the full SHA
    0a24555 View commit details

Commits on Apr 18, 2024

  1. html: fix typo in package doc

    Change-Id: I3cacfadc0396c8ef85addd062d991bb6f5b0483a
    Reviewed-on: https://go-review.googlesource.com/c/net/+/580035
    Auto-Submit: Ian Lance Taylor <iant@google.com>
    Reviewed-by: Ian Lance Taylor <iant@google.com>
    Commit-Queue: Ian Lance Taylor <iant@google.com>
    LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
    Auto-Submit: Damien Neil <dneil@google.com>
    Reviewed-by: Damien Neil <dneil@google.com>
    Juneezee authored and gopherbot committed Apr 18, 2024
    Copy the full SHA
    f95a3b3 View commit details

Commits on May 3, 2024

  1. quic: initiate key rotation earlier in connections

    The QUIC interop runner "keyrotate" test requires that the client
    initiate a key rotation early in the connection. With our current
    ack frequency, it seems that we need to rotate within the first
    300-400 packets for the test to pass.
    
    Reduce the initial key rotation from 1000 to 100 packets.
    Rotating earlier shouldn't have any real downsides
    (rotation is cheap and generally done once per connection,
    except for very long-lived connections), and this is simpler
    than providing a way to tune the rotation interval in one
    specific test.
    
    For golang/go#67138
    
    Change-Id: I33d47ea35ed39f0a13c171adb2b0698f8c93050e
    Reviewed-on: https://go-review.googlesource.com/c/net/+/582855
    LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
    Reviewed-by: Jonathan Amsterdam <jba@google.com>
    neild committed May 3, 2024
    Copy the full SHA
    b20cd59 View commit details

Commits on May 6, 2024

  1. http2: use net.ErrClosed

    Use errors.Is(err, net.ErrClosed) instead of checking for a known
    string. net.ErrClosed is available since Go 1.16, the current minimum
    version in go.mod is Go 1.18.
    
    For golang/go#4373
    
    Change-Id: Id98771874434bae7d9c6d1d4d36fddb28822eb39
    Reviewed-on: https://go-review.googlesource.com/c/net/+/583016
    Auto-Submit: Tobias Klauser <tobias.klauser@gmail.com>
    Reviewed-by: Damien Neil <dneil@google.com>
    Reviewed-by: Cherry Mui <cherryyz@google.com>
    LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
    tklauser authored and gopherbot committed May 6, 2024
    Copy the full SHA
    e0324fc View commit details
  2. go.mod: update golang.org/x dependencies

    Update golang.org/x dependencies to their latest tagged versions.
    
    Change-Id: If4b46b8a597f56ee25582b456ee4ac5f42e3fdd4
    Reviewed-on: https://go-review.googlesource.com/c/net/+/583516
    Auto-Submit: Gopher Robot <gobot@golang.org>
    LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
    Reviewed-by: Than McIntosh <thanm@google.com>
    Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
    gopherbot committed May 6, 2024
    Copy the full SHA
    d27919b View commit details

Commits on May 8, 2024

  1. http2: avoid panic on h2c upgrade failure

    When performing an h2c upgrade, we would panic if an error occurred
    reading the client preface. *serverConn.closeStream assumes that
    a conn with an IdleTimeout > 0 will have an idleTimer, but in the
    h2c upgrade case the stream may have been created before the timer.
    
    Fixes golang/go#67168
    
    Change-Id: I30b5a701c10753ddc344079b9498285f099155cf
    Reviewed-on: https://go-review.googlesource.com/c/net/+/584255
    Reviewed-by: Jonathan Amsterdam <jba@google.com>
    LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
    neild committed May 8, 2024
    Copy the full SHA
    7fa635b View commit details

Commits on May 10, 2024

  1. webdav: return 409 for PUT without parent collection

    Aligning with the WebDAV RFC specification,
    changes the server response for PUT operations that would
    create a resource without an existing parent collection
    from HTTP 404 Not Found to HTTP 409 Conflict.
    
    RFC RFC4918, section 9.7.1
    
    Fixes golang/go#67150
    
    Change-Id: I5ce6c5ea147a6a450ef5ae2e0077eb0dce409743
    Reviewed-on: https://go-review.googlesource.com/c/net/+/583055
    Reviewed-by: Cherry Mui <cherryyz@google.com>
    LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
    Auto-Submit: Damien Neil <dneil@google.com>
    Reviewed-by: Damien Neil <dneil@google.com>
    vvatanabe authored and gopherbot committed May 10, 2024
    Copy the full SHA
    ac99879 View commit details

Commits on May 13, 2024

  1. http2: drop the gate type

    Drop a trivial "gate" type used in exactly one location,
    replacing it with an equivalent channel operation.
    
    We've been using a "gate" with a different definition in
    the quic package; dropping this hapax legomenon type from
    the http2 package frees up the name if we want to use the
    same gate here.
    
    Change-Id: Id9c7d05daf7ee920c38090df960822fcc1168a4d
    Reviewed-on: https://go-review.googlesource.com/c/net/+/584896
    Reviewed-by: Jonathan Amsterdam <jba@google.com>
    LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
    neild committed May 13, 2024
    Copy the full SHA
    2c14f51 View commit details

Commits on May 15, 2024

  1. http2: cancel handler context on stream errors

    When we reset a stream due to an error, cancel the handler context.
    
    Fixes golang/go#67036
    
    Change-Id: I66941d9bffb35d8b4358ff8d85cc784c1846afa6
    Reviewed-on: https://go-review.googlesource.com/c/net/+/585595
    LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
    Reviewed-by: Jonathan Amsterdam <jba@google.com>
    neild committed May 15, 2024
    Copy the full SHA
    8aa6dbf View commit details

Commits on May 16, 2024

  1. http2: set up the timer of closing idle connection after the initiali…

    …zation
    
    Fixes golang/go#66763
    
    Change-Id: I046028b6072a6da77e7f1b4d1f2e6b14f8edb042
    Reviewed-on: https://go-review.googlesource.com/c/net/+/578115
    LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
    Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
    Reviewed-by: Damien Neil <dneil@google.com>
    Auto-Submit: Damien Neil <dneil@google.com>
    panjf2000 authored and gopherbot committed May 16, 2024
    Copy the full SHA
    c87a5b6 View commit details

Commits on May 20, 2024

  1. proxy: use strings.TrimSuffix

    Change-Id: Icca4cdbdc1fb964eda8e0fed559f8d4e5dc45073
    Reviewed-on: https://go-review.googlesource.com/c/net/+/586115
    Reviewed-by: Ian Lance Taylor <iant@google.com>
    Auto-Submit: Tobias Klauser <tobias.klauser@gmail.com>
    Reviewed-by: Carlos Amedee <carlos@golang.org>
    LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
    tklauser authored and gopherbot committed May 20, 2024
    Copy the full SHA
    49bf2d7 View commit details
  2. http2: use implicit synchronization in tests

    Rewrite the synchronization used in Transport tests.
    This replaces the explicit synchronization, which requires
    annotating every point where a goroutine in the code under test
    may block, with implicit syncronization based on parsing
    goroutine stacks to identify when all goroutines of interest are
    blocked.
    
    Change-Id: I02646e2752c359ed1b08126370a48f3d3c1fde77
    Reviewed-on: https://go-review.googlesource.com/c/net/+/584895
    Reviewed-by: Jonathan Amsterdam <jba@google.com>
    LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
    neild committed May 20, 2024
    Copy the full SHA
    b1ec120 View commit details
  3. http2: clearer distinction between test server types

    newServerTester is used to create an HTTP/2 server for testing.
    It returns a *serverTester, which includes a number of methods
    for sending frames to and reading frames from a server connection
    under test.
    
    Many tests also use newServerTester to simply start an
    *httptest.Server. These tests pass an "optOnlyServer" to
    indicate that they don't need a client connection to interact with.
    They interact with the *httptest.Server, and use no methods or
    fields of *serverTester.
    
    Make a clearer distinction between test types.
    
    Add a newTestServer function which starts and returns
    an *httptest.Server.
    
    This function replaces use of newServerTester with optOnlyServer.
    
    Change-Id: Ia590c9b4dcc23c17e530b0cc273b9120965da11a
    Reviewed-on: https://go-review.googlesource.com/c/net/+/586155
    Reviewed-by: Jonathan Amsterdam <jba@google.com>
    LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
    neild committed May 20, 2024
    Copy the full SHA
    9545aea View commit details

Commits on May 21, 2024

  1. all: replace deprecated io/ioutil calls

    The io/ioutil package's features were moved to
    the io and os packages in Go 1.16.
    
    x/net depends on Go 1.18. Drop ioutil calls,
    so gopls doesn't warn about them.
    
    Change-Id: Ibdb576d94f250808ae285aa142e2fd41e7e9afc9
    Reviewed-on: https://go-review.googlesource.com/c/net/+/586244
    LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
    Reviewed-by: Ian Lance Taylor <iant@google.com>
    neild committed May 21, 2024
    Copy the full SHA
    c1f5833 View commit details
  2. http2: remove spec coverage test

    When run with -coverspec, tests track which portions of the
    specification they cover and the TestSpecCoverage test produces
    an error if any sections lack test coverage.
    
    This is a lovely idea, and perhaps we should resurrect it at
    some point, but there is currently exactly one coverage
    annotation, dating back to the first commit of this package.
    
    Change-Id: I5d2d8a1032b783d113ed0982f7e97a3bd1c07a33
    Reviewed-on: https://go-review.googlesource.com/c/net/+/586243
    LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
    Reviewed-by: Jonathan Amsterdam <jba@google.com>
    neild committed May 21, 2024
    Copy the full SHA
    332fe23 View commit details
  3. http2: avoid racy access to clientStream.requestedGzip

    clientStream.requestedGzip is set from clientStream.writeRequest,
    and examined by clientConn.readLoop. I'm not sure if there's
    any possible way for an actual data race to happen here in
    practice, since the read loop should only examine the field
    after the request is sent by writeRequest, but it's enough
    for the race detector to complain.
    
    Set the field in ClientConn.roundTrip instead, before
    the clientStream has become accessible to any other goroutines.
    
    No test, but a following CL has race detector failures without
    this change.
    
    Change-Id: Id30f1b95bcfcc35c213440e0e47cce3feaaff06d
    Reviewed-on: https://go-review.googlesource.com/c/net/+/586245
    LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
    Reviewed-by: Jonathan Amsterdam <jba@google.com>
    neild committed May 21, 2024
    Copy the full SHA
    410d19e View commit details
  4. http2: add a more full-featured test net.Conn

    Add a net.Conn implementation that plays nicely with testsyncGroup,
    implements read/write timeouts, and gives control over buffering
    to let us write tests that cause writes to a Conn to block at
    specific points in time.
    
    Change-Id: I9d870b211ac9d938a8c4a221277981cdb821a6e4
    Reviewed-on: https://go-review.googlesource.com/c/net/+/586246
    Reviewed-by: Jonathan Amsterdam <jba@google.com>
    LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
    neild committed May 21, 2024
    Copy the full SHA
    022530c View commit details

Commits on May 28, 2024

  1. http2: use synthetic time in server tests

    Change newServerTester to return a server using fake time
    and a fake net.Conn.
    
    Change-Id: I9d5db0cbe75696aed6d99ff1cd2369c2dea426c3
    Reviewed-on: https://go-review.googlesource.com/c/net/+/586247
    LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
    Reviewed-by: Jonathan Amsterdam <jba@google.com>
    neild committed May 28, 2024
    Copy the full SHA
    03c24c2 View commit details
  2. http2: drop unused retry function

    Change-Id: Ibe7e022a4863c8b0e502d7952b870046443acf7e
    Reviewed-on: https://go-review.googlesource.com/c/net/+/586248
    LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
    Reviewed-by: Jonathan Amsterdam <jba@google.com>
    Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
    neild committed May 28, 2024
    Copy the full SHA
    9f5b79b View commit details
  3. http2: factor out frame read/write test functions

    Client and server tests both write frames to a test connection
    and read frames back. Frame reads are usually paired with
    test expectations.
    
    Unify the API used for frame reads/writes in tests.
    
    Introduce a testConnFramer type that implements a common set
    of read/write methods, and embed it in both client and server
    test types.
    
    Change-Id: I6927c43459ba24f150a21c058a92797754f82bf1
    Reviewed-on: https://go-review.googlesource.com/c/net/+/586249
    Reviewed-by: Jonathan Amsterdam <jba@google.com>
    LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
    neild committed May 28, 2024
    Copy the full SHA
    0d515a5 View commit details

Commits on May 30, 2024

  1. http2: avoid corruption in priority write scheduler

    When removing a stream containing children in the priority
    tree, it was possible for some children to not be correctly
    moved to the parent of the removed stream.
    
    Fixes golang/go#66514
    
    Change-Id: Ie8a8743a6213a6b1a2426e023111878afff78f9e
    Reviewed-on: https://go-review.googlesource.com/c/net/+/589255
    LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
    Reviewed-by: Jonathan Amsterdam <jba@google.com>
    neild committed May 30, 2024
    Copy the full SHA
    5608279 View commit details
  2. http2: report an error if goroutines outlive serverTester tests

    Change-Id: Icd2152b4bddacf12120be16c32c8c2d52d235fbd
    Reviewed-on: https://go-review.googlesource.com/c/net/+/589075
    LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
    Reviewed-by: Jonathan Amsterdam <jba@google.com>
    neild committed May 30, 2024
    Copy the full SHA
    67e8d0c View commit details

Commits on Jun 3, 2024

  1. quic: disable X25519Kyber768Draft00 in tests

    Enabling this bloats the TLS handshake so flights no longer
    fit in a single datagram. Disable it in tests. Add a test
    using the crypto/tls defaults, to ensure we do handshake
    properly with them.
    
    Fixes golang/go#67783
    
    Change-Id: I521188e7b5a313e9289e726935e5b26994090b4a
    Reviewed-on: https://go-review.googlesource.com/c/net/+/589855
    Auto-Submit: Damien Neil <dneil@google.com>
    Reviewed-by: Jonathan Amsterdam <jba@google.com>
    Reviewed-by: Filippo Valsorda <filippo@golang.org>
    LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
    neild authored and gopherbot committed Jun 3, 2024
    Copy the full SHA
    603e3e6 View commit details
  2. http2: avoid race in server handler SetReadDeadine/SetWriteDeadline

    Can't safely access responseWriter.rws from on the server's serve loop.
    
    Change-Id: I477abe58cf9dd23813a0c5507aed2319696fdfaf
    Reviewed-on: https://go-review.googlesource.com/c/net/+/589856
    Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
    Reviewed-by: Matthew Dempsky <mdempsky@google.com>
    Auto-Submit: Damien Neil <dneil@google.com>
    LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
    neild authored and gopherbot committed Jun 3, 2024
    Copy the full SHA
    6249541 View commit details

Commits on Jun 4, 2024

  1. go.mod: update golang.org/x dependencies

    Update golang.org/x dependencies to their latest tagged versions.
    
    Change-Id: I472c3d990ea3c7c88a92bc0824034b112cec0eff
    Reviewed-on: https://go-review.googlesource.com/c/net/+/590237
    Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
    Reviewed-by: Than McIntosh <thanm@google.com>
    Auto-Submit: Gopher Robot <gobot@golang.org>
    LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
    gopherbot committed Jun 4, 2024
    Copy the full SHA
    66e838c View commit details

Commits on Jun 12, 2024

  1. http2: avoid Transport hang with Connection: close and AllowHTTP

    CL 111835 changed Transport stream ID numbering to start at
    stream 3 when AllowHTTP is set. This was based on a
    misunderstanding:
    
    When a connection upgrades an HTTP/1.1 request to HTTP/2,
    the initial HTTP/1.1 request occupies stream 1.
    However, Transport does not perform HTTP protocol upgrades.
    When using a Transport to send unencrypted HTTP/2 requests,
    the entire connection uses HTTP/2, the first request is
    sent as HTTP/2, and there is no reason not to use stream 1
    for this request.
    
    Starting from stream 3 is mostly harmless,
    but ClientConn.idleStateLocked assumes that client streams
    start from 1. This causes it to misidentify new single-use
    connections as having already sent a request (when AllowHTTP
    is set), and therefore not suitable for use.
    
    Revert to always starting stream IDs at 1.
    
    Fixes golang/go#67671
    
    Change-Id: I97c89de4ae49623d916f9dbd200f8252d2fd4247
    Reviewed-on: https://go-review.googlesource.com/c/net/+/591275
    LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
    Reviewed-by: Jonathan Amsterdam <jba@google.com>
    neild committed Jun 12, 2024
    Copy the full SHA
    9617c63 View commit details

Commits on Jul 5, 2024

  1. quic: skip tests which depend on unimplemented UDP functions on Plan 9

    The ReadMsgUDP and WriteMsgUDP methods of UDPConn are not implemented
    (yet?) on Plan 9. Skip tests which require them.
    
    Fixes golang/go#68288
    
    Change-Id: Ic6c81b19322d589c10b16da61e9b89284294be05
    Reviewed-on: https://go-review.googlesource.com/c/net/+/596795
    Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
    LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
    Reviewed-by: Than McIntosh <thanm@google.com>
    millerresearch authored and thanm committed Jul 5, 2024
    Copy the full SHA
    77708f7 View commit details
  2. go.mod: update golang.org/x dependencies

    Update golang.org/x dependencies to their latest tagged versions.
    
    Change-Id: Ibb0ab46488252d035430a654eed5dd4caab7509e
    Reviewed-on: https://go-review.googlesource.com/c/net/+/596895
    LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
    Auto-Submit: Gopher Robot <gobot@golang.org>
    Reviewed-by: Than McIntosh <thanm@google.com>
    Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
    gopherbot committed Jul 5, 2024
    2
    Copy the full SHA
    e2310ae View commit details

Commits on Jul 16, 2024

  1. LICENSE: update per Google Legal

    Very minor tweaks:
     - Remove (c) pseudosymbol.
     - Remove "All Rights Reserved."
     - Change "Google Inc." (no longer exists) to "Google LLC".
    
    [git-generate]
    echo '
    ,s/\(c\) //
    ,s/ All rights reserved.//
    ,s/Google Inc./Google LLC/
    w
    q
    ' | sam -d LICENSE
    
    Change-Id: Ibaa49e00dd08950a577e4343bfc574980d327995
    Reviewed-on: https://go-review.googlesource.com/c/net/+/598579
    LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
    Reviewed-by: Ian Lance Taylor <iant@google.com>
    rsc committed Jul 16, 2024
    Copy the full SHA
    032e4e4 View commit details

Commits on Jul 22, 2024

  1. xsrftoken: create no padding base64 string by RawURLEncoding

    The XSRF token generation function creates the padded base64 string by
    base64.URLEncoding, then removes the padding. It is equivalent to the
    base64.RawURLEncoding but with more costs.
    
    Change-Id: I9cf5ad94e9cf3dca9bbfc1b6818ab07d41acf417
    GitHub-Last-Rev: a8263b5
    GitHub-Pull-Request: #217
    Reviewed-on: https://go-review.googlesource.com/c/net/+/599895
    Reviewed-by: Ian Lance Taylor <iant@google.com>
    LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
    Reviewed-by: Damien Neil <dneil@google.com>
    Auto-Submit: Ian Lance Taylor <iant@google.com>
    Commit-Queue: Damien Neil <dneil@google.com>
    Commit-Queue: Ian Lance Taylor <iant@google.com>
    ghosind authored and gopherbot committed Jul 22, 2024
    Copy the full SHA
    765c7e8 View commit details

Commits on Aug 6, 2024

  1. go.mod: update golang.org/x dependencies

    Update golang.org/x dependencies to their latest tagged versions.
    
    Change-Id: I6a2e43cca79f719c018887e1d75b578fc27be8f1
    Reviewed-on: https://go-review.googlesource.com/c/net/+/603399
    Reviewed-by: David Chase <drchase@google.com>
    Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
    LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
    Auto-Submit: Gopher Robot <gobot@golang.org>
    gopherbot committed Aug 6, 2024
    Copy the full SHA
    4542a42 View commit details

Commits on Sep 4, 2024

  1. websocket: fix printf(var) mistake detected by latest printf checker

    For golang/go#69267.
    
    Change-Id: Ica6d123312495966ad6d222d67944fd602216853
    Reviewed-on: https://go-review.googlesource.com/c/net/+/610799
    Reviewed-by: Alan Donovan <adonovan@google.com>
    Auto-Submit: Dmitri Shuralyov <dmitshur@golang.org>
    Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
    LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
    dmitshur authored and gopherbot committed Sep 4, 2024
    Copy the full SHA
    9bf379f View commit details

Commits on Sep 5, 2024

  1. go.mod: update golang.org/x dependencies

    Update golang.org/x dependencies to their latest tagged versions.
    
    Change-Id: I4be730755989f3d982deaac30cf72c1f3546d4b7
    Reviewed-on: https://go-review.googlesource.com/c/net/+/611198
    Auto-Submit: Gopher Robot <gobot@golang.org>
    LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
    Reviewed-by: Michael Pratt <mpratt@google.com>
    Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
    gopherbot committed Sep 5, 2024
    Copy the full SHA
    35b4aba View commit details

Commits on Sep 6, 2024

  1. route: fix address parsing of messages on Darwin

    sizeofSockaddrInet is 16, but first byte of sockaddr specifies actual
    size of sockaddr.
    
    Although, 16 works for most cases, it fails for Netmasks addresses. On
    Darwin only the significant bits of the netmask are in the msg.
    
    Take this route message as an example
    
    ```
    // rt_msg_hdr
    88 00 05 01 00 00 00 00
    41 08 00 00 07 00 00 00
    92 7b 00 00 01 00 00 00
    00 00 00 00 00 00 00 00
    00 00 00 00
    
    // metrics
    00 00 00 00 00 00 00 00
    00 00 00 00 00 00 00 00
    00 00 00 00 00 00 00 00
    00 00 00 00 00 00 00 00
    00 00 00 00 00 00 00 00
    00 00 00 00 00 00 00 00
    00 00 00 00 00 00 00 00
    
    // SOCKADDRS - DST  (100.113.0.0)
    10 02 00 00 64 71 00 00
    00 00 00 00 00 00 00 00
    
    // GW  utun4319
    14 12 21 00 01 08 00 00
    75 74 75 6e 34 33 31 39
    00 00 00 00
    
    // NETMASK 255.255.0.0
    06 02 00 00 ff ff
    
    // NULL
    00 00
    ```
    
    i.e. ipv4
    ```
    06 02 00 00 ff ff
    ```
    
    The above byte sequence is for a sockaddr that is 6 bytes long
    representing an ipv4 for address that is 255.255.0.0.
    
    i.e. ipv6 netmask
    ```
    0e 1e 00 00 00 00 00 00 ff ff ff ff ff ff 00 00
    ```
    
    The above is `/48` netmask that should also be parsed using `b[0]` of the
    sockaddr that contains the length.
    
    Confirmed by using `route monitor`.
    
    sources:
    https://github.com/apple/darwin-xnu/blob/main/bsd/net/route.h
    https://github.com/apple/darwin-xnu/blob/main/bsd/sys/socket.h#L603
    
    Fixes golang/go#44740
    
    Change-Id: I8153130d02d0a5e547fbf60a85762d3889e1d08c
    GitHub-Last-Rev: f7b9253
    GitHub-Pull-Request: #220
    Reviewed-on: https://go-review.googlesource.com/c/net/+/609577
    LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
    Reviewed-by: Ian Lance Taylor <iant@google.com>
    Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
    Auto-Submit: Ian Lance Taylor <iant@google.com>
    hurricanehrndz authored and gopherbot committed Sep 6, 2024
    Copy the full SHA
    3c333c0 View commit details

Commits on Sep 23, 2024

  1. http2: add Server.WriteByteTimeout

    Transports support a WriteByteTimeout option which sets the maximum
    amount of time we can go without being able to write any bytes to
    a connection. Add an equivalent option to Server for consistency.
    
    Fixes golang/go#61777
    
    Change-Id: Iaa8a69dfc403906eb224829320f901e5a6a5c429
    Reviewed-on: https://go-review.googlesource.com/c/net/+/601496
    LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
    Reviewed-by: Carlos Amedee <carlos@golang.org>
    Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
    neild committed Sep 23, 2024
    Copy the full SHA
    541dbe5 View commit details

Commits on Sep 25, 2024

  1. http2: add support for server-originated pings

    Add configurable support for health-checking idle connections
    accepted by the HTTP/2 server, following the same configuration
    as the Transport.
    
    Fixes golang/go#67812
    
    Change-Id: Ia4014e691546b2c29db8dad3af5f39966d0ceb93
    Reviewed-on: https://go-review.googlesource.com/c/net/+/601497
    Reviewed-by: Carlos Amedee <carlos@golang.org>
    Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
    LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
    neild committed Sep 25, 2024
    Copy the full SHA
    4790dc7 View commit details
  2. http2: add support for net/http HTTP2 config field

    For golang/go#67813
    
    Change-Id: I6b7f857d6ed250ba8b09649730980a91b3e8d7e9
    Reviewed-on: https://go-review.googlesource.com/c/net/+/607255
    Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
    LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
    Reviewed-by: Jonathan Amsterdam <jba@google.com>
    neild committed Sep 25, 2024
    Copy the full SHA
    7191757 View commit details
  3. websocket: update nhooyr.io/websocket to github.com/coder/websocket

    Maintenance of nhooyr.io/websocket has moved to github.com/coder/websocket.
    
    Read more about the transition at https://coder.com/blog/websocket
    
    Updates golang/go#18152
    
    Change-Id: Ia2b11c9a57ad7ded775b50a5bbb7ea91562d39b5
    GitHub-Last-Rev: 59cea5e
    GitHub-Pull-Request: #222
    Reviewed-on: https://go-review.googlesource.com/c/net/+/614075
    Reviewed-by: Ian Lance Taylor <iant@google.com>
    LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
    Reviewed-by: Damien Neil <dneil@google.com>
    Auto-Submit: Damien Neil <dneil@google.com>
    mafredri authored and gopherbot committed Sep 25, 2024
    Copy the full SHA
    f88258d View commit details

Commits on Oct 4, 2024

  1. go.mod: update golang.org/x dependencies

    Update golang.org/x dependencies to their latest tagged versions.
    
    Change-Id: I57613519f6e5795e60d258865e81f6954d672606
    Reviewed-on: https://go-review.googlesource.com/c/net/+/617959
    Reviewed-by: David Chase <drchase@google.com>
    Auto-Submit: Gopher Robot <gobot@golang.org>
    Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
    LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
    gopherbot committed Oct 4, 2024
    Copy the full SHA
    6cc5ac4 View commit details

Commits on Oct 10, 2024

  1. http2: support ResponseController.EnableFullDuplex

    The ResponseController.EnableFullDuplex method indicates that an HTTP
    handler intends to interleave reads from a request body with writes
    to the response body.
    
    Add an EnableFullDuplex method to the ResponseWriter so we don't
    return a not-supported error. The HTTP/2 server always supports
    full duplex, so this is a no-op.
    
    For golang/go#57786
    
    Change-Id: I6529e6ce01d59b8b48fb67ba7c244255df57c174
    Reviewed-on: https://go-review.googlesource.com/c/net/+/472717
    Reviewed-by: Cherry Mui <cherryyz@google.com>
    LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
    Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
    Reviewed-by: Дарья Бочкар <dasha7vanya@gmail.com>
    neild committed Oct 10, 2024
    Copy the full SHA
    42b1186 View commit details

Commits on Oct 11, 2024

  1. internal/socket: execute gofmt

    Change-Id: Ifc793d535c31da3ba183ee44e1808e0072d7f099
    Reviewed-on: https://go-review.googlesource.com/c/net/+/619595
    Reviewed-by: Damien Neil <dneil@google.com>
    Auto-Submit: Damien Neil <dneil@google.com>
    LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
    Reviewed-by: Ian Lance Taylor <iant@google.com>
    cuishuang authored and gopherbot committed Oct 11, 2024
    Copy the full SHA
    5716b98 View commit details

Commits on Oct 21, 2024

  1. http2: limit 1xx based on size, do not limit when delivered

    Replace Transport's limit of 5 1xx responses with a limit based
    on the maximum header size: The total size of all 1xx response
    headers must not exceed the limit we use on the size of the
    final response headers.
    
    (This differs slightly from the corresponding HTTP/1 change,
    which imposes a limit on all 1xx response headers *plus* the
    final response headers. The difference isn't substantial,
    and this implementation fits better with the HTTP/2 framer.)
    
    When the user is reading 1xx responses using a Got1xxResponse
    client trace hook, disable the limit: Each 1xx response is
    individually limited by the header size limit, but there
    is no limit on the total number of responses. The user is
    responsible for imposing a limit if they want one.
    
    For golang/go#65035
    
    Change-Id: I9c19dbf068e0f580789d952f63113b3d21ad86fc
    Reviewed-on: https://go-review.googlesource.com/c/net/+/615295
    Reviewed-by: Cherry Mui <cherryyz@google.com>
    LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
    Auto-Submit: Damien Neil <dneil@google.com>
    Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
    neild authored and gopherbot committed Oct 21, 2024
    Copy the full SHA
    4783315 View commit details

Commits on Oct 29, 2024

  1. html: add Node.{Ancestors,ChildNodes,Descendants}()

    Adds iterators for the parents, immediate children, and all children of a Node respectively.
    
    Fixes golang/go#62113
    
    Change-Id: Iab015872cc3a20fe5e7cae3bc90b89cba68cc3f8
    GitHub-Last-Rev: d99de58
    GitHub-Pull-Request: #215
    Reviewed-on: https://go-review.googlesource.com/c/net/+/594195
    Reviewed-by: Ian Lance Taylor <iant@google.com>
    LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
    Auto-Submit: Ian Lance Taylor <iant@google.com>
    Reviewed-by: Damien Neil <dneil@google.com>
    earthboundkid authored and gopherbot committed Oct 29, 2024
    Copy the full SHA
    511cc3a View commit details

Commits on Nov 1, 2024

  1. README: don't recommend go get

    These days people will just import the packages and the go tool will
    do the right thing. We don't need to explain it.
    
    Add a pointer to the git repo, though.
    
    For golang/go#62645
    
    Change-Id: Ia5a16d8d66395e3feee2029ea1c3140b4d3939e7
    Reviewed-on: https://go-review.googlesource.com/c/net/+/624175
    Auto-Submit: Ian Lance Taylor <iant@google.com>
    LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
    Reviewed-by: Damien Neil <dneil@google.com>
    Reviewed-by: Ian Lance Taylor <iant@google.com>
    ianlancetaylor authored and gopherbot committed Nov 1, 2024
    Copy the full SHA
    e883dae View commit details
  2. http2: detect hung client connections by confirming stream resets

    Consider the case of an unresponsive client connection, where
    the server has stopped responding. We send an infinite sequence of
    requests to the connection in sequence, each with a timeout.
    Each request counts against the concurrency limit for the
    connection while active, but when a request times out we send
    a RST_STREAM and free up the concurrency slot it was using.
    
    We continue to try to send requests to the connection forever (or
    until the kernel closes the underlying TCP connection, or until
    ReadIdleTimeout/WriteByteTimeout results in us closing the connection).
    
    Defend against this scenario by counting a canceled request
    against the connection concurrency limit until we confirm the
    server is responding. Specifically:
    
    Track the number of in-flight request cancellations in cc.pendingResets.
    This total counts against the connection concurrency limit.
    
    When sending a RST_STREAM for a canceled request, increment
    cc.pendingResets. Send a PING frame to the server, unless a PING
    is already in flight.
    
    When receiving a PING response, set cc.pendingResets to 0.
    
    A hung connection will be used for at most
    SETTINGS_MAX_CONCURRENT_STREAMS requests.
    
    When StrictMaxConcurrentStreams is false, we will create a
    new connection after reaching the concurrency limit for a hung one.
    
    When StrictMaxConcurrentStreams is true, we will continue to
    wait for the existing connection until some timeout closes it
    or it becomes responsive again.
    
    For golang/go#59690
    
    Change-Id: I0151f9a594af14b32bcb6005a239fa19eb103704
    Reviewed-on: https://go-review.googlesource.com/c/net/+/617655
    LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
    Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
    Reviewed-by: Jonathan Amsterdam <jba@google.com>
    Reviewed-by: Carlos Amedee <carlos@golang.org>
    neild committed Nov 1, 2024
    Copy the full SHA
    f35fec9 View commit details

Commits on Nov 5, 2024

  1. http2: support unencrypted HTTP/2 handoff from net/http

    Allow net/http to pass unencrypted net.Conns to Server/Transport.
    We don't have an existing way to pass a conn other than a *tls.Conn
    into this package, so (ab)use TLSNextProto to pass unencrypted
    connections:
    
    The http2 package adds an "unencrypted_http2" entry to the
    TLSNextProto maps. The net/http package calls this function
    with a *tls.Conn wrapping a net.Conn with an UnencryptedNetConn
    method returning the underlying, unencrypted net.Conn.
    
    For golang/go#67816
    
    Change-Id: I31f9c1ba31a17c82c8ed651382bd94193acf09b9
    Reviewed-on: https://go-review.googlesource.com/c/net/+/625175
    LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
    Reviewed-by: David Chase <drchase@google.com>
    Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
    neild committed Nov 5, 2024
    Copy the full SHA
    0aa844c View commit details

Commits on Nov 6, 2024

  1. http2: surface errors occurring very early in a client conn's lifetime

    When we create a new connection for a request, the request should
    fail if the connection attempt fails.
    
    There is a race condition which can cause this to not happen:
    
    - net/http sends a request to a http2.Transport
    - the http2.Transport returns ErrNoCachedConn
    - net/http creates a new tls.Conn and passes it to the http2.Transport
    - the http2.Transport adds the conn to its connection pool
    - the connection immediately encounters an error
    - the http2.Transport removes the conn from its connection pool
    - net/http resends the request to the http2.Transport
    - the http2.Transport returns ErrNoCachedConn, and the process repeates
    
    If the request is sent to the http2.Transport before the connection
    encounters an error, then the request fails. But otherwise, we get
    stuck in an infinite loop of the http2.Transport asking for a new
    connection, receiving one, and throwing it away.
    
    To fix this, leave a dead connection in the pool for a short while
    if it has never had a request sent to it. If a dead connection is
    used for a new request, return an error and remove the connection
    from the pool.
    
    Change-Id: I64eb15a8f1512a6bda52db423072b945fab6f4b5
    Reviewed-on: https://go-review.googlesource.com/c/net/+/625398
    Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
    LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
    Reviewed-by: Jonathan Amsterdam <jba@google.com>
    neild committed Nov 6, 2024
    Copy the full SHA
    858db1a View commit details
Showing with 16,179 additions and 12,687 deletions.
  1. +2 −2 LICENSE
  2. +6 −8 README.md
  3. +2 −2 bpf/instructions_test.go
  4. +100 −12 context/context.go
  5. +0 −583 context/context_test.go
  6. +1 −1 context/ctxhttp/ctxhttp.go
  7. +2 −3 context/ctxhttp/ctxhttp_test.go
  8. +0 −72 context/go17.go
  9. +0 −20 context/go19.go
  10. +0 −300 context/pre_go17.go
  11. +0 −109 context/pre_go19.go
  12. +0 −31 context/withtimeout_test.go
  13. +2 −2 dns/dnsmessage/message_test.go
  14. +5 −5 go.mod
  15. +8 −8 go.sum
  16. +2 −2 html/atom/gen.go
  17. +629 −627 html/atom/table.go
  18. +1 −0 html/atom/table_test.go
  19. +7 −6 html/charset/charset_test.go
  20. +2 −7 html/doc.go
  21. +1 −1 html/doctype.go
  22. +6 −7 html/example_test.go
  23. +1 −2 html/foreign.go
  24. +56 −0 html/iter.go
  25. +96 −0 html/iter_test.go
  26. +4 −0 html/node.go
  27. +8 −4 html/parse.go
  28. +19 −2 html/parse_test.go
  29. +16 −2 html/token.go
  30. +21 −3 html/token_test.go
  31. +4 −9 http/httpguts/httplex.go
  32. +48 −1 http/httpguts/httplex_test.go
  33. +8 −2 http/httpproxy/proxy.go
  34. +7 −0 http/httpproxy/proxy_test.go
  35. +4 −4 http2/client_conn_pool.go
  36. +118 −352 http2/clientconn_test.go
  37. +122 −0 http2/config.go
  38. +61 −0 http2/config_go124.go
  39. +16 −0 http2/config_pre_go124.go
  40. +95 −0 http2/config_test.go
  41. +431 −0 http2/connframes_test.go
  42. +21 −7 http2/frame.go
  43. +4 −10 http2/h2c/h2c.go
  44. +2 −3 http2/h2c/h2c_test.go
  45. +1 −2 http2/hpack/gen.go
  46. +89 −42 http2/http2.go
  47. +18 −2 http2/http2_test.go
  48. +356 −0 http2/netconn_test.go
  49. +2 −3 http2/pipe_test.go
  50. +253 −184 http2/server.go
  51. +19 −20 http2/server_push_test.go
  52. +1,000 −1,119 http2/server_test.go
  53. +329 −0 http2/sync_test.go
  54. +0 −5,021 http2/testdata/draft-ietf-httpbis-http2.xml
  55. +0 −331 http2/testsync.go
  56. +20 −0 http2/timer.go
  57. +490 −622 http2/transport.go
  58. +954 −313 http2/transport_test.go
  59. +32 −0 http2/unencrypted.go
  60. +12 −1 http2/write.go
  61. +2 −2 http2/writesched_priority.go
  62. +34 −0 http2/writesched_priority_test.go
  63. +0 −356 http2/z_spec_test.go
  64. +76 −0 internal/gate/gate.go
  65. +85 −0 internal/gate/gate_test.go
  66. +142 −0 internal/http3/body.go
  67. +276 −0 internal/http3/body_test.go
  68. +133 −0 internal/http3/conn.go
  69. +154 −0 internal/http3/conn_test.go
  70. +10 −0 internal/http3/doc.go
  71. +104 −0 internal/http3/errors.go
  72. +56 −0 internal/http3/files_test.go
  73. +86 −0 internal/http3/http3.go
  74. +48 −0 internal/http3/http3_synctest_test.go
  75. +44 −0 internal/http3/http3_test.go
  76. +334 −0 internal/http3/qpack.go
  77. +83 −0 internal/http3/qpack_decode.go
  78. +196 −0 internal/http3/qpack_decode_test.go
  79. +47 −0 internal/http3/qpack_encode.go
  80. +126 −0 internal/http3/qpack_encode_test.go
  81. +144 −0 internal/http3/qpack_static.go
  82. +173 −0 internal/http3/qpack_test.go
  83. +42 −0 internal/http3/quic.go
  84. +234 −0 internal/http3/quic_test.go
  85. +347 −0 internal/http3/roundtrip.go
  86. +354 −0 internal/http3/roundtrip_test.go
  87. +172 −0 internal/http3/server.go
  88. +110 −0 internal/http3/server_test.go
  89. +72 −0 internal/http3/settings.go
  90. +262 −0 internal/http3/stream.go
  91. +319 −0 internal/http3/stream_test.go
  92. +190 −0 internal/http3/transport.go
  93. +448 −0 internal/http3/transport_test.go
  94. +53 −0 internal/httpcommon/ascii.go
  95. +17 −7 {http2 → internal/httpcommon}/headermap.go
  96. +37 −0 internal/httpcommon/httpcommon_test.go
  97. +467 −0 internal/httpcommon/request.go
  98. +672 −0 internal/httpcommon/request_test.go
  99. +1 −2 internal/iana/gen.go
  100. +28 −26 {quic → internal/quic/quicwire}/wire.go
  101. +35 −35 {quic → internal/quic/quicwire}/wire_test.go
  102. +2 −7 internal/socket/socket_test.go
  103. +14 −14 internal/socket/zsys_openbsd_ppc64.go
  104. +14 −14 internal/socket/zsys_openbsd_riscv64.go
  105. +36 −0 internal/testcert/testcert.go
  106. +2 −3 ipv4/gen.go
  107. +2 −3 ipv6/gen.go
  108. +2 −3 nettest/conntest.go
  109. +1 −2 nettest/nettest.go
  110. +7 −9 proxy/per_host.go
  111. +111 −47 proxy/per_host_test.go
  112. BIN publicsuffix/data/children
  113. BIN publicsuffix/data/nodes
  114. +1 −1 publicsuffix/data/text
  115. +0 −2 publicsuffix/example_test.go
  116. +16 −61 publicsuffix/gen.go
  117. +15 −13 publicsuffix/list.go
  118. +9 −25 publicsuffix/list_test.go
  119. +6 −6 publicsuffix/table.go
  120. +3,090 −1,670 publicsuffix/table_test.go
  121. +5 −3 quic/config.go
  122. +18 −0 quic/conn.go
  123. +12 −1 quic/conn_close.go
  124. +62 −67 quic/conn_id.go
  125. +49 −0 quic/conn_id_test.go
  126. +11 −0 quic/conn_recv.go
  127. +60 −0 quic/conn_recv_test.go
  128. +1 −1 quic/conn_test.go
  129. +18 −0 quic/crypto_stream.go
  130. +20 −1 quic/endpoint.go
  131. +11 −0 quic/endpoint_test.go
  132. +1 −2 quic/errors.go
  133. +2 −2 quic/gate.go
  134. +20 −5 quic/main_test.go
  135. +9 −7 quic/packet.go
  136. +2 −1 quic/packet_codec_test.go
  137. +45 −43 quic/packet_parser.go
  138. +8 −2 quic/packet_protection.go
  139. +62 −60 quic/packet_writer.go
  140. +2 −2 quic/qlog/json_writer.go
  141. +8 −0 quic/rangeset.go
  142. +8 −7 quic/retry.go
  143. +1 −1 quic/rtt.go
  144. +6 −4 quic/sent_packet.go
  145. +1 −1 quic/sent_val.go
  146. +42 −12 quic/stream.go
  147. +80 −4 quic/stream_test.go
  148. +1 −5 quic/tls.go
  149. +29 −0 quic/tls_test.go
  150. +22 −28 quic/tlsconfig_test.go
  151. +60 −58 quic/transport_params.go
  152. +5 −3 quic/transport_params_test.go
  153. +69 −0 quic/udp_packetconn.go
  154. +2 −0 quic/udp_test.go
  155. +53 −18 route/address.go
  156. +140 −2 route/address_darwin_test.go
  157. +2 −6 route/defs_darwin.go
  158. +3 −5 route/defs_dragonfly.go
  159. +2 −18 route/defs_freebsd.go
  160. +3 −5 route/defs_netbsd.go
  161. +2 −3 route/defs_openbsd.go
  162. +70 −0 route/example_darwin_test.go
  163. +1 −1 route/sys_netbsd.go
  164. +2 −6 route/zsys_darwin.go
  165. +3 −5 route/zsys_dragonfly.go
  166. +2 −18 route/zsys_freebsd_386.go
  167. +2 −18 route/zsys_freebsd_amd64.go
  168. +2 −18 route/zsys_freebsd_arm.go
  169. +2 −18 route/zsys_freebsd_arm64.go
  170. +2 −18 route/zsys_freebsd_riscv64.go
  171. +3 −5 route/zsys_netbsd.go
  172. +2 −3 route/zsys_openbsd.go
  173. +2 −8 webdav/file_test.go
  174. +3 −0 webdav/webdav.go
  175. +61 −2 webdav/webdav_test.go
  176. +2 −3 websocket/hybi.go
  177. +1 −1 websocket/hybi_test.go
  178. +6 −6 websocket/websocket.go
  179. +2 −3 xsrftoken/xsrf.go
4 changes: 2 additions & 2 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Copyright (c) 2009 The Go Authors. All rights reserved.
Copyright 2009 The Go Authors.

Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are
@@ -10,7 +10,7 @@ notice, this list of conditions and the following disclaimer.
copyright notice, this list of conditions and the following disclaimer
in the documentation and/or other materials provided with the
distribution.
* Neither the name of Google Inc. nor the names of its
* Neither the name of Google LLC nor the names of its
contributors may be used to endorse or promote products derived from
this software without specific prior written permission.

14 changes: 6 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
@@ -2,17 +2,15 @@

[![Go Reference](https://pkg.go.dev/badge/golang.org/x/net.svg)](https://pkg.go.dev/golang.org/x/net)

This repository holds supplementary Go networking libraries.
This repository holds supplementary Go networking packages.

## Download/Install
## Report Issues / Send Patches

The easiest way to install is to run `go get -u golang.org/x/net`. You can
also manually git clone the repository to `$GOPATH/src/golang.org/x/net`.
This repository uses Gerrit for code changes. To learn how to submit changes to
this repository, see https://go.dev/doc/contribute.

## Report Issues / Send Patches
The git repository is https://go.googlesource.com/net.

This repository uses Gerrit for code changes. To learn how to submit
changes to this repository, see https://golang.org/doc/contribute.html.
The main issue tracker for the net repository is located at
https://github.com/golang/go/issues. Prefix your issue with "x/net:" in the
https://go.dev/issues. Prefix your issue with "x/net:" in the
subject line, so it is easy to find.
4 changes: 2 additions & 2 deletions bpf/instructions_test.go
Original file line number Diff line number Diff line change
@@ -6,7 +6,7 @@ package bpf

import (
"fmt"
"io/ioutil"
"os"
"reflect"
"strconv"
"strings"
@@ -98,7 +98,7 @@ func TestInterop(t *testing.T) {
}
t.Logf("Assembled program is %d instructions long", len(out))

bs, err := ioutil.ReadFile(allInstructionsExpected)
bs, err := os.ReadFile(allInstructionsExpected)
if err != nil {
t.Fatalf("reading %s: %s", allInstructionsExpected, err)
}
112 changes: 100 additions & 12 deletions context/context.go
Original file line number Diff line number Diff line change
@@ -3,29 +3,31 @@
// license that can be found in the LICENSE file.

// Package context defines the Context type, which carries deadlines,
// cancelation signals, and other request-scoped values across API boundaries
// cancellation signals, and other request-scoped values across API boundaries
// and between processes.
// As of Go 1.7 this package is available in the standard library under the
// name context. https://golang.org/pkg/context.
// name [context], and migrating to it can be done automatically with [go fix].
//
// Incoming requests to a server should create a Context, and outgoing calls to
// servers should accept a Context. The chain of function calls between must
// propagate the Context, optionally replacing it with a modified copy created
// using WithDeadline, WithTimeout, WithCancel, or WithValue.
// Incoming requests to a server should create a [Context], and outgoing
// calls to servers should accept a Context. The chain of function
// calls between them must propagate the Context, optionally replacing
// it with a derived Context created using [WithCancel], [WithDeadline],
// [WithTimeout], or [WithValue].
//
// Programs that use Contexts should follow these rules to keep interfaces
// consistent across packages and enable static analysis tools to check context
// propagation:
//
// Do not store Contexts inside a struct type; instead, pass a Context
// explicitly to each function that needs it. The Context should be the first
// explicitly to each function that needs it. This is discussed further in
// https://go.dev/blog/context-and-structs. The Context should be the first
// parameter, typically named ctx:
//
// func DoSomething(ctx context.Context, arg Arg) error {
// // ... use ctx ...
// }
//
// Do not pass a nil Context, even if a function permits it. Pass context.TODO
// Do not pass a nil [Context], even if a function permits it. Pass [context.TODO]
// if you are unsure about which Context to use.
//
// Use context Values only for request-scoped data that transits processes and
@@ -34,9 +36,30 @@
// The same Context may be passed to functions running in different goroutines;
// Contexts are safe for simultaneous use by multiple goroutines.
//
// See http://blog.golang.org/context for example code for a server that uses
// See https://go.dev/blog/context for example code for a server that uses
// Contexts.
package context // import "golang.org/x/net/context"
//
// [go fix]: https://go.dev/cmd/go#hdr-Update_packages_to_use_new_APIs
package context

import (
"context" // standard library's context, as of Go 1.7
"time"
)

// A Context carries a deadline, a cancellation signal, and other values across
// API boundaries.
//
// Context's methods may be called by multiple goroutines simultaneously.
type Context = context.Context

// Canceled is the error returned by [Context.Err] when the context is canceled
// for some reason other than its deadline passing.
var Canceled = context.Canceled

// DeadlineExceeded is the error returned by [Context.Err] when the context is canceled
// due to its deadline passing.
var DeadlineExceeded = context.DeadlineExceeded

// Background returns a non-nil, empty Context. It is never canceled, has no
// values, and has no deadline. It is typically used by the main function,
@@ -49,8 +72,73 @@ func Background() Context {
// TODO returns a non-nil, empty Context. Code should use context.TODO when
// it's unclear which Context to use or it is not yet available (because the
// surrounding function has not yet been extended to accept a Context
// parameter). TODO is recognized by static analysis tools that determine
// whether Contexts are propagated correctly in a program.
// parameter).
func TODO() Context {
return todo
}

var (
background = context.Background()
todo = context.TODO()
)

// A CancelFunc tells an operation to abandon its work.
// A CancelFunc does not wait for the work to stop.
// A CancelFunc may be called by multiple goroutines simultaneously.
// After the first call, subsequent calls to a CancelFunc do nothing.
type CancelFunc = context.CancelFunc

// WithCancel returns a derived context that points to the parent context
// but has a new Done channel. The returned context's Done channel is closed
// when the returned cancel function is called or when the parent context's
// Done channel is closed, whichever happens first.
//
// Canceling this context releases resources associated with it, so code should
// call cancel as soon as the operations running in this [Context] complete.
func WithCancel(parent Context) (ctx Context, cancel CancelFunc) {
return context.WithCancel(parent)
}

// WithDeadline returns a derived context that points to the parent context
// but has the deadline adjusted to be no later than d. If the parent's
// deadline is already earlier than d, WithDeadline(parent, d) is semantically
// equivalent to parent. The returned [Context.Done] channel is closed when
// the deadline expires, when the returned cancel function is called,
// or when the parent context's Done channel is closed, whichever happens first.
//
// Canceling this context releases resources associated with it, so code should
// call cancel as soon as the operations running in this [Context] complete.
func WithDeadline(parent Context, d time.Time) (Context, CancelFunc) {
return context.WithDeadline(parent, d)
}

// WithTimeout returns WithDeadline(parent, time.Now().Add(timeout)).
//
// Canceling this context releases resources associated with it, so code should
// call cancel as soon as the operations running in this [Context] complete:
//
// func slowOperationWithTimeout(ctx context.Context) (Result, error) {
// ctx, cancel := context.WithTimeout(ctx, 100*time.Millisecond)
// defer cancel() // releases resources if slowOperation completes before timeout elapses
// return slowOperation(ctx)
// }
func WithTimeout(parent Context, timeout time.Duration) (Context, CancelFunc) {
return context.WithTimeout(parent, timeout)
}

// WithValue returns a derived context that points to the parent Context.
// In the derived context, the value associated with key is val.
//
// Use context Values only for request-scoped data that transits processes and
// APIs, not for passing optional parameters to functions.
//
// The provided key must be comparable and should not be of type
// string or any other built-in type to avoid collisions between
// packages using context. Users of WithValue should define their own
// types for keys. To avoid allocating when assigning to an
// interface{}, context keys often have concrete type
// struct{}. Alternatively, exported context key variables' static
// type should be a pointer or interface.
func WithValue(parent Context, key, val interface{}) Context {
return context.WithValue(parent, key, val)
}
Loading