aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Stenberg <daniel@haxx.se>2001-10-31 15:13:19 +0000
committerDaniel Stenberg <daniel@haxx.se>2001-10-31 15:13:19 +0000
commit542055074b588ff700ddb31bedf6b4caa76a7e5d (patch)
tree77529254d49e7ed2d5d4909132748b1af02069c1
parent7b93348aae601e264c441baea66abf33ea8b3c33 (diff)
If Curl_do() fails with CURLE_WRITE_ERROR on a re-used connection, this
new logic can retry the same operation on a new connection!
-rw-r--r--lib/transfer.c22
1 files changed, 22 insertions, 0 deletions
diff --git a/lib/transfer.c b/lib/transfer.c
index 5035c3037..01785f691 100644
--- a/lib/transfer.c
+++ b/lib/transfer.c
@@ -922,6 +922,28 @@ CURLcode Curl_perform(struct SessionHandle *data)
res = Curl_connect(data, &conn, port);
if(res == CURLE_OK) {
res = Curl_do(conn);
+
+ if((CURLE_WRITE_ERROR == res) && conn->bits.reuse) {
+ /* This was a re-use of a connection and we got a write error in the
+ * DO-phase. Then we DISCONNECT this connection and have another
+ * attempt to CONNECT and then DO again! The retry cannot possibly
+ * find another connection to re-use, since we only keep one possible
+ * connection for each.
+ */
+
+ infof(data, "The re-used connection seems dead, get a new one\n");
+
+ conn->bits.close = TRUE; /* enforce close of this connetion */
+ res = Curl_done(conn); /* we are so done with this */
+ if(CURLE_OK == res) {
+ /* Now, redo the connect */
+ res = Curl_connect(data, &conn, port);
+ if(CURLE_OK == res)
+ /* ... finally back to actually retry the DO phase */
+ res = Curl_do(conn);
+ }
+ }
+
if(res == CURLE_OK) {
CURLcode res2; /* just a local extra result container */