Skip to content

net/url: Parse not working correctly for a non absolute URL with port. #22955

@zbindenren

Description

@zbindenren

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

go version go1.9.1 linux/amd64

Does this issue reproduce with the latest release?

Yes: https://play.golang.org/p/yoLxXnHE1J

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

GOARCH="amd64"
GOBIN=""
GOEXE=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOOS="linux"
GOPATH="/home/rz/golang"
GORACE=""
GOROOT="/home/rz/.gimme/versions/go1.9.1.linux.amd64"
GOTOOLDIR="/home/rz/.gimme/versions/go1.9.1.linux.amd64/pkg/tool/linux_amd64"
GCCGO="gccgo"
CC="gcc"
GOGCCFLAGS="-fPIC -m64 -pthread -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build155424131=/tmp/go-build -gno-record-gcc-switches"
CXX="g++"
CGO_ENABLED="1"
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"

What did you do?

url.Parse not working for relative url with port.

When parsing www.example.com:443, IsAbs returns true, and port is empty.

https://play.golang.org/p/yoLxXnHE1J

What did you expect to see?

IsAbs returns false.

What did you see instead?

IsAbs returns true.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions