I noticed with version 7.33.0 of libcurl I was getting error messages
such as "Operation timed out after 2003 milliseconds with 0 out of -1
bytes received" when using the multi interface. The "out of -1" makes
no sense. This seems to be a regression since 7.16.2 (ancient, I know!
- but stable for many terabytes of JET experimental data over the
years). The attached patch fixes this.
I have not written a specific test case, but if you run
./runtests.pl -k 29
and examine log/stderr29 you can see the error message in question.
--
Colin Hogben
>From 478f41c2b1eb75e09ccddde0e373d4d5e7ac9aff Mon Sep 17 00:00:00 2001
From: Colin Hogben <[email protected]>
Date: Mon, 13 Jan 2014 15:00:38 +0000
Subject: [PATCH] Sensible error message on timeout when transfer size unknown.
A transfer timeout could result in an error message such as "Operation
timed out after 3000 milliseconds with 19 bytes of -1 received". This
patch removes the non-sensical "of -1" when the size of the transfer
is unknown, mirroring the logic in lib/transfer.c
---
lib/multi.c | 18 +++++++++++++-----
1 files changed, 13 insertions(+), 5 deletions(-)
diff --git a/lib/multi.c b/lib/multi.c
index cab3030..84792ec 100644
--- a/lib/multi.c
+++ b/lib/multi.c
@@ -985,11 +985,19 @@ static CURLMcode multi_runsingle(struct Curl_multi *multi,
Curl_tvdiff(now, data->progress.t_startsingle));
else {
k = &data->req;
- failf(data, "Operation timed out after %ld milliseconds with %"
- CURL_FORMAT_CURL_OFF_T " out of %"
- CURL_FORMAT_CURL_OFF_T " bytes received",
- Curl_tvdiff(now, data->progress.t_startsingle), k->bytecount,
- k->size);
+ if(k->size != -1) {
+ failf(data, "Operation timed out after %ld milliseconds with %"
+ CURL_FORMAT_CURL_OFF_T " out of %"
+ CURL_FORMAT_CURL_OFF_T " bytes received",
+ Curl_tvdiff(k->now, data->progress.t_startsingle),
+ k->bytecount, k->size);
+ }
+ else {
+ failf(data, "Operation timed out after %ld milliseconds with %"
+ CURL_FORMAT_CURL_OFF_T " bytes received",
+ Curl_tvdiff(now, data->progress.t_startsingle),
+ k->bytecount);
+ }
}
/* Force the connection closed because the server could continue to
--
1.7.1
-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette: http://curl.haxx.se/mail/etiquette.html