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

(cherry picked from commit fb860ed0c5)
This commit is contained in:
Ka Ho Ng 2024-03-25 16:10:42 -04:00
parent 223077d0a8
commit c89889b9c3

View File

@ -427,7 +427,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;