Bug 162885 - Add tests verifying non-special URL hosts are parsed according to spec
Summary: Add tests verifying non-special URL hosts are parsed according to spec
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: New Bugs (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Alex Christensen
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2016-10-03 18:43 PDT by Alex Christensen
Modified: 2016-10-04 16:17 PDT (History)
1 user (show)

See Also:


Attachments
Patch (1.92 KB, patch)
2016-10-03 18:43 PDT, Alex Christensen
sam: review+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Alex Christensen 2016-10-03 18:43:19 PDT
Add tests verifying non-special URL hosts are parsed according to spec
Comment 1 Alex Christensen 2016-10-03 18:43:31 PDT
Created attachment 290547 [details]
Patch
Comment 2 Alex Christensen 2016-10-03 18:48:08 PDT
The host parsing in https://url.spec.whatwg.org is a deviation from the behavior of Chrome, Firefox, and Safari, and there are no web platform tests verifying that non-special URLs are parsed the same as special URLs.

Try this in different browsers:
alert(new URL("notspecial://H%4fSt/path").toString())
It alerts "notspecial://H%4fSt/path" not "notspecial://host/path" as the spec says it should.  
Maybe I missed something in the spec, maybe the spec should be changed, or maybe it was intentional.
Comment 3 Anne van Kesteren 2016-10-04 01:36:36 PDT
Thanks, I filed https://github.com/whatwg/url/issues/148. I tend to think we should just change the standard.
Comment 4 Alex Christensen 2016-10-04 09:44:16 PDT
I agree.  It will increase compatibility.  But this means the fragment is no longer the only part of the URL that can have non-ASCII characters :(
Comment 5 Alex Christensen 2016-10-04 10:16:07 PDT
(In reply to comment #4)
> But this means the fragment is no longer the only part of the URL that can have non-ASCII characters :(
Oh, never mind.  non-ASCII characters are percent encoded.
Comment 6 Alex Christensen 2016-10-04 16:17:05 PDT
Nope, we don't want to percent encode things in the host.  I think the spec is right and all browsers are wrong for different reasons.  Everyone needs to change, ours is to punycode encode non-special hosts.
http://trac.webkit.org/changeset/206792