Bug 55683 - KURL parses Windows-style absolute file: URLs incorrectly
Summary: KURL parses Windows-style absolute file: URLs incorrectly
Status: RESOLVED DUPLICATE of bug 162660
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebCore Misc. (show other bugs)
Version: 528+ (Nightly build)
Hardware: PC Windows XP
: P2 Normal
Assignee: Nobody
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2011-03-03 09:27 PST by Adam Roben (:aroben)
Modified: 2016-12-05 11:56 PST (History)
6 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Adam Roben (:aroben) 2011-03-03 09:27:21 PST
Given a URL string like this:

file://c:\foo\bar

KURL will parse it into:

file://c/foo/bar

Note that the colon has disappeared. During parsing, KURL treats the colon as introducing a port number, then sees no port and just ignores it.

A URL string like "file://localhost/c:\foo\bar" will be parsed correctly into "file://c:/foo/bar", however.
Comment 1 Alexey Proskuryakov 2011-03-03 09:33:08 PST
Is this a regression, and is it normally observable?
Comment 2 Adam Roben (:aroben) 2011-03-03 09:35:45 PST
I don't think it's a regression.

It is observable in APIs like WKURLCreateWithUTF8CString correctly for Windows-style paths. See the workaround added in bug 55674, e.g.
Comment 3 Adam Roben (:aroben) 2011-03-03 09:38:47 PST
I haven't tested whether it's a regression, though.
Comment 4 Adam Roben (:aroben) 2011-03-03 09:56:20 PST
(In reply to comment #2)
> It is observable in APIs like WKURLCreateWithUTF8CString correctly for Windows-style paths.

I meant: it is obvservable in APIs like WKURLCreateWithUTF8CString, which are thus made hard to use correctly for Windows-style file: URLs.
Comment 5 Alexey Proskuryakov 2011-03-03 10:06:21 PST
If it's a regression, then see also: bug 54090.
Comment 6 Eric Seidel (no email) 2011-03-03 10:15:05 PST
I don't think this is a regression.  file: urls are complicated, I've not done any work on them yet. :)  See related results in:
http://trac.webkit.org/browser/trunk/LayoutTests/fast/url/file-expected.txt
http://trac.webkit.org/browser/trunk/LayoutTests/fast/url/relative-win-expected.txt
Comment 7 Adam Roben (:aroben) 2011-03-03 10:17:06 PST
This result seems particularly relevant:

FAIL canonicalize('//c:/foo') should be file:///C:/foo. Was file://c/foo.
Comment 8 Adam Barth 2011-03-03 13:11:17 PST
File URLs are tricky.  Most browsers parse them differently depending on whether they're running on Windows.  Also, the three-slash versus two-slash question is pretty inconsistent.

In any case, eating the ":" is definitely wrong.
Comment 9 Brett Wilson (Google) 2011-03-03 13:48:34 PST
Chrome has extensive Windows-only filename parsing rules that closely match IE's behavior.

For some examples, see our unit tests:
http://code.google.com/p/google-url/source/browse/trunk/src/url_canon_unittest.cc
(search for "CanonicalizeFileURL" and you can see there is a big Windows-only block).
Comment 10 Adam Barth 2011-03-03 14:04:14 PST
(In reply to comment #9)
> Chrome has extensive Windows-only filename parsing rules that closely match IE's behavior.

We're also running those tests as LayoutTests:

http://trac.webkit.org/browser/trunk/LayoutTests/fast/url/script-tests/file.js
http://trac.webkit.org/browser/trunk/LayoutTests/fast/url/file-expected.txt
Comment 11 Jessie Berlin 2011-03-10 09:17:03 PST
<rdar://problem/9114971>
Comment 12 Alex Christensen 2016-12-05 11:56:36 PST
URLParsing is now done according to spec.
https://bugs.webkit.org/show_bug.cgi?id=162660

*** This bug has been marked as a duplicate of bug 162660 ***