Skip to content

Commit

Permalink
Make hostname state return early if a port is given
Browse files Browse the repository at this point in the history
Align with whatwg/url#604.
  • Loading branch information
TimothyGu authored and domenic committed Jun 8, 2021
1 parent 058fa4f commit f12bc66
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
2 changes: 1 addition & 1 deletion scripts/get-latest-platform-tests.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ process.on("unhandledRejection", err => {
// 1. Go to https://github.com/w3c/web-platform-tests/tree/master/url
// 2. Press "y" on your keyboard to get a permalink
// 3. Copy the commit hash
const commitHash = "b1fc334f29f80f3160e98a1fc479b0d44b54ffd8";
const commitHash = "67a580b4a11da1dca6c1195a2b670e361e4013c9";

const urlPrefix = `https://raw.githubusercontent.com/web-platform-tests/wpt/${commitHash}/url/`;
const targetDir = path.resolve(__dirname, "..", "test", "web-platform-tests");
Expand Down
7 changes: 4 additions & 3 deletions src/url-state-machine.js
Original file line number Diff line number Diff line change
Expand Up @@ -760,6 +760,10 @@ URLStateMachine.prototype["parse host"] = function parseHostName(c, cStr) {
return failure;
}

if (this.stateOverride === "hostname") {
return false;
}

const host = parseHost(this.buffer, isNotSpecial(this.url));
if (host === failure) {
return failure;
Expand All @@ -768,9 +772,6 @@ URLStateMachine.prototype["parse host"] = function parseHostName(c, cStr) {
this.url.host = host;
this.buffer = "";
this.state = "port";
if (this.stateOverride === "hostname") {
return false;
}
} else if (isNaN(c) || c === p("/") || c === p("?") || c === p("#") ||
(isSpecial(this.url) && c === p("\\"))) {
--this.pointer;
Expand Down

0 comments on commit f12bc66

Please sign in to comment.