libfetch: parse scheme://domain:/ correctly

This improves URL-parsing compability with cURL, and unbreaks parsing of
similar kinds of URLs after commit 8d9de5b10a.

Sponsored by:	Juniper Networks, Inc.
Reviewed by:	des
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D44493
This commit is contained in:
Ka Ho Ng 2024-03-25 16:10:42 -04:00
parent 3bd637afbd
commit fb860ed0c5

View File

@ -426,7 +426,7 @@ fetchParseURL(const char *URL)
goto ouch;
}
}
if (n < 1 || n > IPPORT_MAX)
if (p != q && (n < 1 || n > IPPORT_MAX))
goto ouch;
u->port = n;
p = q;