Daijiro Wachi
8 years ago
committed by
Timothy Gu
No known key found for this signature in database
GPG Key ID: 7FE6B095B582B0D4
2 changed files with
105 additions and
4 deletions
-
src/node_url.cc
-
test/fixtures/url-tests.js
|
|
@ -1169,6 +1169,7 @@ void URL::Parse(const char* input, |
|
|
|
|
|
|
|
while (p <= end) { |
|
|
|
const char ch = p < end ? p[0] : kEOL; |
|
|
|
const size_t remaining = end == p ? 0 : (end - p - 1); |
|
|
|
|
|
|
|
if (IsASCIITabOrNewline(ch)) { |
|
|
|
if (state == kAuthority) { |
|
|
@ -1653,9 +1654,10 @@ void URL::Parse(const char* input, |
|
|
|
state = kFragment; |
|
|
|
break; |
|
|
|
default: |
|
|
|
if ((!IsWindowsDriveLetter(ch, p[1]) || |
|
|
|
end - p == 1 || |
|
|
|
(p[2] != '/' && |
|
|
|
if ((remaining == 0 || |
|
|
|
!IsWindowsDriveLetter(ch, p[1]) || |
|
|
|
(remaining >= 2 && |
|
|
|
p[2] != '/' && |
|
|
|
p[2] != '\\' && |
|
|
|
p[2] != '?' && |
|
|
|
p[2] != '#'))) { |
|
|
|
|
|
@ -1,7 +1,7 @@ |
|
|
|
'use strict'; |
|
|
|
|
|
|
|
/* WPT Refs: |
|
|
|
https://github.com/w3c/web-platform-tests/blob/3afae94/url/urltestdata.json
|
|
|
|
https://github.com/w3c/web-platform-tests/blob/28541bb/url/urltestdata.json
|
|
|
|
License: http://www.w3.org/Consortium/Legal/2008/04-testsuite-copyright.html
|
|
|
|
*/ |
|
|
|
module.exports = |
|
|
@ -5430,6 +5430,105 @@ module.exports = |
|
|
|
"search": "?chai", |
|
|
|
"hash": "" |
|
|
|
}, |
|
|
|
"# Windows drive letter handling with the 'file:' base URL", |
|
|
|
{ |
|
|
|
"input": "C|", |
|
|
|
"base": "file://host/dir/file", |
|
|
|
"href": "file:///C:", |
|
|
|
"protocol": "file:", |
|
|
|
"username": "", |
|
|
|
"password": "", |
|
|
|
"host": "", |
|
|
|
"hostname": "", |
|
|
|
"port": "", |
|
|
|
"pathname": "/C:", |
|
|
|
"search": "", |
|
|
|
"hash": "" |
|
|
|
}, |
|
|
|
{ |
|
|
|
"input": "C|#", |
|
|
|
"base": "file://host/dir/file", |
|
|
|
"href": "file:///C:#", |
|
|
|
"protocol": "file:", |
|
|
|
"username": "", |
|
|
|
"password": "", |
|
|
|
"host": "", |
|
|
|
"hostname": "", |
|
|
|
"port": "", |
|
|
|
"pathname": "/C:", |
|
|
|
"search": "", |
|
|
|
"hash": "" |
|
|
|
}, |
|
|
|
{ |
|
|
|
"input": "C|?", |
|
|
|
"base": "file://host/dir/file", |
|
|
|
"href": "file:///C:?", |
|
|
|
"protocol": "file:", |
|
|
|
"username": "", |
|
|
|
"password": "", |
|
|
|
"host": "", |
|
|
|
"hostname": "", |
|
|
|
"port": "", |
|
|
|
"pathname": "/C:", |
|
|
|
"search": "", |
|
|
|
"hash": "" |
|
|
|
}, |
|
|
|
{ |
|
|
|
"input": "C|/", |
|
|
|
"base": "file://host/dir/file", |
|
|
|
"href": "file:///C:/", |
|
|
|
"protocol": "file:", |
|
|
|
"username": "", |
|
|
|
"password": "", |
|
|
|
"host": "", |
|
|
|
"hostname": "", |
|
|
|
"port": "", |
|
|
|
"pathname": "/C:/", |
|
|
|
"search": "", |
|
|
|
"hash": "" |
|
|
|
}, |
|
|
|
{ |
|
|
|
"input": "C|\\", |
|
|
|
"base": "file://host/dir/file", |
|
|
|
"href": "file:///C:/", |
|
|
|
"protocol": "file:", |
|
|
|
"username": "", |
|
|
|
"password": "", |
|
|
|
"host": "", |
|
|
|
"hostname": "", |
|
|
|
"port": "", |
|
|
|
"pathname": "/C:/", |
|
|
|
"search": "", |
|
|
|
"hash": "" |
|
|
|
}, |
|
|
|
{ |
|
|
|
"input": "C", |
|
|
|
"base": "file://host/dir/file", |
|
|
|
"href": "file://host/dir/C", |
|
|
|
"protocol": "file:", |
|
|
|
"username": "", |
|
|
|
"password": "", |
|
|
|
"host": "host", |
|
|
|
"hostname": "host", |
|
|
|
"port": "", |
|
|
|
"pathname": "/dir/C", |
|
|
|
"search": "", |
|
|
|
"hash": "" |
|
|
|
}, |
|
|
|
{ |
|
|
|
"input": "C|a", |
|
|
|
"base": "file://host/dir/file", |
|
|
|
"href": "file://host/dir/C|a", |
|
|
|
"protocol": "file:", |
|
|
|
"username": "", |
|
|
|
"password": "", |
|
|
|
"host": "host", |
|
|
|
"hostname": "host", |
|
|
|
"port": "", |
|
|
|
"pathname": "/dir/C|a", |
|
|
|
"search": "", |
|
|
|
"hash": "" |
|
|
|
}, |
|
|
|
"# Windows drive letter quirk with not empty host", |
|
|
|
{ |
|
|
|
"input": "file://example.net/C:/", |
|
|
|