@marcel91200 / caddy Mirror · read-only / commits / 198f4385
Fork 0

Fast and extensible multi-platform HTTP/1-2-3 web server with automatic HTTPS

Mirrored from https://github.com/Slazee/caddy.git

Synced Nov 12, 10:45 UTC

caddyhttp: Add test cases to corpus (#6374)

* caddyhttp: Add test case to corpus * One more test case * Clean up stray comment * More tests

Matt Holt committed Jun 4, 2024 at 14:23 UTC 198f4385d2f72ccdd853825270f601bea7a7a190
1 file changed +25 -1
modules/caddyhttp/caddyhttp_test.go
+25 -1
@@ -94,7 +94,31 @@ func TestSanitizedPathJoin(t *testing.T) {
94 inputRoot: "C:\\www",
95 inputPath: "/D:\\foo\\bar",
96 expect: filepath.Join("C:\\www", "D:\\foo\\bar"),
97 - expectWindows: filepath.Join("C:\\www"), // inputPath fails IsLocal on Windows
97 + expectWindows: "C:\\www", // inputPath fails IsLocal on Windows
98 + },
99 + {
100 + inputRoot: `C:\www`,
101 + inputPath: `/..\windows\win.ini`,
102 + expect: `C:\www/..\windows\win.ini`,
103 + expectWindows: `C:\www`,
104 + },
105 + {
106 + inputRoot: `C:\www`,
107 + inputPath: `/..\..\..\..\..\..\..\..\..\..\windows\win.ini`,
108 + expect: `C:\www/..\..\..\..\..\..\..\..\..\..\windows\win.ini`,
109 + expectWindows: `C:\www`,
110 + },
111 + {
112 + inputRoot: `C:\www`,
113 + inputPath: `/..%5cwindows%5cwin.ini`,
114 + expect: `C:\www/..\windows\win.ini`,
115 + expectWindows: `C:\www`,
116 + },
117 + {
118 + inputRoot: `C:\www`,
119 + inputPath: `/..%5c..%5c..%5c..%5c..%5c..%5c..%5c..%5c..%5c..%5cwindows%5cwin.ini`,
120 + expect: `C:\www/..\..\..\..\..\..\..\..\..\..\windows\win.ini`,
121 + expectWindows: `C:\www`,
122 },
123 {
124 // https://github.com/golang/go/issues/56336#issuecomment-1416214885