diff options
author | des <des@FreeBSD.org> | 2001-07-08 15:59:15 +0000 |
---|---|---|
committer | des <des@FreeBSD.org> | 2001-07-08 15:59:15 +0000 |
commit | 0ca9dbc9d1bc8d4221d6ba0a477a6de26e1416a5 (patch) | |
tree | 28265c5d1852cae03d5898da5596f32c7caf6386 /lib/libfetch/fetch.c | |
parent | edbf7599a6a4d95c2a3c4e5ee631a2f73b7e763b (diff) | |
download | FreeBSD-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.c | 8 |
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 && |