1
0
mirror of https://github.com/moparisthebest/curl synced 2024-12-22 08:08:50 -05:00

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
This commit is contained in:
Markus Westerlind 2017-02-03 15:58:41 +01:00 committed by Daniel Stenberg
parent 3c5bfe4893
commit 6ffe0f5d96

View File

@ -1843,12 +1843,17 @@ CURLcode Curl_retry_request(struct connectdata *conn,
return CURLE_OK; return CURLE_OK;
if((data->req.bytecount + data->req.headerbytecount == 0) && if((data->req.bytecount + data->req.headerbytecount == 0) &&
conn->bits.reuse && conn->bits.reuse &&
(data->set.rtspreq != RTSPREQ_RECEIVE)) { (!data->set.opt_no_body
/* We didn't get a single byte when we attempted to re-use a || (conn->handler->protocol & PROTO_FAMILY_HTTP)) &&
connection. This might happen if the connection was left alive when we (data->set.rtspreq != RTSPREQ_RECEIVE)) {
were done using it before, but that was closed when we wanted to use it /* We got no data, we attempted to re-use a connection. For HTTP this
again. Bad luck. Retry the same request on a fresh connect! */ 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"); infof(conn->data, "Connection died, retrying a fresh connect\n");
*url = strdup(conn->data->change.url); *url = strdup(conn->data->change.url);
if(!*url) if(!*url)