]> git.ipfire.org Git - thirdparty/curl.git/commitdiff
hostip: bad CURLOPT_RESOLVE syntax now returns error
authorAlexis Vachette <avachette@deezer.com>
Wed, 2 Jun 2021 12:12:10 +0000 (14:12 +0200)
committerDaniel Stenberg <daniel@haxx.se>
Thu, 3 Jun 2021 11:53:18 +0000 (13:53 +0200)
Added test 3019
Fixes #7170
Closes #7174

lib/hostip.c
tests/data/Makefile.inc
tests/data/test3019 [new file with mode: 0644]

index 1832bee4d4a76f4e6905cc352df3be4a314e9027..2d6f500c660fbc8ffec90addaa88a7594a95f618 100644 (file)
@@ -1104,10 +1104,10 @@ CURLcode Curl_loadhostpairs(struct Curl_easy *data)
       error = false;
    err:
       if(error) {
-        infof(data, "Couldn't parse CURLOPT_RESOLVE entry '%s'!\n",
+        failf(data, "Couldn't parse CURLOPT_RESOLVE entry '%s'!",
               hostp->data);
         Curl_freeaddrinfo(head);
-        continue;
+        return CURLE_SETOPT_OPTION_SYNTAX;
       }
 
       /* Create an entry id, based upon the hostname and port */
index 2b25a92b36fc582430027917f91eb137ea660fcd..8f98d0b20b8f68a433ed95ad9eb27f1182b606ef 100644 (file)
@@ -234,4 +234,6 @@ test3000 test3001 test3002 test3003 test3004 test3005 test3006 test3007 \
 test3008 test3009 test3010 test3011 test3012 test3013 test3014 test3015 \
 test3016 \
 \
-test3017 test3018
+test3017 test3018 \
+\
+test3019
diff --git a/tests/data/test3019 b/tests/data/test3019
new file mode 100644 (file)
index 0000000..0403278
--- /dev/null
@@ -0,0 +1,36 @@
+<testcase>
+<info>
+<keywords>
+HTTP
+HTTP GET
+--resolve
+</keywords>
+</info>
+
+#
+# Server-side
+<reply>
+</reply>
+
+#
+# Client-side
+<client>
+<server>
+http
+</server>
+<name>
+HTTP with invalid --resolve syntax
+</name>
+<command>
+--resolve %HTTPPORT:example.com:%HOSTIP http://example.com:%HTTPPORT/%TESTNUMBER
+</command>
+</client>
+
+#
+# Verify data after the test has been "shot"
+<verify>
+<errorcode>
+49
+</errorcode>
+</verify>
+</testcase>