diff options
author | des <des@FreeBSD.org> | 2001-12-04 01:12:51 +0000 |
---|---|---|
committer | des <des@FreeBSD.org> | 2001-12-04 01:12:51 +0000 |
commit | ff6a5a5c2880cab3d9e886346b03ec81449dceb8 (patch) | |
tree | 5f640abde73153bc656665133e092ec0737e82b6 /lib/libfetch | |
parent | 8cabee0ca4ac41ae057d025599157d29c5a40b05 (diff) | |
download | FreeBSD-src-ff6a5a5c2880cab3d9e886346b03ec81449dceb8.zip FreeBSD-src-ff6a5a5c2880cab3d9e886346b03ec81449dceb8.tar.gz |
Properly handle being redirected to an FTP URL.
Also fix a couple of not-so-minor bugs:
- missing case for HTTP_SEE_OTHER
- incorrect definition of HTTP_NEED_PROXY_AUTH
PR: 20259
MFC after: 2 weeks
Diffstat (limited to 'lib/libfetch')
-rw-r--r-- | lib/libfetch/http.c | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/lib/libfetch/http.c b/lib/libfetch/http.c index ba0bdf8..d9fe15f 100644 --- a/lib/libfetch/http.c +++ b/lib/libfetch/http.c @@ -92,7 +92,7 @@ extern char *__progname; /* XXX not portable */ #define HTTP_MOVED_TEMP 302 #define HTTP_SEE_OTHER 303 #define HTTP_NEED_AUTH 401 -#define HTTP_NEED_PROXY_AUTH 403 +#define HTTP_NEED_PROXY_AUTH 407 #define HTTP_PROTOCOL_ERROR 999 #define HTTP_REDIRECT(xyz) ((xyz) == HTTP_MOVED_PERM \ @@ -728,6 +728,14 @@ _http_request(struct url *URL, const char *op, struct url_stat *us, if (!url->port) url->port = _fetch_default_port(url->scheme); + /* were we redirected to an FTP URL? */ + if (purl == NULL && strcmp(url->scheme, SCHEME_FTP) == 0) { + if (strcmp(op, "GET") == 0) + return _ftp_request(url, "RETR", us, purl, flags); + else if (strcmp(op, "HEAD") == 0) + return _ftp_request(url, "STAT", us, purl, flags); + } + /* connect to server or proxy */ if ((fd = _http_connect(url, purl, flags)) == -1) goto ouch; @@ -799,6 +807,7 @@ _http_request(struct url *URL, const char *op, struct url_stat *us, break; case HTTP_MOVED_PERM: case HTTP_MOVED_TEMP: + case HTTP_SEE_OTHER: /* * Not so fine, but we still have to read the headers to * get the new location. |