-
Notifications
You must be signed in to change notification settings - Fork 18.8k
Closed
Labels
Milestone
Description
by Jens.Alfke:
url.Parse behaves incorrectly on a URL with an empty hostname, e.g. "file:///foo". This URL is equivalent to "file://localhost/foo";, but the resulting URL's Path will incorrectly be "///foo" instead of "/foo". What steps will reproduce the problem? Run http://play.golang.org/p/CJJ1OU8QRq The body of this is: url, _ := url.Parse("file://localhost/foo/bar";) fmt.Printf("When URL host is %q, path is %q\n", url.Host, url.Path) url, _ = url.Parse("file:///foo/bar") fmt.Printf("When URL host is %q, path is %q\n", url.Host, url.Path) What is the expected output? When URL host is "localhost", path is "/foo/bar" When URL host is "", path is "/foo/bar" What do you see instead? When URL host is "localhost", path is "/foo/bar" When URL host is "", path is "///foo/bar" Which compiler are you using (5g, 6g, 8g, gccgo)? 6g, I think (just using "go run") Which operating system are you using? Mac OS X 10.8.2 Which version are you using? (run 'go version') 1.0.3