aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorBob Richmond <bob.richmond@ticketmaster.com>2010-03-24 17:02:17 +0100
committerDaniel Stenberg <daniel@haxx.se>2010-03-24 17:02:17 +0100
commit05632d5db9b67264826c53d99eaa81943e36275c (patch)
tree2a8854d88d1bbdf460c83f703b498a76ba74a6d7 /lib
parentc245a8f92e7bb2b5bfe181af647ee4766a0f33fe (diff)
fix: timeout after last data chunk was handled
Bob Richmond: There's an annoying situation where libcurl will read new HTTP response data from a socket, then check if it's a timeout if one is set. If the last packet received constitutes the end of the response body, libcurl still treats it as a timeout condition and reports a message like: "Operation timed out after 3000 milliseconds with 876 out of 876 bytes received" It should only a timeout if the timer lapsed and we DIDN'T receive the end of the response body yet.
Diffstat (limited to 'lib')
-rw-r--r--lib/transfer.c27
1 files changed, 14 insertions, 13 deletions
diff --git a/lib/transfer.c b/lib/transfer.c
index 6e669abc5..ad9499c99 100644
--- a/lib/transfer.c
+++ b/lib/transfer.c
@@ -1060,21 +1060,22 @@ CURLcode Curl_readwrite(struct connectdata *conn,
if(result)
return result;
- if(data->set.timeout &&
- (Curl_tvdiff(k->now, k->start) >= data->set.timeout)) {
- if(k->size != -1) {
- failf(data, "Operation timed out after %ld milliseconds with %"
- FORMAT_OFF_T " out of %" FORMAT_OFF_T " bytes received",
- Curl_tvdiff(k->now, k->start), k->bytecount, k->size);
- } else {
- failf(data, "Operation timed out after %ld milliseconds with %"
- FORMAT_OFF_T " bytes received",
- Curl_tvdiff(k->now, k->start), k->bytecount);
+ if(k->keepon) {
+ if(data->set.timeout &&
+ (Curl_tvdiff(k->now, k->start) >= data->set.timeout)) {
+ if(k->size != -1) {
+ failf(data, "Operation timed out after %ld milliseconds with %"
+ FORMAT_OFF_T " out of %" FORMAT_OFF_T " bytes received",
+ Curl_tvdiff(k->now, k->start), k->bytecount, k->size);
+ } else {
+ failf(data, "Operation timed out after %ld milliseconds with %"
+ FORMAT_OFF_T " bytes received",
+ Curl_tvdiff(k->now, k->start), k->bytecount);
+ }
+ return CURLE_OPERATION_TIMEDOUT;
}
- return CURLE_OPERATION_TIMEDOUT;
}
-
- if(!k->keepon) {
+ else {
/*
* The transfer has been performed. Just make some general checks before
* returning.