From c89889b9c342e764e39b351d5024a4ba3429fb15 Mon Sep 17 00:00:00 2001 From: Ka Ho Ng Date: Mon, 25 Mar 2024 16:10:42 -0400 Subject: [PATCH] libfetch: parse scheme://domain:/ correctly This improves URL-parsing compability with cURL, and unbreaks parsing of similar kinds of URLs after commit 8d9de5b10a24. Sponsored by: Juniper Networks, Inc. Reviewed by: des MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D44493 (cherry picked from commit fb860ed0c52c2c1e7792ef86718620a439663c7f) --- lib/libfetch/fetch.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/libfetch/fetch.c b/lib/libfetch/fetch.c index 135ee8dad151..8cb3536a46c5 100644 --- a/lib/libfetch/fetch.c +++ b/lib/libfetch/fetch.c @@ -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;