urlapi: skip path checks if path is just "/"

As a miniscule optimization, treat a path of the length 1 as the same as
non-existing, as it can only be a single leading slash, and that's what
we do for no paths as well.

Closes #10385
This commit is contained in:
Daniel Stenberg 2023-02-01 08:26:08 +01:00
parent 92d4053afd
commit 804d5293f8
No known key found for this signature in database
GPG Key ID: 5CC908FDB71E12C2

View File

@ -1200,9 +1200,10 @@ static CURLUcode parseurl(const char *url, CURLU *u, unsigned int flags)
path = u->path = Curl_dyn_ptr(&enc); path = u->path = Curl_dyn_ptr(&enc);
} }
if(!pathlen) { if(pathlen <= 1) {
/* there is no path left, unset */ /* there is no path left or just the slash, unset */
path = NULL; path = NULL;
pathlen = 0;
} }
else { else {
if(!u->path) { if(!u->path) {