proxy: fix hyphen issue when parsing target

fix issue #948

Signed-off-by: Tw <tw19881113@gmail.com>
This commit is contained in:
Tw
2016-07-21 13:56:30 +08:00
parent beae16f07c
commit ca3d23bc70
2 changed files with 30 additions and 5 deletions
+20
View File
@@ -111,6 +111,26 @@ func TestSetup(t *testing.T) {
"http://localhost:8085": {},
},
},
// test #10 test hyphen without port range
{
"proxy / http://localhost:8001/a--b",
false,
map[string]struct{}{
"http://localhost:8001/a--b": {},
},
},
// test #11 test hyphen with port range
{
"proxy / http://localhost:8001-8005/a--b",
false,
map[string]struct{}{
"http://localhost:8001/a--b": {},
"http://localhost:8002/a--b": {},
"http://localhost:8003/a--b": {},
"http://localhost:8004/a--b": {},
"http://localhost:8005/a--b": {},
},
},
} {
c := caddy.NewTestController("http", test.input)
err := setup(c)