diff options
| author | Hajimu UMEMOTO <ume@FreeBSD.org> | 2000-05-15 09:05:36 +0000 |
|---|---|---|
| committer | Hajimu UMEMOTO <ume@FreeBSD.org> | 2000-05-15 09:05:36 +0000 |
| commit | c97925ad4e79dd82554760f514089a3e683147be (patch) | |
| tree | afc5e28d1e917877ba137c2576d1e4769b5d7875 /lib/libfetch/http.c | |
| parent | 78cb0ab4854e3bf7ff8e6c90b7ca7635b2914565 (diff) | |
Notes
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 d5d35fc5e76d..a395881d8397 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); |
