-
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: add test of "Windows" file URL #6027
Labels
Milestone
Comments
We're not going to get to this for Go 1.2. It's not obvious to me what the fix is either. Should net/url's behavior really depend on which OS the program runs on? Does that mean you cannot manipulate Windows file URLs on Linux machines or vice versa? Labels changed: added go1.3, removed go1.2maybe. Status changed to Thinking. |
Leaving it as is results in easy to reason behaviour and avoids overcomplicated edge cases, as can be seen by the mkdir example above. I tested some other libraries handling of URIs/URLs (on Mac OS X 10.9) Python 2 and 3 >>> urlparse('http:///C:/Directory/') ParseResult(scheme='http', netloc='', path='/C:/Directory/', params='', query='', fragment='') >>> urlparse('http:///Directory/') ParseResult(scheme='http', netloc='', path='/Directory/', params='', query='', fragment='') >>> urlparse('http://www.google.com/') ParseResult(scheme='http', netloc='www.google.com', path='/', params='', query='', fragment='') Node.JS 0.10.26 > url.parse('file:///C:/Directory/').pathname '/C:/Directory/' > url.parse('http:///Directory/').pathname '/Directory/' > url.parse('http://www.google.com/').pathname '/' Java 1.6.0 (java.net.URL and getPath()) URL("file:///C:/Directory/"); // => /C:/Directory/ URL("file:///Directory/"); // => /Directory/ URL("http://www.google.com/"); // => / Mono 3.2.7 (System.Uri and AbsolutePath) uri = new Uri("file:///C:/Directory/"); // => C:/Directory/ uri = new Uri("file:///Directory/"); // => /Directory/ uri = new Uri("http://www.google.com/"); // => / Of these, only Mono (.Net in general?) will parse the URI differently, removing the leading '/'' infront of a drive letter. Given this and reading RFC3986 for Generic syntax for URI (http://tools.ietf.org/html/rfc3986), it is best to just treat the path as Go currently does. In addition, reading the file-scheme RFC draft (http://www.ietf.org/id/draft-kerwin-file-scheme or https://github.com/phluid61/file-uri-scheme) shows how many edge cases there can be if we start treating file-schemes, so it might be hard to draw the line for file-scheme Path parsing? Can we just let the Path be the path as specified by RFC 3986 (in decoded form as the documentation in net/url states)? In my view, the current behaviour matches Go's least-surprise property. |
This issue was closed by revision 844b625. Status changed to Fixed. |
This issue was closed.
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
by mitchell.hashimoto:
The text was updated successfully, but these errors were encountered: