]> granicus.if.org Git - curl/commitdiff
curl: support zero-length argument strings in config files
authorDaniel Stenberg <daniel@haxx.se>
Fri, 2 Dec 2016 10:25:35 +0000 (11:25 +0100)
committerDaniel Stenberg <daniel@haxx.se>
Fri, 2 Dec 2016 10:25:35 +0000 (11:25 +0100)
... like 'user-agent = ""'

Adjusted test 71 to verify.

src/tool_parsecfg.c
tests/data/test71

index d9454c23a2882f5a35bdbd3053556cc21677540d..7cf11d8a4d4e65a0b2e3c20eec09db1537171a3c 100644 (file)
@@ -5,7 +5,7 @@
  *                            | (__| |_| |  _ <| |___
  *                             \___|\___/|_| \_\_____|
  *
- * Copyright (C) 1998 - 2015, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 1998 - 2016, Daniel Stenberg, <daniel@haxx.se>, et al.
  *
  * This software is licensed as described in the file COPYING, which
  * you should have received as part of this distribution. The terms
@@ -209,14 +209,10 @@ int parseconfig(const char *filename, struct GlobalConfig *global)
                   filename, lineno, option);
           }
         }
-      }
-
-      if(!*param) {
-        /* do this so getparameter can check for required parameters.
-           Otherwise it always thinks there's a parameter. */
-        if(alloced_param)
-          Curl_safefree(param);
-        param = NULL;
+        if(!*param)
+          /* do this so getparameter can check for required parameters.
+             Otherwise it always thinks there's a parameter. */
+          param = NULL;
       }
 
 #ifdef DEBUG_CONFIG
index b71f969e7bf1cdb32110d5d8395e1145ea9d14f3..341a0033f7d1ce335b60d6d3d7375f33c0973732 100644 (file)
@@ -31,6 +31,7 @@ HTTP and -F upload in config file
 -F name=daniel
 -F tool=curl
 -F file=@log/test71.txt
+user-agent = ""
 </stdin>
  <command>
 http://%HOSTIP:%HTTPPORT/we/want/71 -K -
@@ -46,11 +47,10 @@ bar
 # Verify data after the test has been "shot"
 <verify>
 <strip>
-^(User-Agent:|Content-Type: multipart/form-data;|------------).*
+^(Content-Type: multipart/form-data;|------------).*
 </strip>
 <protocol>
 POST /we/want/71 HTTP/1.1\r
-User-Agent: curl/7.10.4 (i686-pc-linux-gnu) libcurl/7.10.4 OpenSSL/0.9.7a ipv6 zlib/1.1.3\r
 Host: %HOSTIP:%HTTPPORT\r
 Accept: */*\r
 Content-Length: 408\r