diff options
| author | Dag-Erling Smørgrav <des@FreeBSD.org> | 2000-07-19 23:43:49 +0000 | 
|---|---|---|
| committer | Dag-Erling Smørgrav <des@FreeBSD.org> | 2000-07-19 23:43:49 +0000 | 
| commit | 87b41116ccce83eaf74eedc99b04fe02e12d0580 (patch) | |
| tree | 176c3079fcdbc241ac54b9ff8df48c548c70bda7 /lib/libfetch/http.c | |
| parent | 23053d8f2f58cd41bb7d20c7dced208d98beb536 (diff) | |
Notes
Diffstat (limited to 'lib/libfetch/http.c')
| -rw-r--r-- | lib/libfetch/http.c | 18 | 
1 files changed, 10 insertions, 8 deletions
diff --git a/lib/libfetch/http.c b/lib/libfetch/http.c index ce748c5c646f..06dad22ade4a 100644 --- a/lib/libfetch/http.c +++ b/lib/libfetch/http.c @@ -825,7 +825,7 @@ _http_request(struct url *URL, char *op, struct url_stat *us, char *flags)  	/* other headers */  	_http_cmd(fd, "Host: %s:%d", host, url->port);  	_http_cmd(fd, "User-Agent: %s " _LIBFETCH_VER, __progname); -	if (URL->offset) +	if (url->offset)  	    _http_cmd(fd, "Range: bytes=%lld-", url->offset);  	_http_cmd(fd, "Connection: close");  	_http_cmd(fd, ""); @@ -950,19 +950,21 @@ _http_request(struct url *URL, char *op, struct url_stat *us, char *flags)  	goto ouch;      } +    /* too far? */ +    if (offset > url->offset) { +	_http_seterr(HTTP_PROTOCOL_ERROR); +	goto ouch; +    } + +    /* report back real offset */ +    URL->offset = offset; +          /* wrap it up in a FILE */      if ((f = chunked ? _http_funopen(fd) : fdopen(fd, "r")) == NULL) {  	_fetch_syserr();  	goto ouch;      } -    while (offset++ < url->offset) -	if (fgetc(f) == EOF) { -	    _fetch_syserr(); -	    fclose(f); -	    f = NULL; -	} -          if (url != URL)  	fetchFreeURL(url);  | 
