Olivier Mengué
70576f07de
http/httpproxy: godoc fixes
...
Doc improvements:
- use godoc link to net/http
- link use go.dev instead of golang.org
- fix typo in ProxyFunc doc
Change-Id: I7be0ebc78b3c34bc50fac6edc2c20a713478a315
Reviewed-on: https://go-review.googlesource.com/c/net/+/757980
Auto-Submit: Nicholas Husin <nsh@golang.org >
Reviewed-by: Nicholas Husin <nsh@golang.org >
Reviewed-by: Nicholas Husin <husin@google.com >
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com >
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com >
2026-03-24 07:44:58 -07:00
Dmitri Shuralyov
29181b8c03
all: remove go1.25 and older build constraints
...
Now that the x/net module requires Go 1.25.0,
the go1.25 build constraint is always satisfied.
Simplify the code accordingly.
Change-Id: I3d6fe4a132a26918455489b998730b494f5273c4
Reviewed-on: https://go-review.googlesource.com/c/net/+/744800
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com >
Auto-Submit: Dmitri Shuralyov <dmitshur@golang.org >
Reviewed-by: Nicholas Husin <nsh@golang.org >
Reviewed-by: Nicholas Husin <husin@google.com >
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com >
2026-02-12 07:53:52 -08:00
Damien Neil
cde1dda944
proxy, http/httpproxy: do not mismatch IPv6 zone ids against hosts
...
When matching against a host "example.com",
don't match an IPv6 address like "[1000::1%25.example.com]:80".
Thanks to Juho Forsén of Mattermost for reporting this issue.
Fixes CVE-2025-22870
For #71984
Change-Id: I0c4fdf18765decc27e6ddf220ebe3a9bf4a6454d
Reviewed-on: https://go-review.googlesource.com/c/net/+/654697
Auto-Submit: Roland Shoemaker <roland@golang.org >
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com >
Commit-Queue: Roland Shoemaker <roland@golang.org >
Reviewed-by: Roland Shoemaker <roland@golang.org >
Reviewed-by: Damien Neil <dneil@google.com >
2025-03-04 11:00:06 -08:00
胡玮文
8c07e20f92
httpproxy: allow any scheme
...
currently only http/https/socks5 scheme are allowed. However, any scheme
could be possible if user provides their own implementation.
Specifically, the widely used "socks5h://localhost" is parsed as
Scheme="http" Host="socks5h:", which does not make sense because host
name cannot contain ":".
This patch allows any scheme to appear in the proxy config. And only
fallback to http scheme if parsed scheme or host is empty.
url.Parse() result of fallback cases:
localhost => Scheme="localhost"
localhost:1234 => Scheme="localhost" Opaque="1234"
example.com => Path="example.com"
Updates golang/go#24135
Change-Id: Ia2c041e37e2ac61be16220fd41d6cb6fabeeca3d
Reviewed-on: https://go-review.googlesource.com/c/net/+/525257
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com >
Run-TryBot: Damien Neil <dneil@google.com >
Reviewed-by: Michael Knyszek <mknyszek@google.com >
Reviewed-by: Damien Neil <dneil@google.com >
TryBot-Result: Gopher Robot <gobot@golang.org >
Auto-Submit: Damien Neil <dneil@google.com >
2024-03-08 01:59:37 +00:00
Dmitri Shuralyov
d23d9bc549
all: update go directive to 1.18
...
Done with:
go get go@1.18
go mod tidy
go fix ./...
Using go1.21.3.
With a manual change to keep golang.org/x/net/context testing itself,
not context in the standard library.
For golang/go#60268 .
Change-Id: I00682bf7cf1e3ba4370e2a3e7f63dc245b294a36
Reviewed-on: https://go-review.googlesource.com/c/net/+/534241
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: Dmitri Shuralyov <dmitshur@golang.org >
2023-10-11 21:58:12 +00:00
Sean Liao
1e95f45603
http/httpproxy: remove comment on https proxy precedance
...
For golang/go#40909
For golang/go#54890
Change-Id: I1de1803f8fd00f54290404a8760d9f704ff766c3
Reviewed-on: https://go-review.googlesource.com/c/net/+/428795
Auto-Submit: Damien Neil <dneil@google.com >
Run-TryBot: Damien Neil <dneil@google.com >
Reviewed-by: Damien Neil <dneil@google.com >
TryBot-Result: Gopher Robot <gobot@golang.org >
Reviewed-by: Michael Knyszek <mknyszek@google.com >
2022-09-07 13:56:53 +00:00
Shiming Zhang
de3da57026
net/http/httpproxy: support non-ASCII characters in NO_PROXY
...
Change-Id: I4b3a97a2046fcc2619535a508c9d71ffa4ca75df
GitHub-Last-Rev: 5e2316523c
GitHub-Pull-Request: golang/net#105
Reviewed-on: https://go-review.googlesource.com/c/net/+/326269
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org >
Trust: Brad Fitzpatrick <bradfitz@golang.org >
Trust: Damien Neil <dneil@google.com >
Run-TryBot: Damien Neil <dneil@google.com >
TryBot-Result: Gopher Robot <gobot@golang.org >
2022-03-25 17:00:49 +00:00
Alexander Yastrebov
c6ed85c7a1
http/httpproxy: document all loopbacks are special cased not just localhost
...
Fixes golang/go#33695
Change-Id: I2f7598da7c6fda161ba357a75bba72de2fee8226
GitHub-Last-Rev: 443dbb13b1
GitHub-Pull-Request: golang/net#116
Reviewed-on: https://go-review.googlesource.com/c/net/+/356510
Reviewed-by: Damien Neil <dneil@google.com >
Trust: Damien Neil <dneil@google.com >
Trust: Cherry Mui <cherryyz@google.com >
Run-TryBot: Damien Neil <dneil@google.com >
2021-10-19 23:23:29 +00:00
Russ Cox
5f55cee0dc
all: go fmt ./...
...
Make all our package sources use Go 1.17 gofmt format
(adding //go:build lines).
Not strictly necessary but will avoid spurious changes
as files are edited.
Part of //go:build change (#41184 ).
See https://golang.org/design/draft-gobuild
Change-Id: I5b2b7d93424e828a3c5f76ae3f30ab825aca388e
Reviewed-on: https://go-review.googlesource.com/c/net/+/294371
Trust: Russ Cox <rsc@golang.org >
Run-TryBot: Russ Cox <rsc@golang.org >
TryBot-Result: Go Bot <gobot@golang.org >
Reviewed-by: Jason A. Donenfeld <Jason@zx2c4.com >
Reviewed-by: Ian Lance Taylor <iant@golang.org >
2021-02-20 03:31:24 +00:00
Michael Fraenkel
7b1cca2348
http/httpproxy: match http scheme when selecting http_proxy
...
Protocol specific proxies must match based on scheme.
If the https proxy is no configured, and the proxy for a https URL is
requested, no proxy should be returned.
Updates golang/go#40909
Change-Id: I62dfcf95d819c634e8f2862e891877a4eb55fca7
Reviewed-on: https://go-review.googlesource.com/c/net/+/249440
Trust: Brad Fitzpatrick <bradfitz@golang.org >
Reviewed-by: Damien Neil <dneil@google.com >
2020-10-16 16:51:38 +00:00
Michael Fraenkel
c21de06aaf
http/httpproxy: support CIDR notation and ports with NO_PROXY
...
NO_PROXY includes support for CIDR, and notations can also
match exactly on port information if provided.
When specifying a port with IPv6, the address must be enclosed with
square brackets, [IPv6 address]:port.
Updates golang/go#16704 (fixes after vendor into std)
Change-Id: Ideb61a9ec60a6b1908f5a2c885cd6d9dd10c37cf
Reviewed-on: https://go-review.googlesource.com/115255
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org >
2018-07-09 17:18:25 +00:00
Brad Fitzpatrick
fc492d2e10
http/httpproxy: fix build on Go 1.8
...
Go 1.8 doesn't have t.Helper.
Fix the row of red on the dashboard.
Change-Id: I85d4bb9fe38e989dc3b6a4e99705599745b83cef
Reviewed-on: https://go-review.googlesource.com/80140
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org >
Reviewed-by: Tom Bergan <tombergan@google.com >
TryBot-Result: Gobot Gobot <gobot@golang.org >
2017-11-28 02:42:22 +00:00
Roger Peppe
c7086645de
http/httpproxy: new package
...
This factors out the HTTP proxy functionality from net/http,
with a view to vendoring it into net/http later.
See discussion in https://go-review.googlesource.com/c/go/+/68091
Change-Id: I8df8a92a13bca03504edd24b71a9a184f290b87d
Reviewed-on: https://go-review.googlesource.com/76910
Reviewed-by: roger peppe <rogpeppe@gmail.com >
2017-11-23 08:18:56 +00:00