aboutsummaryrefslogtreecommitdiff
path: root/lib/transfer.c
diff options
context:
space:
mode:
authorDaniel Stenberg <daniel@haxx.se>2004-01-30 12:08:18 +0000
committerDaniel Stenberg <daniel@haxx.se>2004-01-30 12:08:18 +0000
commitdf750c236c1ffb46d7aa1aade689626f6792b053 (patch)
tree099312e8e1376016fa5abe5e2de7337e3d3946b2 /lib/transfer.c
parent154c9bc3b88703316b1ff5c6c2230b41718d6c43 (diff)
Somewhat crude attempt at fixing the test 91 failures. I commit this now
so that the automatic testing hosts will test these changes over the weekend.
Diffstat (limited to 'lib/transfer.c')
-rw-r--r--lib/transfer.c26
1 files changed, 20 insertions, 6 deletions
diff --git a/lib/transfer.c b/lib/transfer.c
index eb0c99452..8e5d6abd3 100644
--- a/lib/transfer.c
+++ b/lib/transfer.c
@@ -1896,12 +1896,26 @@ CURLcode Curl_perform(struct SessionHandle *data)
if(res == CURLE_OK) {
res = Transfer(conn); /* now fetch that URL please */
- if(res == CURLE_OK)
- /*
- * We must duplicate the new URL here as the connection data
- * may be free()ed in the Curl_done() function.
- */
- newurl = conn->newurl?strdup(conn->newurl):NULL;
+ if(res == CURLE_OK) {
+
+ if((conn->keep.bytecount == 0) &&
+ (conn->sockerror == ECONNRESET) &&
+ conn->bits.reuse) {
+ /* We got no data, the connection was reset and we did attempt
+ to re-use a connection. This smells like we were too fast to
+ re-use a connection that was closed when we wanted to read
+ from it. Bad luck. Let's simulate a redirect to the same URL
+ to retry! */
+ infof(data, "Connection reset, retrying a fresh connect\n");
+ newurl = strdup(conn->data->change.url);
+ }
+ else
+ /*
+ * We must duplicate the new URL here as the connection data
+ * may be free()ed in the Curl_done() function.
+ */
+ newurl = conn->newurl?strdup(conn->newurl):NULL;
+ }
else {
/* The transfer phase returned error, we mark the connection to get
* closed to prevent being re-used. This is becasue we can't