Skip to content

Commit

Permalink
fix: don't use configured proxy for unix socket (#7)
Browse files Browse the repository at this point in the history
* fix: don't use configured proxy for unix socket

* Update register.go

Co-authored-by: Peter Bourgon <peterbourgon@users.noreply.github.com>

* Update register.go

Co-authored-by: Peter Bourgon <peterbourgon@users.noreply.github.com>

---------

Co-authored-by: Peter Bourgon <peterbourgon@users.noreply.github.com>
  • Loading branch information
ae-govau and peterbourgon authored Feb 19, 2024
1 parent 9cfc47b commit 10197ac
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion register.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,13 @@ import (
// so uses the same configuration: timeouts, TLS settings, and so on. Connection
// pooling should also work as normal. One caveat: only the DialContext and
// DialTLSContext dialers are respected; the Dial and DialTLS dialers are
// explicitly removed and ignored.
// explicitly removed and ignored. Any configured Proxy is also discarded.
func Register(t *http.Transport) {
copy := t.Clone()

copy.Dial = nil //lint:ignore SA1019 yes, it's deprecated, that's the point
copy.DialTLS = nil //lint:ignore SA1019 yes, it's deprecated, that's the point
copy.Proxy = nil // Proxy doesn't support Unix sockets, so drop it

switch {
case copy.DialContext == nil && copy.DialTLSContext == nil:
Expand Down

0 comments on commit 10197ac

Please sign in to comment.