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

src, url: WHATWG URL C++ parser cleanup #11917

Closed
wants to merge 3 commits into from
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
src, url: clarify port state
TimothyGu committed Mar 30, 2017
commit 86d0a4bc31b2462802225e2110065585003b2988
16 changes: 12 additions & 4 deletions src/node_url.cc
Original file line number Diff line number Diff line change
@@ -996,14 +996,22 @@ namespace url {
int port = 0;
for (size_t i = 0; i < buffer.size(); i++)
port = port * 10 + buffer[i] - '0';
if (port >= 0 && port <= 0xffff) {
url->port = NormalizePort(url->scheme, port);
} else if (!has_state_override) {
url->flags |= URL_FLAGS_FAILED;
if (port < 0 || port > 0xffff) {
// TODO(TimothyGu): This hack is currently needed for the host
// setter since it needs access to hostname if it is valid, and
// if the FAILED flag is set the entire response to JS layer
// will be empty.
if (state_override == kHost)
url->port = -1;
else
url->flags |= URL_FLAGS_FAILED;
return;
}
url->port = NormalizePort(url->scheme, port);
buffer.clear();
}
if (has_state_override)
return;
state = kPathStart;
continue;
} else {