Toon Verwaest reported that there are servers that send the Content-Range:

header in a third, not suppported by libcurl, format and we agreed that we
could make the parser more forgiving to accept all the three found
variations.
This commit is contained in:
Daniel Stenberg 2006-12-01 07:49:22 +00:00
parent 7ae5ebbeb2
commit d8c61d459e
3 changed files with 14 additions and 6 deletions

View File

@ -6,6 +6,12 @@
Changelog
Daniel (1 December 2006)
- Toon Verwaest reported that there are servers that send the Content-Range:
header in a third, not suppported by libcurl, format and we agreed that we
could make the parser more forgiving to accept all the three found
variations.
Daniel (25 November 2006)
- Venkat Akella found out that libcurl did not like HTTP responses that simply
responded with a single status line and no headers nor body. Starting now, a

View File

@ -25,6 +25,7 @@ This release includes the following bugfixes:
o stack overwrite on 64bit Windows in the chunked decoding department
o HTTP responses on persistent connections without Content-Length nor chunked
encoding are now considered to be without response body
o Content-Range: header parsing improved
Other curl-related news:
@ -40,6 +41,6 @@ This release would not have looked like this without help, code, reports and
advice from friends like these:
James Housley, Olaf Stueben, Yang Tse, Gisle Vanem, Bradford Bruce,
Ciprian Badescu, Dmitriy Sergeyev, Nir Soffer, Venkat Akella
Ciprian Badescu, Dmitriy Sergeyev, Nir Soffer, Venkat Akella, Toon Verwaest
Thanks! (and sorry if I forgot to mention someone)

View File

@ -904,19 +904,20 @@ CURLcode Curl_readwrite(struct connectdata *conn,
|| checkprefix("x-compress", start))
k->content_encoding = COMPRESS;
}
else if (Curl_compareheader(k->p, "Content-Range:", "bytes")) {
else if (checkprefix("Content-Range:", k->p)) {
/* Content-Range: bytes [num]-
Content-Range: bytes: [num]-
Content-Range: [num]-
The second format was added since Sun's webserver
JavaWebServer/1.1.1 obviously sends the header this way!
The third added since some servers use that!
*/
char *ptr = Curl_strcasestr(k->p, "bytes");
ptr+=5;
char *ptr = k->p + 14;
if(*ptr == ':')
/* stupid colon skip */
/* Move forward until first digit */
while(*ptr && !ISDIGIT(*ptr))
ptr++;
k->offset = curlx_strtoofft(ptr, NULL, 10);