diff options
author | des <des@FreeBSD.org> | 2000-12-13 11:26:27 +0000 |
---|---|---|
committer | des <des@FreeBSD.org> | 2000-12-13 11:26:27 +0000 |
commit | 5612c73391b08c6b3a883c7a470f44bc51e40ef3 (patch) | |
tree | a59a7ac2a6723ec0d2f2fe58077b391b443df072 /usr.bin/fetch/fetch.c | |
parent | ae0af0d011fe1231b7c46f671bec0ebf92af084d (diff) | |
download | FreeBSD-src-5612c73391b08c6b3a883c7a470f44bc51e40ef3.zip FreeBSD-src-5612c73391b08c6b3a883c7a470f44bc51e40ef3.tar.gz |
If the URL did not specify a scheme, try to guess it from the host name.
Diffstat (limited to 'usr.bin/fetch/fetch.c')
-rw-r--r-- | usr.bin/fetch/fetch.c | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/usr.bin/fetch/fetch.c b/usr.bin/fetch/fetch.c index c24d288..024d71e 100644 --- a/usr.bin/fetch/fetch.c +++ b/usr.bin/fetch/fetch.c @@ -197,6 +197,16 @@ fetch(char *URL, char *path) goto failure; } + /* if no scheme was specified, take a guess */ + if (!*url->scheme) { + if (!*url->host) + strcpy(url->scheme, SCHEME_FILE); + else if (strncasecmp(url->host, "ftp.", 4)) + strcpy(url->scheme, SCHEME_FTP); + else if (strncasecmp(url->host, "www.", 4)) + strcpy(url->scheme, SCHEME_HTTP); + } + timeout = 0; *flags = 0; count = 0; |