From d8c61d459e528ead954482ac797861bce95dd895 Mon Sep 17 00:00:00 2001 From: Daniel Stenberg Date: Fri, 1 Dec 2006 07:49:22 +0000 Subject: 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. --- lib/transfer.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'lib') diff --git a/lib/transfer.c b/lib/transfer.c index e3d85aee0..a40c103e1 100644 --- a/lib/transfer.c +++ b/lib/transfer.c @@ -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); -- cgit v1.2.3