]> git.ipfire.org Git - thirdparty/curl.git/commitdiff
lib1560: extended to verify detect/reject of unknown schemes
authorDaniel Stenberg <daniel@haxx.se>
Wed, 14 Sep 2022 07:21:49 +0000 (09:21 +0200)
committerDaniel Stenberg <daniel@haxx.se>
Thu, 15 Sep 2022 07:31:45 +0000 (09:31 +0200)
... when no guessing is allowed.

tests/libtest/lib1560.c

index 891c4701a3f20d9c87eada0236314591a19f7dcd..c38b3131bb86b40840cdd1ce3e0e6280c8055b06 100644 (file)
@@ -248,7 +248,7 @@ static const struct testcase get_parts_list[] ={
    CURLU_DEFAULT_SCHEME, 0, CURLUE_NO_HOST},
   {"boing:80",
    "https | [11] | [12] | [13] | boing | 80 | / | [16] | [17]",
-   CURLU_DEFAULT_SCHEME, 0, CURLUE_OK},
+   CURLU_DEFAULT_SCHEME|CURLU_GUESS_SCHEME, 0, CURLUE_OK},
   {"http://[fd00:a41::50]:8080",
    "http | [11] | [12] | [13] | [fd00:a41::50] | 8080 | / | [16] | [17]",
    CURLU_DEFAULT_SCHEME, 0, CURLUE_OK},
@@ -393,6 +393,15 @@ static const struct testcase get_parts_list[] ={
 };
 
 static const struct urltestcase get_url_list[] = {
+  /* unsupported schemes with no guessing enabled */
+  {"data:text/html;charset=utf-8;base64,PCFET0NUWVBFIEhUTUw+PG1ldGEgY",
+   "", 0, 0, CURLUE_UNSUPPORTED_SCHEME},
+  {"d:anything-really", "", 0, 0, CURLUE_UNSUPPORTED_SCHEME},
+  {"about:config", "", 0, 0, CURLUE_UNSUPPORTED_SCHEME},
+  {"example://foo", "", 0, 0, CURLUE_UNSUPPORTED_SCHEME},
+  {"mailto:infobot@example.com?body=send%20current-issue", "", 0, 0,
+   CURLUE_UNSUPPORTED_SCHEME},
+  {"about:80", "https://about:80/", CURLU_DEFAULT_SCHEME, 0, CURLUE_OK},
   /* percent encoded host names */
   {"http://example.com%40127.0.0.1/", "", 0, 0, CURLUE_BAD_HOSTNAME},
   {"http://example.com%21127.0.0.1/", "", 0, 0, CURLUE_BAD_HOSTNAME},