Skip to content
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

URL: Added some host-canonicalization tests. #771

Merged
merged 1 commit into from Mar 20, 2014
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
71 changes: 71 additions & 0 deletions url/urltestdata.txt
Expand Up @@ -248,3 +248,74 @@ test.txt s:http h:www.example.com p:/test.txt
../../test.txt s:http h:www.example.com p:/test.txt
\u4E2D/test.txt s:http h:www.example.com p:/%E4%B8%AD/test.txt
http://www.example2.com s:http h:www.example2.com p:/

# Based on http://trac.webkit.org/browser/trunk/LayoutTests/fast/url/host.html

# Basic canonicalization, uppercase should be converted to lowercase
http://ExAmPlE.CoM http://other.com/ s:http p:/ h:example.com

# Spaces should fail
http://example\sexample.com

# This should fail
http://Goo%20\sgoo%7C|.com

# This should fail
http://GOO\u00a0\u3000goo.com

# Other types of space (no-break, zero-width, zero-width-no-break) are
# name-prepped away to nothing.
http://GOO\u200b\u2060\ufeffgoo.com s:http p:/ h:googoo.com

# Ideographic full stop (full-width period for Chinese, etc.) should be
# treated as a dot.
http://www.foo\u3002bar.com s:http p:/ h:www.foo.bar.com

# Invalid unicode characters should fail...
http://\ufdd0zyx.com

# ...This is the same as previous but with with escaped.
http://%ef%b7%90zyx.com

# Test name prepping, fullwidth input should be converted to ASCII and NOT
# IDN-ized. This is "Go" in fullwidth UTF-8/UTF-16.
http://\uff27\uff4f.com s:http p:/ h:go.com

# URL spec forbids the following.
# https://www.w3.org/Bugs/Public/show_bug.cgi?id=24257
http://\uff05\uff14\uff11.com
http://%ef%bc%85%ef%bc%94%ef%bc%91.com

# ...%00 in fullwidth should fail (also as escaped UTF-8 input)
http://\uff05\uff10\uff10.com
http://%ef%bc%85%ef%bc%90%ef%bc%90.com

# Basic IDN support, UTF-8 and UTF-16 input should be converted to IDN
http://\u4f60\u597d\u4f60\u597d s:http p:/ h:xn--6qqa088eba

# Invalid escaped characters should fail and the percents should be
# escaped. https://www.w3.org/Bugs/Public/show_bug.cgi?id=24191
http://%zz%66%a.com

# If we get an invalid character that has been escaped.
http://%25
http://hello%00

# Escaped numbers should be treated like IP addresses if they are.
http://%30%78%63%30%2e%30%32%35%30.01 s:http p:/ h:127.0.0.1
http://%30%78%63%30%2e%30%32%35%30.01%2e

# Invalid escaping should trigger the regular host error handling.
http://%3g%78%63%30%2e%30%32%35%30%2E.01

# Something that isn't exactly an IP should get treated as a host and
# spaces escaped.
http://192.168.0.1\shello

# Fullwidth and escaped UTF-8 fullwidth should still be treated as IP.
# These are "0Xc0.0250.01" in fullwidth.
http://\uff10\uff38\uff43\uff10\uff0e\uff10\uff12\uff15\uff10\uff0e\uff10\uff11 s:http p:/ h:192.168.0.1

# Broken IP addresses.
http://192.168.0.257
http://[google.com]