]> granicus.if.org Git - curl/commitdiff
HTTP: remove special case for 416
authorDaniel Stenberg <daniel@haxx.se>
Fri, 1 Oct 2010 22:22:48 +0000 (00:22 +0200)
committerDaniel Stenberg <daniel@haxx.se>
Fri, 1 Oct 2010 22:22:48 +0000 (00:22 +0200)
It was pointed out that the special case libcurl did for 416 was
incorrect and wrong. 416 is not really different to other errors so the
response body must be handled like for other errors/http responses.

Reported by: Chris Smowton
Bug: http://curl.haxx.se/bug/view.cgi?id=3076808

lib/http.c
tests/data/test194
tests/data/test92

index 3d6f977ea45385bb151857a6ea06d95dd64b785c..413ef3d891c5f24cc6f7ad3e9819c2a56ad954a0 100644 (file)
@@ -3293,13 +3293,6 @@ CURLcode Curl_http_readwrite_headers(struct SessionHandle *data,
       data->req.deductheadercount =
         (100 <= k->httpcode && 199 >= k->httpcode)?data->req.headerbytecount:0;
 
-      if(data->state.resume_from &&
-         (data->set.httpreq==HTTPREQ_GET) &&
-         (k->httpcode == 416)) {
-        /* "Requested Range Not Satisfiable" */
-        *stop_reading = TRUE;
-      }
-
       if(!*stop_reading) {
         /* Curl_http_auth_act() checks what authentication methods
          * that are available and decides which one (if any) to
@@ -3512,9 +3505,6 @@ CURLcode Curl_http_readwrite_headers(struct SessionHandle *data,
            * message-body, and thus is always terminated by the first
            * empty line after the header fields. */
           /* FALLTHROUGH */
-        case 416: /* Requested Range Not Satisfiable, it has the
-                     Content-Length: set as the "real" document but no
-                     actual response is sent. */
         case 304:
           /* (quote from RFC2616, section 10.3.5): The 304 response
            * MUST NOT contain a message-body, and thus is always
@@ -3546,10 +3536,7 @@ CURLcode Curl_http_readwrite_headers(struct SessionHandle *data,
     /* Curl_convert_from_network calls failf if unsuccessful */
 #endif /* CURL_DOES_CONVERSIONS */
 
-    /* Check for Content-Length: header lines to get size. Ignore
-       the header completely if we get a 416 response as then we're
-       resuming a document that we don't get, and this header contains
-       info about the true size of the document we didn't get now. */
+    /* Check for Content-Length: header lines to get size */
     if(!k->ignorecl && !data->set.ignorecl &&
        checkprefix("Content-Length:", k->p)) {
       curl_off_t contentlength = curlx_strtoofft(k->p+15, NULL, 10);
index 3ccc01ae5a3de3a69f867c7347b428b1860816d2..582f197f7228b4e2d1d4f992ef1f262882537d1b 100644 (file)
@@ -17,11 +17,12 @@ Server: Apache/1.3.19 (Unix)  (Red-Hat/Linux) mod_ssl/2.8.1 OpenSSL/0.9.6 PHP/4.
 Last-Modified: Fri, 24 Oct 2003 18:01:23 GMT\r
 ETag: "ab57a-507-3f9968f3"\r
 Accept-Ranges: bytes\r
-Content-Length: 87\r
+Content-Length: 4\r
 Content-Range: bytes */87\r
 Content-Type: image/gif\r
 Connection: close\r
 \r
+bad
 </data>
 
 </reply>
index 21635753bd25987a5888e6759b1dcd03b1826a5d..726aa7919d566bc3857589f82fb511d3aa5496ad 100644 (file)
@@ -17,10 +17,11 @@ Server: Apache/1.3.19 (Unix)  (Red-Hat/Linux) mod_ssl/2.8.1 OpenSSL/0.9.6 PHP/4.
 Last-Modified: Fri, 24 Oct 2003 18:01:23 GMT\r
 ETag: "ab57a-507-3f9968f3"\r
 Accept-Ranges: bytes\r
-Content-Length: 87\r
+Content-Length: 4\r
 Content-Range: bytes */87\r
 Content-Type: image/gif\r
 \r
+bad
 </data>
 </reply>