From: Daniel Stenberg Date: Wed, 1 Feb 2023 07:26:08 +0000 (+0100) Subject: urlapi: skip path checks if path is just "/" X-Git-Tag: curl-7_88_0~82 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=804d5293f89;p=thirdparty%2Fcurl.git 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 --- diff --git a/lib/urlapi.c b/lib/urlapi.c index baaf4af733..ef9ec4169f 100644 --- a/lib/urlapi.c +++ b/lib/urlapi.c @@ -1200,9 +1200,10 @@ static CURLUcode parseurl(const char *url, CURLU *u, unsigned int flags) path = u->path = Curl_dyn_ptr(&enc); } - if(!pathlen) { - /* there is no path left, unset */ + if(pathlen <= 1) { + /* there is no path left or just the slash, unset */ path = NULL; + pathlen = 0; } else { if(!u->path) {