summaryrefslogtreecommitdiff
path: root/modules/caddyhttp/reverseproxy/addresses_test.go
diff options
context:
space:
mode:
authorFrancis Lavoie <lavofr@gmail.com>2023-05-15 14:14:50 -0400
committerGitHub <noreply@github.com>2023-05-15 12:14:50 -0600
commit75b690d248c7681dd974f6179c98a363af417a25 (patch)
treef0df0da211635df094d6b4b9aa6e3f58a7e577a0 /modules/caddyhttp/reverseproxy/addresses_test.go
parent52d7335c2b1b8424e8971a9b03f51a5f36583535 (diff)
reverseproxy: Expand port ranges to multiple upstreams in CLI + Caddyfile (#5494)
* reverseproxy: Expand port ranges to multiple upstreams in CLI + Caddyfile * Add clarifying comment
Diffstat (limited to 'modules/caddyhttp/reverseproxy/addresses_test.go')
-rw-r--r--modules/caddyhttp/reverseproxy/addresses_test.go38
1 files changed, 38 insertions, 0 deletions
diff --git a/modules/caddyhttp/reverseproxy/addresses_test.go b/modules/caddyhttp/reverseproxy/addresses_test.go
index 6355c75..0c7ad7b 100644
--- a/modules/caddyhttp/reverseproxy/addresses_test.go
+++ b/modules/caddyhttp/reverseproxy/addresses_test.go
@@ -150,6 +150,24 @@ func TestParseUpstreamDialAddress(t *testing.T) {
expectScheme: "h2c",
},
{
+ input: "localhost:1001-1009",
+ expectHostPort: "localhost:1001-1009",
+ },
+ {
+ input: "{host}:1001-1009",
+ expectHostPort: "{host}:1001-1009",
+ },
+ {
+ input: "http://localhost:1001-1009",
+ expectHostPort: "localhost:1001-1009",
+ expectScheme: "http",
+ },
+ {
+ input: "https://localhost:1001-1009",
+ expectHostPort: "localhost:1001-1009",
+ expectScheme: "https",
+ },
+ {
input: "unix//var/php.sock",
expectHostPort: "unix//var/php.sock",
},
@@ -197,6 +215,26 @@ func TestParseUpstreamDialAddress(t *testing.T) {
expectErr: true,
},
{
+ input: "http://localhost:8001-8002-8003",
+ expectErr: true,
+ },
+ {
+ input: "http://localhost:8001-8002/foo:bar",
+ expectErr: true,
+ },
+ {
+ input: "http://localhost:8001-8002/foo:1",
+ expectErr: true,
+ },
+ {
+ input: "http://localhost:8001-8002/foo:1-2",
+ expectErr: true,
+ },
+ {
+ input: "http://localhost:8001-8002#foo:1",
+ expectErr: true,
+ },
+ {
input: "http://foo:443",
expectErr: true,
},