aboutsummaryrefslogtreecommitdiff
path: root/lib/transfer.c
diff options
context:
space:
mode:
authorDaniel Stenberg <daniel@haxx.se>2006-10-23 20:34:56 +0000
committerDaniel Stenberg <daniel@haxx.se>2006-10-23 20:34:56 +0000
commite1edd41e1b9357cec2d42762e8ae67e356693941 (patch)
tree7d29d09b12e5bf22eb70fc9adc69a455e0895783 /lib/transfer.c
parent13e60c55a1a635ceaaf78aa76a4f08c2bcace16f (diff)
Ravi Pratap provided a major update with pipelining fixes. We also no longer
re-use connections (for pipelining) before the name resolving is done.
Diffstat (limited to 'lib/transfer.c')
-rw-r--r--lib/transfer.c26
1 files changed, 16 insertions, 10 deletions
diff --git a/lib/transfer.c b/lib/transfer.c
index e136020b0..300b8e9f6 100644
--- a/lib/transfer.c
+++ b/lib/transfer.c
@@ -743,8 +743,10 @@ CURLcode Curl_readwrite(struct connectdata *conn,
failf(data, "Maximum file size exceeded");
return CURLE_FILESIZE_EXCEEDED;
}
- if(contentlength >= 0)
+ if(contentlength >= 0) {
k->size = contentlength;
+ k->maxdownload = k->size;
+ }
else {
/* Negative Content-Length is really odd, and we know it
happens for example when older Apache servers send large
@@ -1091,11 +1093,11 @@ CURLcode Curl_readwrite(struct connectdata *conn,
Curl_debug(data, CURLINFO_DATA_IN, data->state.headerbuff,
(size_t)k->hbuflen, conn);
if(k->badheader == HEADER_PARTHEADER)
- Curl_debug(data, CURLINFO_DATA_IN,
+ Curl_debug(data, CURLINFO_DATA_IN,
k->str, (size_t)nread, conn);
}
else
- Curl_debug(data, CURLINFO_DATA_IN,
+ Curl_debug(data, CURLINFO_DATA_IN,
k->str, (size_t)nread, conn);
}
@@ -1133,13 +1135,17 @@ CURLcode Curl_readwrite(struct connectdata *conn,
if((-1 != k->maxdownload) &&
(k->bytecount + nread >= k->maxdownload)) {
- size_t excess = (size_t)(k->bytecount +
- (curl_off_t)nread - k->maxdownload);
-
- if (excess > 0) {
- infof(data, "Rewinding stream by : %d bytes\n", excess);
- Curl_read_rewind(conn, excess);
- conn->bits.stream_was_rewound = TRUE;
+ curl_off_t excess = k->bytecount +
+ ((curl_off_t) nread) - k->maxdownload;
+ if (excess > 0 && !k->ignorebody) {
+ infof(data,
+ "Rewinding stream by : %" FORMAT_OFF_T
+ " bytes on url %s (size = %" FORMAT_OFF_T
+ ", maxdownload = %" FORMAT_OFF_T
+ ", bytecount = %" FORMAT_OFF_T ", nread = %d)\n",
+ excess, conn->data->reqdata.path,
+ k->size, k->maxdownload, k->bytecount, nread);
+ Curl_read_rewind(conn, excess);
}
nread = (ssize_t) (k->maxdownload - k->bytecount);