1
0
mirror of https://github.com/moparisthebest/curl synced 2024-12-24 09:08:49 -05:00

hostip: bad CURLOPT_RESOLVE syntax now returns error

Added test 3019
Fixes #7170
Closes #7174
This commit is contained in:
Alexis Vachette 2021-06-02 14:12:10 +02:00 committed by Daniel Stenberg
parent 002f976cdc
commit cb39b4b7c4
No known key found for this signature in database
GPG Key ID: 5CC908FDB71E12C2
3 changed files with 41 additions and 3 deletions

View 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 */

View 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

36
tests/data/test3019 Normal file
View File

@ -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>