From 6b57ea33463790bd702f14b62244f284325f8a10 Mon Sep 17 00:00:00 2001 From: Francesco Cozzuto Date: Fri, 5 Dec 2025 15:13:19 +0100 Subject: [PATCH] Set username, password, host, port to empty if the URL is missing the authority --- url.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/url.c b/url.c index c237c31..b32f77e 100644 --- a/url.c +++ b/url.c @@ -357,7 +357,6 @@ int url_parse(char *src, int len, int *pcur, URL *out) if (cur < len && (is_userinfo(src[cur]) || src[cur] == ':')) { int user_off = cur; - cur++; while (cur < len) { if (is_userinfo(src[cur])) @@ -489,6 +488,13 @@ int url_parse(char *src, int len, int *pcur, URL *out) out->port = out->port * 10 + n; } } + } else { + out->username = EMPTY; + out->password = EMPTY; + out->host_text = EMPTY; + out->host_type = URL_HOST_EMPTY; + out->port = 0; + out->no_port = 1; } // Now we parse the path. This is most difficult