Skip to content

applyProxy() makes http/https/socks5 connection re-use impossible. #31

@sinylei

Description

@sinylei

When you set a proxy, applyProxy will recreate a new Transport. So the connection pool cached in original Transport object will be discarded.
So I changed applyProxy in request/proxy_go12.go as below and it works very well for me.

func applyProxy(a *Args) (err error) {
if a.Proxy == "" {
return nil
}

u, err := url.Parse(a.Proxy)
if err != nil {
	return err
}
switch u.Scheme {
case "http", "https", "socks5":
	a.Client.Transport.(*http.Transport).Proxy = http.ProxyURL(u)
}
return

}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions