urlapi: allow setting port number zero

Also set and check errno when strtoul() parsing numbers for better error
checking.

Updated test 1560

Closes #13427
This commit is contained in:
Daniel Stenberg 2024-04-19 14:42:39 +02:00
parent ac49152e26
commit fe17c162d0
No known key found for this signature in database
GPG key ID: 5CC908FDB71E12C2
2 changed files with 37 additions and 35 deletions

View file

@ -151,6 +151,9 @@ struct clearurlcase {
};
static const struct testcase get_parts_list[] ={
{"https://curl.se:0/#",
"https | [11] | [12] | [13] | curl.se | 0 | / | [16] | ",
0, CURLU_GET_EMPTY, CURLUE_OK},
{"https://curl.se/#",
"https | [11] | [12] | [13] | curl.se | [15] | / | [16] | ",
0, CURLU_GET_EMPTY, CURLUE_OK},
@ -941,8 +944,8 @@ static const struct setcase set_parts_list[] = {
0, 0, CURLUE_OK, CURLUE_BAD_PORT_NUMBER},
{"https://host:1234/",
"port=0,",
"https://host:1234/",
0, 0, CURLUE_OK, CURLUE_BAD_PORT_NUMBER},
"https://host:0/",
0, 0, CURLUE_OK, CURLUE_OK},
{"https://host:1234/",
"port=65535,",
"https://host:65535/",