aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorDaniel Stenberg <daniel@haxx.se>2018-09-19 10:17:03 +0200
committerDaniel Stenberg <daniel@haxx.se>2018-09-19 23:21:52 +0200
commit9307c219ad4741db860b864c860ac2f8bf9fad9d (patch)
treef8a75b214a770f7bc75996abee293e7e53727074 /tests
parenteb0b3acbc1beb08489222ed713ac387ca900fe90 (diff)
urlapi: add CURLU_GUESS_SCHEME and fix hostname acceptance
In order for this API to fully work for libcurl itself, it now offers a CURLU_GUESS_SCHEME flag that makes it "guess" scheme based on the host name prefix just like libcurl always did. If there's no known prefix, it will guess "http://". Separately, it relaxes the check of the host name so that IDN host names can be passed in as well. Both these changes are necessary for libcurl itself to use this API. Assisted-by: Daniel Gustafsson Closes #3018
Diffstat (limited to 'tests')
-rw-r--r--tests/data/test15606
-rw-r--r--tests/libtest/lib1560.c26
2 files changed, 31 insertions, 1 deletions
diff --git a/tests/data/test1560 b/tests/data/test1560
index 720df036f..4b6c97a53 100644
--- a/tests/data/test1560
+++ b/tests/data/test1560
@@ -16,6 +16,12 @@ none
file
https
http
+pop3
+smtp
+imap
+ldap
+dict
+ftp
</features>
<name>
URL API
diff --git a/tests/libtest/lib1560.c b/tests/libtest/lib1560.c
index 669ea9ada..30fb582a2 100644
--- a/tests/libtest/lib1560.c
+++ b/tests/libtest/lib1560.c
@@ -246,8 +246,32 @@ static struct testcase get_parts_list[] ={
};
static struct urltestcase get_url_list[] = {
+ {"smtp.example.com/path/html",
+ "smtp://smtp.example.com/path/html",
+ CURLU_GUESS_SCHEME, 0, CURLUE_OK},
+ {"https.example.com/path/html",
+ "http://https.example.com/path/html",
+ CURLU_GUESS_SCHEME, 0, CURLUE_OK},
+ {"dict.example.com/path/html",
+ "dict://dict.example.com/path/html",
+ CURLU_GUESS_SCHEME, 0, CURLUE_OK},
+ {"pop3.example.com/path/html",
+ "pop3://pop3.example.com/path/html",
+ CURLU_GUESS_SCHEME, 0, CURLUE_OK},
+ {"ldap.example.com/path/html",
+ "ldap://ldap.example.com/path/html",
+ CURLU_GUESS_SCHEME, 0, CURLUE_OK},
+ {"imap.example.com/path/html",
+ "imap://imap.example.com/path/html",
+ CURLU_GUESS_SCHEME, 0, CURLUE_OK},
+ {"ftp.example.com/path/html",
+ "ftp://ftp.example.com/path/html",
+ CURLU_GUESS_SCHEME, 0, CURLUE_OK},
+ {"example.com/path/html",
+ "http://example.com/path/html",
+ CURLU_GUESS_SCHEME, 0, CURLUE_OK},
{"HTTP://test/", "http://test/", 0, 0, CURLUE_OK},
- {"http://HO0_-st..~./", "", 0, 0, CURLUE_MALFORMED_INPUT},
+ {"http://HO0_-st..~./", "http://HO0_-st..~./", 0, 0, CURLUE_OK},
{"http:/@example.com: 123/", "", 0, 0, CURLUE_BAD_PORT_NUMBER},
{"http:/@example.com:123 /", "", 0, 0, CURLUE_BAD_PORT_NUMBER},
{"http:/@example.com:123a/", "", 0, 0, CURLUE_BAD_PORT_NUMBER},