]> git.ipfire.org Git - thirdparty/curl.git/commitdiff
request: change the struct field bodywrites to a bool, only for hyper
authorDaniel Stenberg <daniel@haxx.se>
Wed, 12 Jun 2024 09:20:00 +0000 (11:20 +0200)
committerDaniel Stenberg <daniel@haxx.se>
Wed, 12 Jun 2024 14:08:52 +0000 (16:08 +0200)
Only hyper needs to know this, and it can use it as a boolean.

Closes #13928

lib/c-hyper.c
lib/request.c
lib/request.h
lib/sendf.c

index a52eab9f36f863b29807a51ec83b9c492a695f4f..d6c27add1f3f027cb2e046ea17fdbad8266d3577 100644 (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);
         }
index e376f95a231f6970f15f1fdcab5eab495543bbe9..857e4e179b624ae68aad78cb3e8541ce954b472c 100644 (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)
index 77a0036c99d74fd2755dbc9251105cb1ff8c0e6d..6ee0fa83f72fc21b17a90b760ffd4d8cc45eddfb 100644 (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
 };
 
 /**
index d3db61bf6404db44d1ded722a3fdb30b014b3a0e..8a9ccb01b86449eb064eee830418ba3d4ac84aae 100644 (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;