]> granicus.if.org Git - curl/commitdiff
pretransfer: don't strlen() POSTFIELDS set for GET requests
authorDaniel Stenberg <daniel@haxx.se>
Mon, 11 Feb 2019 08:17:07 +0000 (09:17 +0100)
committerDaniel Stenberg <daniel@haxx.se>
Tue, 12 Feb 2019 13:36:54 +0000 (14:36 +0100)
... since that data won't be used in the request anyway.

Fixes #3548
Reported-by: Renaud Allard
Close #3549

lib/transfer.c
lib/urldata.h

index 3a18c7bdd0d8e8cf5035f3d13598f94d73835552..27fe7907467e31197d39bff41063b0cd22399959 100644 (file)
@@ -1526,11 +1526,14 @@ CURLcode Curl_pretransfer(struct Curl_easy *data)
 
   if(data->set.httpreq == HTTPREQ_PUT)
     data->state.infilesize = data->set.filesize;
-  else {
+  else if((data->set.httpreq != HTTPREQ_GET) &&
+          (data->set.httpreq != HTTPREQ_HEAD)) {
     data->state.infilesize = data->set.postfieldsize;
     if(data->set.postfields && (data->state.infilesize == -1))
       data->state.infilesize = (curl_off_t)strlen(data->set.postfields);
   }
+  else
+    data->state.infilesize = 0;
 
   /* If there is a list of cookie files to read, do it now! */
   if(data->change.cookielist)
index ff3cc9a655e8e5646cb3120b8b43efa6adc1f516..e137569ac940e915aaa0d800d3bc1580e2ba6d2c 100644 (file)
@@ -1150,7 +1150,6 @@ typedef enum {
   HTTPREQ_PUT,
   HTTPREQ_HEAD,
   HTTPREQ_OPTIONS,
-  HTTPREQ_CUSTOM,
   HTTPREQ_LAST /* last in list */
 } Curl_HttpReq;