commit | a1613c223097a1c9817dd7112dc1cbe7f8245dd4 | [log] [tgz] |
---|---|---|
author | Leo Blöcher <leo.bloecher@gmail.com> | Sun Apr 23 16:55:56 2023 +0000 |
committer | Damien Neil <dneil@google.com> | Wed Jul 05 22:23:14 2023 +0000 |
tree | a6ef07ccf1ebc0c91cc99ba419f92744c1ce1cae | |
parent | c73c09c3904ce6a210970374bd1bc507ef1f8cc2 [diff] |
http2: handle trailing colon in authorityAddr This change modifies the authorityAddr result for authorities with empty port information, such as "example.com:". Previously, such authorities passed through the function unchanged. This conflicts with the result from net/http's canonicalAddr, which returns "example.com:443" (for HTTPS). net/http's canonicalAddr result is passed to http2's upgradeFn (defined inside http2.configureTransports) from net/http's (*Transport).dialConn. The connection is then added to http2's cache under the canonicalAddr key. However, cache lookups are performed in (*Transport).RoundTripOpt using the result from authorityAddr applied directly to the input URL. The lookup thus fails if authorityAddr and canonicalAddr don't agree. http2's lookup error propagates upwards to net/http's (*Transport).roundTrip, where the request is retried. The end result is an infinite loop of the request being repeated, each time with a freshly dialed connection, that can only be stopped by a timeout. Aligning the results of http2's authorityAddr and net/http's canonicalAddr fixes the bug. While an authority with a trailing colon is invalid per URL specifications, I have personally come across misconfigured web servers emitting such URLs as redirects. This is how I discovered this issue in http2. Change-Id: If47aa61b8d256d76a3451090076e6eb5ff596c9e GitHub-Last-Rev: cb0470115705139cfc60a3d27ec432363fd54a1c GitHub-Pull-Request: golang/net#170 Reviewed-on: https://go-review.googlesource.com/c/net/+/487915 Run-TryBot: Damien Neil <dneil@google.com> Reviewed-by: Dmitri Shuralyov <dmitshur@google.com> TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: Damien Neil <dneil@google.com>
This repository holds supplementary Go networking libraries.
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://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 subject line, so it is easy to find.