aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Stenberg <daniel@haxx.se>2010-09-21 19:51:30 +0200
committerDaniel Stenberg <daniel@haxx.se>2010-09-21 19:51:30 +0200
commit8665d4e593c853dbcc83a0c6ba92b77d9e5bcd7e (patch)
tree74abfa7385a8ad8304a679d2a20220b528a77fe4
parent0e36bb71f2cee03ac5c63808acfdec4f7fe46768 (diff)
parse_remote_port: ignore colons without port number
Obviously, browsers ignore a colon without a following port number. Both Firefox and Chrome just removes the colon for such URLs. This change does not remove the colon for URLs sent over a HTTP proxy, so we should consider doing that change as well. Reported by: github user 'kreshano'
-rw-r--r--lib/url.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/lib/url.c b/lib/url.c
index 133418681..7fe713d3e 100644
--- a/lib/url.c
+++ b/lib/url.c
@@ -4319,6 +4319,11 @@ static CURLcode parse_remote_port(struct SessionHandle *data,
*portptr = '\0'; /* cut off the name there */
conn->remote_port = curlx_ultous(port);
}
+ else if(!port)
+ /* Browser behavior adaptation. If there's a colon with no digits after,
+ just cut off the name there which makes us ignore the colon and just
+ use the default port. Firefox and Chrome both do that. */
+ *portptr = '\0';
}
return CURLE_OK;
}