Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

net/http: returned typed error when proxy connection fails #16997

tcmichael opened this issue Sep 6, 2016 · 2 comments


None yet
5 participants
Copy link

commented Sep 6, 2016

Please answer these questions before submitting your issue. Thanks!

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

$go version
go version go1.6.2 darwin/amd64

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

$ go env
GOGCCFLAGS="-fPIC -m64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fno-common"

What did you do?

If possible, provide a recipe for reproducing the error.
A complete runnable program is good.
A link on is best.

package main

import (

func main() {
    proxy := ""
    tr := &http.Transport{
        Proxy: func(*http.Request) (*url.URL, error) {
            return url.Parse(proxy)
        Dial: (&net.Dialer{Timeout: 500 * time.Millisecond}).Dial,
    c := http.Client{Transport: tr}
    req, _ := http.NewRequest("GET", "", nil)
    _, err := c.Do(req)
    uerr, ok := err.(*url.Error)
    if ok {
        nerr, ok := uerr.Err.(*net.OpError)
        fmt.Println(ok, nerr)

What did you expect to see?

true, dial tcp i/o timeout".

I could find the Op of the error would be dial.
net/http/transport.go: 765 "err = fmt.Errorf("http: error connecting to proxy %s: %v", cm.proxyURL, err)".
That rewrites the error, and the details of the error are missing

What did you see instead?

false <nil>

@bradfitz bradfitz changed the title the error of connecting to proxy is not an assertion error net/error: returned typed error when proxy connection fails Sep 6, 2016

@bradfitz bradfitz added the help wanted label Sep 6, 2016

@bradfitz bradfitz added this to the Go1.8Maybe milestone Sep 6, 2016

@mikioh mikioh changed the title net/error: returned typed error when proxy connection fails net/http: returned typed error when proxy connection fails Oct 4, 2016


This comment has been minimized.

Copy link

commented Oct 8, 2016

Hey guys, if everyone is OK with that I'd like to take a stab at it


This comment has been minimized.

Copy link

commented Oct 8, 2016

CL mentions this issue.

@quentinmit quentinmit added the NeedsFix label Oct 10, 2016

@gopherbot gopherbot closed this in 61ffec4 Oct 31, 2016

@golang golang locked and limited conversation to collaborators Oct 31, 2017

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
You can’t perform that action at this time.