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; }