diff --git a/CHANGES b/CHANGES index aa6540287..c77f06f5f 100644 --- a/CHANGES +++ b/CHANGES @@ -7,6 +7,13 @@ Changelog +Daniel (15 December 2004) +- Tom Lee found out that globbing of strings with backslashes didn't work as + you'd expect. Backslashes are such a central part of windows file names that + forcing backslashes to have to be escaped with backslashes is a bit too + awkward to users. Starting now, you only need to escape globbing characters + such as the five letters: "[]{},". Added test case 214 to verify this. + Daniel (14 December 2004) - Harshal Pradhan patched a HTTP persistent connection flaw: if the user name and/or password were modified between two requests on a persistent diff --git a/RELEASE-NOTES b/RELEASE-NOTES index b40664aaf..80825dc39 100644 --- a/RELEASE-NOTES +++ b/RELEASE-NOTES @@ -26,6 +26,7 @@ This release includes the following changes: This release includes the following bugfixes: + o -T upload multiple files with backslashes in file names o modified credentials between two requests on a persistent http connection o large file file:// resumes on Windows o URLs with username and IPv6 numerical addresses @@ -69,6 +70,6 @@ advice from friends like these: Tim Sneddon, Ian Gulliver, Jean-Philippe Barrette-LaPierre, Jeff Phillips, Wojciech Zwiefka, David Phillips, Reinout van Schouwen, Maurice Barnum, Richard Atterer, Rene Bernhardt, Matt Veenstra, Bryan Henderson, Ton Voon, - Kai Sommerfeld, David Byron, Harshal Pradhan + Kai Sommerfeld, David Byron, Harshal Pradhan, Tom Lee Thanks! (and sorry if I forgot to mention someone) diff --git a/src/urlglob.c b/src/urlglob.c index e4f441b08..64d700783 100644 --- a/src/urlglob.c +++ b/src/urlglob.c @@ -73,6 +73,8 @@ static GlobCode glob_set(URLGlob *glob, char *pattern, ++glob->size; while (1) { + bool skip; + switch (*pattern) { case '\0': /* URL ended while set was still open */ snprintf(glob->errormsg, sizeof(glob->errormsg), @@ -122,14 +124,28 @@ static GlobCode glob_set(URLGlob *glob, char *pattern, return GLOB_ERROR; case '\\': /* escaped character, skip '\' */ - if (*(buf+1) == '\0') { /* but no escaping of '\0'! */ - snprintf(glob->errormsg, sizeof(glob->errormsg), - "illegal pattern at pos %d\n", (int)pos); - return GLOB_ERROR; + switch(pattern[1]) { + case '[': + case ']': + case '{': + case '}': + case ',': + skip = TRUE; + break; + default: + skip = FALSE; + break; } - ++pattern; - ++pos; /* intentional fallthrough */ - + if(skip) { + if (*(buf+1) == '\0') { /* but no escaping of '\0'! */ + snprintf(glob->errormsg, sizeof(glob->errormsg), + "illegal pattern at pos %d\n", (int)pos); + return GLOB_ERROR; + } + ++pattern; + ++pos; + } + /* intentional fallthrough */ default: *buf++ = *pattern++; /* copy character to set element */ ++pos; diff --git a/tests/data/Makefile.am b/tests/data/Makefile.am index ca04cfec4..3e866023d 100644 --- a/tests/data/Makefile.am +++ b/tests/data/Makefile.am @@ -30,7 +30,7 @@ EXTRA_DIST = test1 test108 test117 test127 test20 test27 test34 test46 \ test193 test194 test195 test196 test197 test198 test515 test516 \ test517 test518 test210 test211 test212 test220 test221 test222 \ test223 test224 test206 test207 test208 test209 test213 test240 \ - test241 test242 test519 + test241 test242 test519 test214 # The following tests have been removed from the dist since they no longer # work. We need to fix the test suite's FTPS server first, then bring them diff --git a/tests/data/test214 b/tests/data/test214 new file mode 100644 index 000000000..8a7405b45 --- /dev/null +++ b/tests/data/test214 @@ -0,0 +1,43 @@ +# +# Server-side + + +HTTP/1.1 200 OK +Date: Thu, 09 Nov 2010 14:49:00 GMT +Content-Length: 6 +Content-Type: text/html +Funny-head: yesyes + + + + + +# +# Client-side + + +http + + +HTTP URL with escaped { and } + + +'http://%HOSTIP:%HTTPPORT/\{\}\/214' + + + +# +# Verify data after the test has been "shot" + + +^User-Agent:.* + + +GET /{}\/214 HTTP/1.1 +Host: %HOSTIP:%HTTPPORT +Pragma: no-cache +Accept: */* + + + +