diff options
author | ume <ume@FreeBSD.org> | 2000-05-15 09:05:36 +0000 |
---|---|---|
committer | ume <ume@FreeBSD.org> | 2000-05-15 09:05:36 +0000 |
commit | 3194168ffccea41a2d572f092b26b85e568d0985 (patch) | |
tree | 0314fc29dbb4092aa1893b0d8fc4b4af98eab890 /lib/libfetch/http.c | |
parent | f2836e8cf791f4b8f244167dd4022f57c4ab31eb (diff) | |
download | FreeBSD-src-3194168ffccea41a2d572f092b26b85e568d0985.zip FreeBSD-src-3194168ffccea41a2d572f092b26b85e568d0985.tar.gz |
Make HTTP_PROXY work for FTP.
Reported by: Ben Smithurst <ben@scientia.demon.co.uk>
Reviewed by: des
Diffstat (limited to 'lib/libfetch/http.c')
-rw-r--r-- | lib/libfetch/http.c | 18 |
1 files changed, 13 insertions, 5 deletions
diff --git a/lib/libfetch/http.c b/lib/libfetch/http.c index d5d35fc..a395881 100644 --- a/lib/libfetch/http.c +++ b/lib/libfetch/http.c @@ -311,10 +311,16 @@ _http_connect(struct url *URL, char *flags) if (!URL->port) { struct servent *se; - if ((se = getservbyname("http", "tcp")) != NULL) - URL->port = ntohs(se->s_port); + if (strcasecmp(URL->scheme, "ftp") == 0) + if ((se = getservbyname("ftp", "tcp")) != NULL) + URL->port = ntohs(se->s_port); + else + URL->port = 21; else - URL->port = 80; + if ((se = getservbyname("http", "tcp")) != NULL) + URL->port = ntohs(se->s_port); + else + URL->port = 80; } /* attempt to connect to proxy server */ @@ -363,6 +369,8 @@ _http_connect(struct url *URL, char *flags) /* if no proxy is configured or could be contacted, try direct */ if (sd == -1) { + if (strcasecmp(URL->scheme, "ftp") == 0) + goto ouch; if ((sd = _fetch_connect(URL->host, URL->port, verbose)) == -1) goto ouch; } @@ -394,8 +402,8 @@ _http_request(FILE *f, char *op, struct url *URL, char *flags) /* send request (proxies require absolute form, so use that) */ if (verbose) - _fetch_info("requesting http://%s:%d%s", - URL->host, URL->port, URL->doc); + _fetch_info("requesting %s://%s:%d%s", + URL->scheme, URL->host, URL->port, URL->doc); _http_cmd(f, "%s %s://%s:%d%s HTTP/1.1" ENDL, op, URL->scheme, URL->host, URL->port, URL->doc); |