]> git.ipfire.org Git - thirdparty/curl.git/commitdiff
glob: fix [a-c] globbing regression
authorDaniel Stenberg <daniel@haxx.se>
Tue, 15 Nov 2016 07:22:54 +0000 (08:22 +0100)
committerDaniel Stenberg <daniel@haxx.se>
Tue, 15 Nov 2016 07:22:54 +0000 (08:22 +0100)
Brought in ee4f76606cf

Added test case 1280 to verify

Reported-by: Dave Reisner
Bug: https://github.com/curl/curl/commit/ee4f76606cfa4ee068bf28edd37c8dae7e8db317#commitcomment-19823146

src/tool_urlglob.c
tests/data/Makefile.inc
tests/data/test1280 [new file with mode: 0644]

index 09d21b61e3a2fb9f402098d20d2a9f72adfca439..08e5d094c6e2927a8c6f63a4263ee100861df6a0 100644 (file)
@@ -213,6 +213,9 @@ static CURLcode glob_range(URLGlob *glob, char **patternp,
       else if(end_c != ']')
         /* then this is wrong */
         rc = 0;
+      else
+        /* end_c == ']' */
+        pattern += 4;
     }
 
     *posp += (pattern - *patternp);
index a2ece3dde7a4f6674c62b7ddb6d1972b4241de37..b8b18e5d0b1770c1870ecd0055403c71d7f5cdf9 100644 (file)
@@ -129,6 +129,8 @@ test1228 test1229 test1230 test1231 test1232 test1233 test1234 test1235 \
 test1236 test1237 test1238 test1239 test1240 test1241 test1242 test1243 \
 test1244 test1245 test1246 test1247 \
 \
+test1280 \
+\
 test1300 test1301 test1302 test1303 test1304 test1305 test1306 test1307 \
 test1308 test1309 test1310 test1311 test1312 test1313 test1314 test1315 \
 test1316 test1317 test1318 test1319 test1320 test1321 test1322          \
diff --git a/tests/data/test1280 b/tests/data/test1280
new file mode 100644 (file)
index 0000000..15c1e2f
--- /dev/null
@@ -0,0 +1,58 @@
+<testcase>
+<info>
+<keywords>
+globbing
+</keywords>
+</info>
+
+#
+# Server-side
+<reply>
+<data>
+HTTP/1.1 200 OK
+Date: Thu, 09 Nov 2010 14:49:00 GMT
+Content-Length: 6
+Connection: close
+
+bytes
+</data>
+</reply>
+
+# Client-side
+<client>
+<server>
+http
+</server>
+ <name>
+simple [a-d] globbing
+ </name>
+ <command>
+http://%HOSTIP:%HTTPPORT/[a-d]/1280
+</command>
+</client>
+
+# Verify data after the test has been "shot"
+<verify>
+<strip>
+^User-Agent:.*
+</strip>
+<protocol>
+GET /a/1280 HTTP/1.1\r
+Host: %HOSTIP:%HTTPPORT\r
+Accept: */*\r
+\r
+GET /b/1280 HTTP/1.1\r
+Host: %HOSTIP:%HTTPPORT\r
+Accept: */*\r
+\r
+GET /c/1280 HTTP/1.1\r
+Host: %HOSTIP:%HTTPPORT\r
+Accept: */*\r
+\r
+GET /d/1280 HTTP/1.1\r
+Host: %HOSTIP:%HTTPPORT\r
+Accept: */*\r
+\r
+</protocol>
+</verify>
+</testcase>