urlapi: scheme starts with alpha

Add multiple tests to lib1560 to verify

Fixes #11249
Reported-by: ad0p on github
Closes #11250
This commit is contained in:
Daniel Stenberg 2023-06-05 08:28:27 +02:00
parent 6854b6c58e
commit ba669d072d
No known key found for this signature in database
GPG key ID: 5CC908FDB71E12C2
2 changed files with 62 additions and 17 deletions

View file

@ -141,6 +141,22 @@ struct clearurlcase {
};
static const struct testcase get_parts_list[] ={
{"1h://example.net", "", 0, 0, CURLUE_BAD_SCHEME},
{"..://example.net", "", 0, 0, CURLUE_BAD_SCHEME},
{"-ht://example.net", "", 0, 0, CURLUE_BAD_SCHEME},
{"+ftp://example.net", "", 0, 0, CURLUE_BAD_SCHEME},
{"hej.hej://example.net",
"hej.hej | [11] | [12] | [13] | example.net | [15] | / | [16] | [17]",
CURLU_NON_SUPPORT_SCHEME, 0, CURLUE_OK},
{"ht-tp://example.net",
"ht-tp | [11] | [12] | [13] | example.net | [15] | / | [16] | [17]",
CURLU_NON_SUPPORT_SCHEME, 0, CURLUE_OK},
{"ftp+more://example.net",
"ftp+more | [11] | [12] | [13] | example.net | [15] | / | [16] | [17]",
CURLU_NON_SUPPORT_SCHEME, 0, CURLUE_OK},
{"f1337://example.net",
"f1337 | [11] | [12] | [13] | example.net | [15] | / | [16] | [17]",
CURLU_NON_SUPPORT_SCHEME, 0, CURLUE_OK},
{"https://user@example.net?hello# space ",
"https | user | [12] | [13] | example.net | [15] | / | hello | %20space%20",
CURLU_ALLOW_SPACE|CURLU_URLENCODE, 0, CURLUE_OK},
@ -733,6 +749,30 @@ static int checkurl(const char *org, const char *url, const char *out)
/* !checksrc! disable SPACEBEFORECOMMA 1 */
static const struct setcase set_parts_list[] = {
{"https://example.com/",
"scheme=ftp+-.123,",
"ftp+-.123://example.com/",
0, CURLU_NON_SUPPORT_SCHEME, CURLUE_OK, CURLUE_OK},
{"https://example.com/",
"scheme=1234,",
"https://example.com/",
0, CURLU_NON_SUPPORT_SCHEME, CURLUE_OK, CURLUE_BAD_SCHEME},
{"https://example.com/",
"scheme=1http,",
"https://example.com/",
0, CURLU_NON_SUPPORT_SCHEME, CURLUE_OK, CURLUE_BAD_SCHEME},
{"https://example.com/",
"scheme=-ftp,",
"https://example.com/",
0, CURLU_NON_SUPPORT_SCHEME, CURLUE_OK, CURLUE_BAD_SCHEME},
{"https://example.com/",
"scheme=+ftp,",
"https://example.com/",
0, CURLU_NON_SUPPORT_SCHEME, CURLUE_OK, CURLUE_BAD_SCHEME},
{"https://example.com/",
"scheme=.ftp,",
"https://example.com/",
0, CURLU_NON_SUPPORT_SCHEME, CURLUE_OK, CURLUE_BAD_SCHEME},
{"https://example.com/",
"host=example.com%2fmoo,",
"",