Skip to content

net/http: improve proxy handling #37623

Closed
@vlourme

Description

@vlourme

What version of Go are you using (go version)?

$ go version
go version go1.14 darwin/amd64

Does this issue reproduce with the latest release?

Yes

What operating system and processor architecture are you using (go env)?

go env Output
$ go env
GO111MODULE=""
GOARCH="amd64"
GOBIN=""
GOCACHE="/Users/vico/Library/Caches/go-build"
GOENV="/Users/vico/Library/Application Support/go/env"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="darwin"
GOINSECURE=""
GONOPROXY=""
GONOSUMDB=""
GOOS="darwin"
GOPATH="/Users/vico/go"
GOPRIVATE=""
GOPROXY="https://proxy.golang.org,direct"
GOROOT="/usr/local/go"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/usr/local/go/pkg/tool/darwin_amd64"
GCCGO="gccgo"
AR="ar"
CC="clang"
CXX="clang++"
CGO_ENABLED="1"
GOMOD=""
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"
GOGCCFLAGS="-fPIC -m64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=/var/folders/32/7qmymd5950b3nhv4dd7qbqkw0000gn/T/go-build036564932=/tmp/go-build -gno-record-gcc-switches -fno-common"

What did you do?

I'm running requests (using go-resty library, based on default HTTP client). This problem is I need to use proxies, some of proxies are dead (public proxies) and so, they don't answer the request.
I started learning Go not a long time ago, but when I was programming in C#, the proxy handling was good, I mean :

  • Most of proxies respond well. Here in Go, the proxy definition is sketchy (in my opinion). There is also no official way to put proxy with authentication (not sure?).
  • When a proxy is dead, it throws an error fast. Here in Go, it waits for the default page timeout, not a connect timeout or something.

What did you expect to see?

Proxy integration that respond better or that skips wrong/dead proxies faster.

What did you see instead?

Mainly performance losses, and when I use public proxies, Go seems not connecting to all proxies while some are really working.

(Original issue from go-resty: go-resty/resty#320)

Metadata

Metadata

Assignees

No one assigned

    Labels

    NeedsInvestigationSomeone must examine and confirm this is a valid issue and not a duplicate of an existing one.

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions