-
Notifications
You must be signed in to change notification settings - Fork 17.7k
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/url: first path segment in URL cannot contain colon. #19297
Comments
Working as intended I think. That is not a URL.
… On 27 Feb 2017, at 18:14, Eric Shi ***@***.***> wrote:
Description:
No Scheme, and the address format is ”IP: Port“ Address parsing failed.
OS Ver:
Mac OSX 10.12.3
Go Ver:
1.8
Go ENV:
GOARCH="amd64"
GOBIN=""
GOEXE=""
GOHOSTARCH="amd64"
GOHOSTOS="darwin"
GOOS="darwin"
GOPATH="/Users/shibingli/Develop/Go_Code/webconsole"
GORACE=""
GOROOT="/usr/local/go"
GOTOOLDIR="/usr/local/go/pkg/tool/darwin_amd64"
GCCGO="gccgo"
CC="clang"
GOGCCFLAGS="-fPIC -m64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=/var/folders/dy/lsbr_78131x3s9fjq15v8rg80000gn/T/go-build052845002=/tmp/go-build -gno-record-gcc-switches -fno-common"
CXX="clang++"
CGO_ENABLED="1"
PKG_CONFIG="pkg-config"
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
Code:
u, err := url.Parse("192.168.2.2:6688")
if nil != err {
panic(err)
}
fmt.Println(u.Host, u.Port())
Error:
panic: parse 192.168.2.2:6688: first path segment in URL cannot contain colon
goroutine 1 [running]:
main.main()
/Users/shibingli/Develop/Go_Code/webconsole/src/apibox.club/test/test.go:46 +0x138
Source:
https://github.com/golang/go/blob/release-branch.go1.8/src/net/url/url.go#L513
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub, or mute the thread.
|
I don't make sure but it seems fail when the host is IP. |
@mattn I think you're right。 Golang 1.7 version can do so. |
https://github.com/golang/go/blob/release-branch.go1.8/src/net/url/url.go#L500
|
In my opinion, this is not a bug because rfc3986 allow to use dot in scheme. |
@shibingli if you want to parse such string, please use |
@mattn Okay, I've done that. But I think it is normal to do that. |
@dsnet Thanks. |
A change made to the net/url library in go 1.8 causes a panic when starting kontrol: panic: parse 127.0.0.1:4001: first path segment in URL cannot contain colon This is caused by the fact that net/url no longer considers "127.0.0.1:4001" a valid URL because the specification allows for dots in the schema-part of the URL. * golang/go#19297
u, err := url.Parse("//192.168.2.2:6688") very ok |
ERROR: failed to parse http://ddmwebrevo.digdes.com/#/document/ca061121-8679-4afb-bf96-5aefdcac2dbf : parse http://ddmwebrevo.digdes.com/: first path segment in URL cannot contain colon |
@kirichenko Could you please show your minimal code to reproduce? |
I'm sorry. There was a typo in URL (space in the begining). |
Go will fail to parse this otherwise. golang/go#19297
Hi. I met the error: |
here is the url: is there something wrong |
This is a closed issue. Closed issues aren't tracked. For questions about Go, see https://golang.org/wiki/Questions. |
Description:
OS Ver:
Mac OSX 10.12.3
Go Ver:
1.8
Go ENV:
Code:
Error:
Source:
The text was updated successfully, but these errors were encountered: