@@ -260,7 +260,7 @@ func TestLogDownload(t *testing.T) {
260
260
261
261
buf .Reset ()
262
262
263
- /* */
263
+ /* Test a log line with 200 status code */
264
264
p := & mirrors.Results {
265
265
FileInfo : filesystem.FileInfo {
266
266
Path : "/test/file.tgz" ,
@@ -294,7 +294,7 @@ func TestLogDownload(t *testing.T) {
294
294
295
295
buf .Reset ()
296
296
297
- /* */
297
+ /* Test a log line with 404 status code */
298
298
p = & mirrors.Results {
299
299
FileInfo : filesystem.FileInfo {
300
300
Path : "/test/file.tgz" ,
@@ -311,7 +311,7 @@ func TestLogDownload(t *testing.T) {
311
311
312
312
buf .Reset ()
313
313
314
- /* */
314
+ /* Test a log line with 500 status code */
315
315
p = & mirrors.Results {
316
316
MirrorList : mirrors.Mirrors {
317
317
mirrors.Mirror {
@@ -334,7 +334,7 @@ func TestLogDownload(t *testing.T) {
334
334
335
335
buf .Reset ()
336
336
337
- /* */
337
+ /* Test a log line with 501 status code */
338
338
p = & mirrors.Results {
339
339
FileInfo : filesystem.FileInfo {
340
340
Path : "/test/file.tgz" ,
@@ -350,4 +350,21 @@ func TestLogDownload(t *testing.T) {
350
350
}
351
351
352
352
buf .Reset ()
353
+
354
+ /* Make sure we don't trip when there's a %s (aka a "verb") in the request */
355
+ p = & mirrors.Results {
356
+ FileInfo : filesystem.FileInfo {
357
+ Path : "/test/%s/hacked" ,
358
+ },
359
+ IP : "192.168.0.1" ,
360
+ }
361
+
362
+ LogDownload ("JSON" , "GET" , 404 , p , nil )
363
+
364
+ expected = "JSON 404 GET \" /test/%s/hacked\" ip:192.168.0.1\n "
365
+ if ! strings .HasSuffix (buf .String (), expected ) {
366
+ t .Fatalf ("Invalid log line:\n Got:\n %#vs\n Expected:\n %#v" , buf .String (), expected )
367
+ }
368
+
369
+ buf .Reset ()
353
370
}
0 commit comments