diff options
author | wollman <wollman@FreeBSD.org> | 1997-02-11 20:46:06 +0000 |
---|---|---|
committer | wollman <wollman@FreeBSD.org> | 1997-02-11 20:46:06 +0000 |
commit | 062bd92d8c4abd2a336db7f72ba05440a22c8f21 (patch) | |
tree | 214b7e477974aef5aff89463a5355226eac10f95 /usr.bin/fetch/http.c | |
parent | 37e9ffbc313d1f80a9e902940510abbabb064f1f (diff) | |
download | FreeBSD-src-062bd92d8c4abd2a336db7f72ba05440a22c8f21.zip FreeBSD-src-062bd92d8c4abd2a336db7f72ba05440a22c8f21.tar.gz |
Fix remote request for HTTP proxies. Should close PR#2670.
Diffstat (limited to 'usr.bin/fetch/http.c')
-rw-r--r-- | usr.bin/fetch/http.c | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/usr.bin/fetch/http.c b/usr.bin/fetch/http.c index 5d86599..cafa1dc 100644 --- a/usr.bin/fetch/http.c +++ b/usr.bin/fetch/http.c @@ -26,7 +26,7 @@ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id: http.c,v 1.2 1997/01/31 19:55:50 wollman Exp $ + * $Id: http.c,v 1.3 1997/02/05 19:59:14 wollman Exp $ */ #include <sys/types.h> @@ -169,7 +169,7 @@ http_parse(struct fetch_state *fs, const char *uri) port = 80; } - p = slash + 1; + p = slash; https = safe_malloc(sizeof *https); @@ -184,7 +184,12 @@ http_parse(struct fetch_state *fs, const char *uri) sprintf(hosthdr, "Host: %s:%d\r\n", hostname, port); https->http_host_header = safe_strdup(hosthdr); + /* + * NB: HTTP/1.1 servers MUST also accept a full URI. + * However, HTTP/1.0 servers will ONLY accept a trimmed URI. + */ https->http_remote_request = safe_strdup(p); + p++; ques = strpbrk(p, "?#"); if (ques) { trimmed_name = safe_strndup(p, ques - p); @@ -449,7 +454,7 @@ http_retrieve(struct fetch_state *fs) } while(0) retry: - addstr(iov, n, "GET /"); + addstr(iov, n, "GET "); addstr(iov, n, https->http_remote_request); addstr(iov, n, " HTTP/1.1\r\n"); /* @@ -864,6 +869,11 @@ doretry: fseek(local, restart_from, SEEK_SET); /* XXX truncation off_t->long */ display(fs, total_length, restart_from); /* XXX truncation */ + /* + * Eventually this loop will be separated out as http_suck(), and + * there will be a separate http_suck_chunked() to deal with that + * Transfer-Encoding. + */ do { alarm(timo); readresult = fread(buf, 1, sizeof buf, remote); |