aboutsummaryrefslogtreecommitdiff
path: root/tests/libtest
diff options
context:
space:
mode:
authorDaniel Stenberg <daniel@haxx.se>2019-05-03 13:18:12 +0200
committerDaniel Stenberg <daniel@haxx.se>2019-05-05 15:52:46 +0200
commit2d0e9b40d3237b1450cbbfbcb996da244d964898 (patch)
tree79f952f5ede7ce5af423fbd480c8ea3c7df3de6f /tests/libtest
parent0eec832603d3a4ba9ae69a16351cf29c37f7fb7c (diff)
urlapi: add CURLUPART_ZONEID to set and get
The zoneid can be used with IPv6 numerical addresses. Updated test 1560 to verify. Closes #3834
Diffstat (limited to 'tests/libtest')
-rw-r--r--tests/libtest/lib1560.c38
1 files changed, 38 insertions, 0 deletions
diff --git a/tests/libtest/lib1560.c b/tests/libtest/lib1560.c
index 0b9495767..5ad7134d0 100644
--- a/tests/libtest/lib1560.c
+++ b/tests/libtest/lib1560.c
@@ -414,6 +414,10 @@ static int checkurl(const char *url, const char *out)
/* !checksrc! disable SPACEBEFORECOMMA 1 */
static struct setcase set_parts_list[] = {
+ {"https://[::1%25fake]:1234/",
+ "zoneid=NULL,",
+ "https://[::1]:1234/",
+ 0, 0, CURLUE_OK, CURLUE_OK},
{"https://host:1234/",
"port=NULL,",
"https://host/",
@@ -547,6 +551,8 @@ static CURLUPart part2id(char *part)
return CURLUPART_QUERY;
if(!strcmp("fragment", part))
return CURLUPART_FRAGMENT;
+ if(!strcmp("zoneid", part))
+ return CURLUPART_ZONEID;
return 9999; /* bad input => bad output */
}
@@ -571,6 +577,9 @@ static CURLUcode updateurl(CURLU *u, const char *cmd, unsigned int setflags)
/* for debugging this */
fprintf(stderr, "%s = %s [%d]\n", part, value, (int)what);
#endif
+ if(what > CURLUPART_ZONEID)
+ fprintf(stderr, "UNKNOWN part '%s'\n", part);
+
if(!strcmp("NULL", value))
uc = curl_url_set(u, what, NULL, setflags);
else if(!strcmp("\"\"", value))
@@ -942,6 +951,35 @@ static int scopeid(void)
curl_free(url);
}
+ rc = curl_url_get(u, CURLUPART_ZONEID, &url, 0);
+ if(rc != CURLUE_OK) {
+ fprintf(stderr, "%s:%d curl_url_get CURLUPART_ZONEID returned %d\n",
+ __FILE__, __LINE__, (int)rc);
+ error++;
+ }
+ else {
+ printf("we got %s\n", url);
+ curl_free(url);
+ }
+
+ rc = curl_url_set(u, CURLUPART_ZONEID, "clown", 0);
+ if(rc != CURLUE_OK) {
+ fprintf(stderr, "%s:%d curl_url_set CURLUPART_ZONEID returned %d\n",
+ __FILE__, __LINE__, (int)rc);
+ error++;
+ }
+
+ rc = curl_url_get(u, CURLUPART_URL, &url, 0);
+ if(rc != CURLUE_OK) {
+ fprintf(stderr, "%s:%d curl_url_get CURLUPART_URL returned %d\n",
+ __FILE__, __LINE__, (int)rc);
+ error++;
+ }
+ else {
+ printf("we got %s\n", url);
+ curl_free(url);
+ }
+
curl_url_cleanup(u);
return error;