summaryrefslogtreecommitdiffstats
path: root/lib/libfetch/fetch.c
diff options
context:
space:
mode:
authordes <des@FreeBSD.org>2001-07-08 15:59:15 +0000
committerdes <des@FreeBSD.org>2001-07-08 15:59:15 +0000
commit0ca9dbc9d1bc8d4221d6ba0a477a6de26e1416a5 (patch)
tree28265c5d1852cae03d5898da5596f32c7caf6386 /lib/libfetch/fetch.c
parentedbf7599a6a4d95c2a3c4e5ee631a2f73b7e763b (diff)
downloadFreeBSD-src-0ca9dbc9d1bc8d4221d6ba0a477a6de26e1416a5.zip
FreeBSD-src-0ca9dbc9d1bc8d4221d6ba0a477a6de26e1416a5.tar.gz
Handle shemeless, hostless URLs correctly.
Diffstat (limited to 'lib/libfetch/fetch.c')
-rw-r--r--lib/libfetch/fetch.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/lib/libfetch/fetch.c b/lib/libfetch/fetch.c
index 720c745..303861a 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 &&
OpenPOWER on IntegriCloud