From 804d5293f899705198c310c6f76c61a8859da8d7 Mon Sep 17 00:00:00 2001 From: Daniel Stenberg Date: Wed, 1 Feb 2023 08:26:08 +0100 Subject: [PATCH] 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 --- lib/urlapi.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) 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) { -- 2.47.2