diff options
author | Daijiro Wachi <daijiro.wachi@gmail.com> | 2017-05-03 09:24:42 +0200 |
---|---|---|
committer | Timothy Gu <timothygu99@gmail.com> | 2017-05-04 18:20:45 -0700 |
commit | 943dd5f9ed1857d9f04cdca77ed5139d69918173 (patch) | |
tree | ba5960be629eee4ec934c4ca57178596228733fc /src/node_url.cc | |
parent | 0258aed9d293aa0c72e95878b6c00af9633ad080 (diff) | |
download | android-node-v8-943dd5f9ed1857d9f04cdca77ed5139d69918173.tar.gz android-node-v8-943dd5f9ed1857d9f04cdca77ed5139d69918173.tar.bz2 android-node-v8-943dd5f9ed1857d9f04cdca77ed5139d69918173.zip |
url: handle windows drive letter in the file state
`C|` should not satisfy the condition to not copy
the base's path. It also synchronises WPT url test data
to verify the update in upstream.
PR-URL: https://github.com/nodejs/node/pull/12808
Refs: https://github.com/whatwg/url/pull/305
Refs: https://github.com/w3c/web-platform-tests/pull/5754
Reviewed-By: Refael Ackermann <refack@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
Reviewed-By: Timothy Gu <timothygu99@gmail.com>
Diffstat (limited to 'src/node_url.cc')
-rw-r--r-- | src/node_url.cc | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/src/node_url.cc b/src/node_url.cc index 50a9380d37..2bdc080953 100644 --- a/src/node_url.cc +++ b/src/node_url.cc @@ -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] != '#'))) { |