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: empty port for ":port" causes it to default to 0 #14836

Closed
0xmohit opened this issue Mar 16, 2016 · 3 comments

Comments

Projects
None yet
4 participants
@0xmohit
Copy link
Contributor

commented Mar 16, 2016

  1. What version of Go are you using (go version)?
    go version go1.6 linux/amd64
  2. What operating system and processor architecture are you using (go env)?
    GOARCH="amd64"
    GOBIN=""
    GOEXE=""
    GOHOSTARCH="amd64"
    GOHOSTOS="linux"
    GOOS="linux"
    GOPATH=""
    GORACE=""
    GOROOT="/usr/local/go"
    GOTOOLDIR="/usr/local/go/pkg/tool/linux_amd64"
    GO15VENDOREXPERIMENT="1"
    CC="gcc"
    GOGCCFLAGS="-fPIC -m64 -pthread -fmessage-length=0"
    CXX="g++"
    CGO_ENABLED="1"
  3. What did you do?
    Try https://golang.org/pkg/net/http/#Get with an URL such as https://golang.org:
    Playground link: http://play.golang.org/p/sKElWJHkz- (Won't execute on the playground due to restrictions.)
  4. What did you expect to see?
    No error. A response something to this effect:
    2016/03/16 08:00:00 resp: &{GET https://golang.org HTTP/1.1 1 1 map[] <nil> 0 [] false golang.org map[] map[] <nil> map[] <nil> <nil>}
    Quoting from http://tools.ietf.org/html/rfc3986#section-6.2.3, an
    explicit ":port", for which the port is empty or the default for the
    scheme, is equivalent to one where the port and its ":" delimiter are
    elided and thus should be removed by scheme-based normalization
    .
  5. What did you see instead?
    2016/03/16 08:00:00 err: Get https://golang.org:: dial tcp 216.58.196.209:0: i/o timeout exit status 1
    (Note that it's attempting to connect to port 0.)
@odeke-em

This comment has been minimized.

Copy link
Member

commented Mar 19, 2016

I've taken a stab at this with CL https://go-review.googlesource.com/20903.

@gopherbot

This comment has been minimized.

Copy link

commented Mar 19, 2016

CL https://golang.org/cl/20903 mentions this issue.

@gopherbot

This comment has been minimized.

Copy link

commented Apr 16, 2016

CL https://golang.org/cl/22140 mentions this issue.

@gopherbot gopherbot closed this in 26ecb42 Apr 16, 2016

@golang golang locked and limited conversation to collaborators Apr 17, 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.