request: change the struct field bodywrites to a bool, only for hyper

Only hyper needs to know this, and it can use it as a boolean.

Closes #13928
This commit is contained in:
Daniel Stenberg 2024-06-12 11:20:00 +02:00
parent 479858e15e
commit 267c3b31e9
No known key found for this signature in database
GPG Key ID: 5CC908FDB71E12C2
4 changed files with 11 additions and 5 deletions

View File

@ -206,7 +206,7 @@ static int hyper_body_chunk(void *userdata, const hyper_buf *chunk)
struct SingleRequest *k = &data->req;
CURLcode result = CURLE_OK;
if(0 == k->bodywrites) {
if(!k->bodywritten) {
#if defined(USE_NTLM)
struct connectdata *conn = data->conn;
if(conn->bits.close &&
@ -420,7 +420,7 @@ CURLcode Curl_hyper_stream(struct Curl_easy *data,
/* end of transfer */
data->req.done = TRUE;
infof(data, "hyperstream is done");
if(!k->bodywrites) {
if(!k->bodywritten) {
/* hyper doesn't always call the body write callback */
result = Curl_http_firstwrite(data);
}

View File

@ -136,7 +136,6 @@ void Curl_req_hard_reset(struct SingleRequest *req, struct Curl_easy *data)
req->keepon = 0;
req->upgr101 = UPGR101_INIT;
req->timeofdoc = 0;
req->bodywrites = 0;
req->location = NULL;
req->newurl = NULL;
#ifndef CURL_DISABLE_COOKIES
@ -158,6 +157,9 @@ void Curl_req_hard_reset(struct SingleRequest *req, struct Curl_easy *data)
req->no_body = data->set.opt_no_body;
req->authneg = FALSE;
req->shutdown = FALSE;
#ifdef USE_HYPER
req->bodywritten = FALSE;
#endif
}
void Curl_req_free(struct SingleRequest *req, struct Curl_easy *data)

View File

@ -93,7 +93,6 @@ struct SingleRequest {
struct bufq sendbuf; /* data which needs to be send to the server */
size_t sendbuf_hds_len; /* amount of header bytes in sendbuf */
time_t timeofdoc;
long bodywrites;
char *location; /* This points to an allocated version of the Location:
header data */
char *newurl; /* Set to the new URL to use when a redirect or a retry is
@ -147,6 +146,9 @@ struct SingleRequest {
negotiation. */
BIT(sendbuf_init); /* sendbuf is initialized */
BIT(shutdown); /* request end will shutdown connection */
#ifdef USE_HYPER
BIT(bodywritten);
#endif
};
/**

View File

@ -316,7 +316,9 @@ static CURLcode cw_download_write(struct Curl_easy *data,
}
/* Update stats, write and report progress */
data->req.bytecount += nwrite;
++data->req.bodywrites;
#ifdef USE_HYPER
data->req.bodywritten = TRUE;
#endif
result = Curl_pgrsSetDownloadCounter(data, data->req.bytecount);
if(result)
return result;