From: Daniel Stenberg Date: Wed, 24 May 2023 11:50:25 +0000 (+0200) Subject: urlapi: remove superfluous host name check X-Git-Tag: curl-8_1_2~15 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=6375a654339550e04288a56d4d216adeac00e566;p=thirdparty%2Fcurl.git urlapi: remove superfluous host name check ... as it is checked later more proper. Closes #11195 --- diff --git a/lib/urlapi.c b/lib/urlapi.c index ab62773d37..a4530f919a 100644 --- a/lib/urlapi.c +++ b/lib/urlapi.c @@ -1724,15 +1724,10 @@ CURLUcode curl_url_set(CURLU *u, CURLUPart what, case CURLUPART_OPTIONS: storep = &u->options; break; - case CURLUPART_HOST: { - size_t len = strcspn(part, " \r\n"); - if(strlen(part) != len) - /* hostname with bad content */ - return CURLUE_BAD_HOSTNAME; + case CURLUPART_HOST: storep = &u->host; Curl_safefree(u->zoneid); break; - } case CURLUPART_ZONEID: storep = &u->zoneid; break; diff --git a/tests/libtest/lib1560.c b/tests/libtest/lib1560.c index 180bea9f2b..7ce3aaede7 100644 --- a/tests/libtest/lib1560.c +++ b/tests/libtest/lib1560.c @@ -697,6 +697,12 @@ 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/", + "host=example.com%2fmoo,", + "", + 0, /* get */ + 0, /* set */ + CURLUE_OK, CURLUE_BAD_HOSTNAME}, {"https://example.com/", "host=http://fake,", "",