aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorMarkus Westerlind <markus.westerlind@inobiz.se>2017-02-03 15:58:41 +0100
committerDaniel Stenberg <daniel@haxx.se>2017-02-07 08:57:33 +0100
commit6ffe0f5d9670367f128d75c4c68bc427fdc60a5d (patch)
tree156c2e733a8eddd0a3b22911eece02e814df4916 /lib
parent3c5bfe489321f6757366268e23fd3565a96ab683 (diff)
transfer: only retry nobody-requests for HTTP
Using sftp to delete a file with CURLOPT_NOBODY set with a reused connection would fail as curl expected to get some data. Thus it would retry the command again which fails as the file has already been deleted. Fixes #1243
Diffstat (limited to 'lib')
-rw-r--r--lib/transfer.c17
1 files changed, 11 insertions, 6 deletions
diff --git a/lib/transfer.c b/lib/transfer.c
index 750fb04e2..a577bf724 100644
--- a/lib/transfer.c
+++ b/lib/transfer.c
@@ -1843,12 +1843,17 @@ CURLcode Curl_retry_request(struct connectdata *conn,
return CURLE_OK;
if((data->req.bytecount + data->req.headerbytecount == 0) &&
- conn->bits.reuse &&
- (data->set.rtspreq != RTSPREQ_RECEIVE)) {
- /* We didn't get a single byte when we attempted to re-use a
- connection. This might happen if the connection was left alive when we
- were done using it before, but that was closed when we wanted to use it
- again. Bad luck. Retry the same request on a fresh connect! */
+ conn->bits.reuse &&
+ (!data->set.opt_no_body
+ || (conn->handler->protocol & PROTO_FAMILY_HTTP)) &&
+ (data->set.rtspreq != RTSPREQ_RECEIVE)) {
+ /* We got no data, we attempted to re-use a connection. For HTTP this
+ can be a retry so we try again regardless if we expected a body.
+ For other protocols we only try again only if we expected a body.
+
+ This might happen if the connection was left alive when we were
+ done using it before, but that was closed when we wanted to read from
+ it again. Bad luck. Retry the same request on a fresh connect! */
infof(conn->data, "Connection died, retrying a fresh connect\n");
*url = strdup(conn->data->change.url);
if(!*url)