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

HTTP: retry failed HEAD requests too

Mark's new document about HTTP Retries
(https://mnot.github.io/I-D/httpbis-retry/) made me check our code and I
spotted that we don't retry failed HEAD requests which seems totally
inconsistent and I can't see any reason for that separate treatment.

So, no separate treatment for HEAD starting now. A HTTP request sent
over a reused connection that gets cut off before a single byte is
received will be retried on a fresh connection.

Made-aware-by: Mark Nottingham
This commit is contained in:
Daniel Stenberg 2016-08-11 08:33:36 +02:00
parent 04f84edd5b
commit 31e33a9a46

View File

@ -1891,12 +1891,11 @@ CURLcode Curl_retry_request(struct connectdata *conn,
if((data->req.bytecount + data->req.headerbytecount == 0) && if((data->req.bytecount + data->req.headerbytecount == 0) &&
conn->bits.reuse && conn->bits.reuse &&
!data->set.opt_no_body &&
(data->set.rtspreq != RTSPREQ_RECEIVE)) { (data->set.rtspreq != RTSPREQ_RECEIVE)) {
/* We got no data, we attempted to re-use a connection and yet we want a /* We didn't get a single byte when we attempted to re-use a
"body". This might happen if the connection was left alive when we were connection. This might happen if the connection was left alive when we
done using it before, but that was closed when we wanted to read from were done using it before, but that was closed when we wanted to use it
it again. Bad luck. Retry the same request on a fresh connect! */ 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)