mirror of
https://github.com/curl/curl.git
synced 2026-04-14 22:31:41 +03:00
lib: move 'done' parameter to SingleRequests
A transfer may do several `SingleRequest`s for its success. This happens regularly for authentication, follows and retries on failed connections. The "readwrite()" calls and functions connected to those carried a `bool *done` parameter to indicate that the current `SingleRequest` is over. This may happen before `upload_done` or `download_done` bits of `SingleRequest` are set. The problem with that is now `write_resp()` protocol handlers are invoked in places where the `bool *done` cannot be passed up to the caller. Instead of being a bool in the call chain, it needs to become a member of `SingleRequest`, reflecting its state. This removes the `bool *done` parameter and adds the `done` bit to `SingleRequest` instead. It adds `Curl_req_soft_reset()` for using a `SingleRequest` in a follow up, clearing `done` and other flags/counters. Closes #13096
This commit is contained in:
parent
6aeb729b5c
commit
4e4e8af1f6
16 changed files with 96 additions and 100 deletions
|
|
@ -832,9 +832,9 @@ static CURLcode recv_CONNECT_resp(struct Curl_cfilter *cf,
|
|||
int didwhat;
|
||||
|
||||
(void)ts;
|
||||
*done = FALSE;
|
||||
result = Curl_hyper_stream(data, cf->conn, &didwhat, done,
|
||||
result = Curl_hyper_stream(data, cf->conn, &didwhat,
|
||||
CURL_CSELECT_IN | CURL_CSELECT_OUT);
|
||||
*done = data->req.done;
|
||||
if(result || !*done)
|
||||
return result;
|
||||
if(h->exec) {
|
||||
|
|
@ -918,6 +918,7 @@ static CURLcode H1_CONNECT(struct Curl_cfilter *cf,
|
|||
* If the other side indicated a connection close, or if someone
|
||||
* else told us to close this connection, do so now.
|
||||
*/
|
||||
Curl_req_soft_reset(&data->req, data);
|
||||
if(ts->close_connection || conn->bits.close) {
|
||||
/* Close this filter and the sub-chain, re-connect the
|
||||
* sub-chain and continue. Closing this filter will
|
||||
|
|
@ -1003,10 +1004,8 @@ out:
|
|||
*done = (result == CURLE_OK) && tunnel_is_established(cf->ctx);
|
||||
if(*done) {
|
||||
cf->connected = TRUE;
|
||||
/* Restore `data->req` fields that may habe been touched */
|
||||
data->req.header = TRUE; /* assume header */
|
||||
data->req.bytecount = 0;
|
||||
data->req.ignorebody = FALSE;
|
||||
/* The real request will follow the CONNECT, reset request partially */
|
||||
Curl_req_soft_reset(&data->req, data);
|
||||
Curl_client_reset(data);
|
||||
Curl_pgrsSetUploadCounter(data, 0);
|
||||
Curl_pgrsSetDownloadCounter(data, 0);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue