summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorDaniel Stenberg <daniel@haxx.se>2003-10-24 21:54:34 +0000
committerDaniel Stenberg <daniel@haxx.se>2003-10-24 21:54:34 +0000
commita5e22867c7eca8090394f282325d02335532c30d (patch)
treed3890b0db512f4cb5d1c90f83563f15036220733 /lib
parent5c96266d45fb353882fc675a051066274c264574 (diff)
downloadcurl-a5e22867c7eca8090394f282325d02335532c30d.tar.gz
Resuming a download of an already downloaded document, that is trying to get
a range of a document beyond its size, caused libcurl to "hang" until the server closed the connection and then it returned error 18. This is bad. This way, we don't return any error at all, which isn't nice either, as we need to alert the app somehow that the request range was out of size.
Diffstat (limited to 'lib')
-rw-r--r--lib/transfer.c18
1 files changed, 13 insertions, 5 deletions
diff --git a/lib/transfer.c b/lib/transfer.c
index d66254bf4..4d5ea03bd 100644
--- a/lib/transfer.c
+++ b/lib/transfer.c
@@ -562,10 +562,14 @@ CURLcode Curl_readwrite(struct connectdata *conn,
* 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 terminated
- * by the first empty line after the header fields. */
+ /* (quote from RFC2616, section 10.3.5): The 304 response
+ * MUST NOT contain a message-body, and thus is always
+ * terminated by the first empty line after the header
+ * fields. */
conn->size=0;
conn->maxdownload=0;
break;
@@ -580,8 +584,12 @@ CURLcode Curl_readwrite(struct connectdata *conn,
}
}
- /* check for Content-Length: header lines to get size */
- if (checkprefix("Content-Length:", k->p) &&
+ /* 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. */
+ if ((k->httpcode != 416) &&
+ checkprefix("Content-Length:", k->p) &&
sscanf (k->p+15, " %ld", &k->contentlength)) {
if (data->set.max_filesize && k->contentlength >
data->set.max_filesize) {