From ab39353eef48fda9ce6b28f96f004d132a0d94f5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dag-Erling=20Sm=C3=B8rgrav?= Date: Sun, 8 Jul 2001 15:59:15 +0000 Subject: [PATCH] Handle shemeless, hostless URLs correctly. --- lib/libfetch/fetch.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/lib/libfetch/fetch.c b/lib/libfetch/fetch.c index 720c745bb52d..303861a956bc 100644 --- a/lib/libfetch/fetch.c +++ b/lib/libfetch/fetch.c @@ -318,7 +318,7 @@ fetchParseURL(const char *URL) } else { p = URL; } - if (!*URL || *URL == '/') + if (!*URL || *URL == '/' || *URL == '.' || strchr(URL, '/') == NULL) goto nohost; p = strpbrk(URL, "/@"); @@ -335,8 +335,10 @@ fetchParseURL(const char *URL) u->pwd[i++] = *q; p++; - } else p = URL; - + } else { + p = URL; + } + /* hostname */ #ifdef INET6 if (*p == '[' && (q = strchr(p + 1, ']')) != NULL &&