From 287b082c63864213dabf68ae2b6dea08e3c60b35 Mon Sep 17 00:00:00 2001 From: Daniel Stenberg Date: Tue, 12 May 2026 16:01:41 +0200 Subject: [PATCH] tool_urlglob: better 'Duplicate glob name' position This now points to where the duplicate name ends, not where it starts. Also fixes test 2410 to use a fixed hostname so that the error position remains the same. Reported-by: Viktor Szakats Fixes #21567 Closes #21568 --- src/tool_urlglob.c | 2 +- tests/data/test2410 | 11 ++++------- 2 files changed, 5 insertions(+), 8 deletions(-) diff --git a/src/tool_urlglob.c b/src/tool_urlglob.c index 72893fe661..a0dbb0bb6f 100644 --- a/src/tool_urlglob.c +++ b/src/tool_urlglob.c @@ -524,7 +524,7 @@ static CURLcode glob_parse(struct URLGlob *glob, const char *pattern, /* check that the name is not already used */ struct URLPattern *p = glob_find_name(glob, &name); if(p) - return globerror(glob, "Duplicate glob name", 2 + start - ipattern, + return globerror(glob, "Duplicate glob name", pattern - ipattern, CURLE_URL_MALFORMAT); pos += (pattern - start); } diff --git a/tests/data/test2410 b/tests/data/test2410 index fdec8c2e5d..ce83263e53 100644 --- a/tests/data/test2410 +++ b/tests/data/test2410 @@ -12,23 +12,20 @@ globbing # Client-side - -http - duplicate named glob -"%HOSTIP:%HTTPPORT/{%LTtest%GTA,B}{%LTtest%GTC,D}" -o "%LOGDIR/dump" +"https://dummy.example/{%LTtest%GTA,B}{%LTtest%GTC,D}" -o "%LOGDIR/dump" # Verify data after the test has been "shot" -curl: (3) Duplicate glob name in position 30: -%HOSTIP:%HTTPPORT/{%LTtest%GTA,B}{%LTtest%GTC,D} - ^ +curl: (3) Duplicate glob name in position 40: +https://dummy.example/{%LTtest%GTA,B}{%LTtest%GTC,D} + ^ 3