Commit 78e71553 authored by Federico G. Schwindt's avatar Federico G. Schwindt

Test the proxy related VSL tags

parent f94c7034
...@@ -30,10 +30,26 @@ varnish v1 -proto "PROXY" -vcl+backend { ...@@ -30,10 +30,26 @@ varnish v1 -proto "PROXY" -vcl+backend {
} }
} -start } -start
logexpect l1 -v v1 {
expect * 1002 ProxyGarbage "PROXY1: Too few fields"
expect * 1003 ProxyGarbage "PROXY1: Too many fields"
expect * 1004 ProxyGarbage "PROXY1: Wrong TCP\\[46\\] field"
expect * 1005 ProxyGarbage "PROXY1: Cannot resolve source address \\(nodename nor servname provided, or not known\\)"
expect * 1007 ProxyGarbage "PROXY1: Cannot resolve destination address \\(nodename nor servname provided, or not known\\)"
expect * 1013 ProxyGarbage "PROXY1: TCP4 got wrong protocol \\(30\\)"
expect * 1014 ProxyGarbage "PROXY1: TCP6 got wrong protocol \\(2\\)"
expect * 1015 Proxy "1 1.2.3.4 1234 5.6.7.8 5678"
expect * 1018 Proxy "1 1:f::2 1234 5:a::8 5678"
expect * 1021 Proxy "1 1:f::3 1234 5:a::8 5678"
expect * 1025 ProxyGarbage "PROXY1: Too many fields"
expect * 1026 ProxyGarbage "PROXY1: Too many fields"
} -start
client c1 { client c1 {
send "XYZ\r\n" send "XYZ\r\n"
expect_close expect_close
} -run } -run
delay .1 delay .1
client c1 { client c1 {
...@@ -41,6 +57,7 @@ client c1 { ...@@ -41,6 +57,7 @@ client c1 {
timeout 8 timeout 8
expect_close expect_close
} -run } -run
delay .1 delay .1
client c1 { client c1 {
...@@ -48,6 +65,7 @@ client c1 { ...@@ -48,6 +65,7 @@ client c1 {
timeout 8 timeout 8
expect_close expect_close
} -run } -run
delay .1 delay .1
client c1 { client c1 {
...@@ -55,6 +73,7 @@ client c1 { ...@@ -55,6 +73,7 @@ client c1 {
timeout 8 timeout 8
expect_close expect_close
} -run } -run
delay .1 delay .1
client c1 { client c1 {
...@@ -62,6 +81,7 @@ client c1 { ...@@ -62,6 +81,7 @@ client c1 {
timeout 8 timeout 8
expect_close expect_close
} -run } -run
delay .1 delay .1
client c1 { client c1 {
...@@ -69,6 +89,7 @@ client c1 { ...@@ -69,6 +89,7 @@ client c1 {
timeout 8 timeout 8
expect_close expect_close
} -run } -run
delay .1 delay .1
client c1 { client c1 {
...@@ -76,6 +97,7 @@ client c1 { ...@@ -76,6 +97,7 @@ client c1 {
timeout 8 timeout 8
expect_close expect_close
} -run } -run
delay .1 delay .1
client c1 { client c1 {
...@@ -83,6 +105,7 @@ client c1 { ...@@ -83,6 +105,7 @@ client c1 {
timeout 8 timeout 8
expect_close expect_close
} -run } -run
delay .1 delay .1
client c1 { client c1 {
...@@ -90,6 +113,7 @@ client c1 { ...@@ -90,6 +113,7 @@ client c1 {
timeout 8 timeout 8
expect_close expect_close
} -run } -run
delay .1 delay .1
client c1 { client c1 {
...@@ -97,6 +121,7 @@ client c1 { ...@@ -97,6 +121,7 @@ client c1 {
timeout 8 timeout 8
expect_close expect_close
} -run } -run
delay .1 delay .1
client c1 { client c1 {
...@@ -104,6 +129,7 @@ client c1 { ...@@ -104,6 +129,7 @@ client c1 {
timeout 8 timeout 8
expect_close expect_close
} -run } -run
delay .1 delay .1
client c1 { client c1 {
...@@ -111,6 +137,7 @@ client c1 { ...@@ -111,6 +137,7 @@ client c1 {
timeout 8 timeout 8
expect_close expect_close
} -run } -run
delay .1 delay .1
client c1 { client c1 {
...@@ -118,6 +145,7 @@ client c1 { ...@@ -118,6 +145,7 @@ client c1 {
timeout 8 timeout 8
expect_close expect_close
} -run } -run
delay .1 delay .1
client c1 { client c1 {
...@@ -125,6 +153,7 @@ client c1 { ...@@ -125,6 +153,7 @@ client c1 {
timeout 8 timeout 8
expect_close expect_close
} -run } -run
delay .1 delay .1
client c1 { client c1 {
...@@ -132,12 +161,8 @@ client c1 { ...@@ -132,12 +161,8 @@ client c1 {
timeout 8 timeout 8
expect_close expect_close
} -run } -run
delay .1
logexpect l1 -v v1 { delay .1
expect * * ReqStart "1.2.3.4 1234"
expect * * ReqStart "1:f::2 1234"
} -start
# Finally try something which works... # Finally try something which works...
client c1 -proxy1 "1.2.3.4:1234 5.6.7.8:5678" { client c1 -proxy1 "1.2.3.4:1234 5.6.7.8:5678" {
...@@ -153,6 +178,7 @@ client c1 -proxy1 "1.2.3.4:1234 5.6.7.8:5678" { ...@@ -153,6 +178,7 @@ client c1 -proxy1 "1.2.3.4:1234 5.6.7.8:5678" {
expect resp.http.ri != "1.2.3.4" expect resp.http.ri != "1.2.3.4"
expect resp.http.rp != "1234" expect resp.http.rp != "1234"
} -run } -run
delay .1 delay .1
client c1 -proxy1 "[1:f::2]:1234 [5:a::8]:5678" { client c1 -proxy1 "[1:f::2]:1234 [5:a::8]:5678" {
...@@ -168,9 +194,8 @@ client c1 -proxy1 "[1:f::2]:1234 [5:a::8]:5678" { ...@@ -168,9 +194,8 @@ client c1 -proxy1 "[1:f::2]:1234 [5:a::8]:5678" {
expect resp.http.ri != "1:f::2" expect resp.http.ri != "1:f::2"
expect resp.http.rp != "1234" expect resp.http.rp != "1234"
} -run } -run
delay .1
logexpect l1 -wait delay .1
# Try with appended request (See also: #1728) # Try with appended request (See also: #1728)
client c2 { client c2 {
...@@ -184,6 +209,7 @@ client c2 { ...@@ -184,6 +209,7 @@ client c2 {
send "PROXY TCP4 1.2.3.4 5.6.7.8 1234 5678\n" send "PROXY TCP4 1.2.3.4 5.6.7.8 1234 5678\n"
expect_close expect_close
} -run } -run
delay .1 delay .1
# Malformed, too long (106) # Malformed, too long (106)
...@@ -192,6 +218,7 @@ client c2 { ...@@ -192,6 +218,7 @@ client c2 {
send "PROXY TCP4 1.2.3.4 5.6.7.8 1234 5678 \r\n" send "PROXY TCP4 1.2.3.4 5.6.7.8 1234 5678 \r\n"
expect_close expect_close
} -run } -run
delay .1 delay .1
# Malformed, too long (107) # Malformed, too long (107)
...@@ -200,6 +227,7 @@ client c2 { ...@@ -200,6 +227,7 @@ client c2 {
send "PROXY TCP4 1.2.3.4 5.6.7.8 1234 5678 \r\n" send "PROXY TCP4 1.2.3.4 5.6.7.8 1234 5678 \r\n"
expect_close expect_close
} -run } -run
delay .1 delay .1
# Malformed, too long (108) # Malformed, too long (108)
...@@ -208,4 +236,7 @@ client c2 { ...@@ -208,4 +236,7 @@ client c2 {
send "PROXY TCP4 1.2.3.4 5.6.7.8 1234 5678 \r\n" send "PROXY TCP4 1.2.3.4 5.6.7.8 1234 5678 \r\n"
expect_close expect_close
} -run } -run
delay .1 delay .1
logexpect l1 -wait
...@@ -40,6 +40,17 @@ varnish v1 -proto "PROXY" -vcl+backend { ...@@ -40,6 +40,17 @@ varnish v1 -proto "PROXY" -vcl+backend {
} }
} -start } -start
logexpect l1 -v v1 -g raw {
expect * 1000 Proxy "2 local local local local"
expect * 1003 ProxyGarbage "PROXY2: bad command \\(2\\)"
expect * 1004 ProxyGarbage "PROXY2: Ignoring UNSPEC\\|UNSPEC addresses"
expect * 1006 ProxyGarbage "PROXY2: Ignoring unsupported protocol \\(0x99\\)"
expect * 1008 ProxyGarbage "PROXY2: Ignoring short IPv4 addresses \\(11\\)"
expect * 1010 ProxyGarbage "PROXY2: Ignoring short IPv6 addresses \\(35\\)"
expect * 1012 Proxy "2 1.2.3.4 2314 5.6.7.8 2828"
expect * 1015 Proxy "2 102:304:506::d0e:f10 2314 8182:8384:8586::8d8e:8f80 2828"
} -start
client c1 { client c1 {
# LOCAL command # LOCAL command
sendhex "0d 0a 0d 0a 00 0d 0a 51 55 49 54 0a" sendhex "0d 0a 0d 0a 00 0d 0a 51 55 49 54 0a"
...@@ -51,6 +62,7 @@ client c1 { ...@@ -51,6 +62,7 @@ client c1 {
expect resp.http.sp == "${v1_port}" expect resp.http.sp == "${v1_port}"
expect resp.http.ci == "${localhost}" expect resp.http.ci == "${localhost}"
} -run } -run
delay .1 delay .1
client c1 { client c1 {
...@@ -60,6 +72,7 @@ client c1 { ...@@ -60,6 +72,7 @@ client c1 {
timeout 8 timeout 8
expect_close expect_close
} -run } -run
delay .1 delay .1
client c1 { client c1 {
...@@ -73,6 +86,7 @@ client c1 { ...@@ -73,6 +86,7 @@ client c1 {
expect resp.http.sp == "${v1_port}" expect resp.http.sp == "${v1_port}"
expect resp.http.ci == "${localhost}" expect resp.http.ci == "${localhost}"
} -run } -run
delay .1 delay .1
client c1 { client c1 {
...@@ -86,6 +100,7 @@ client c1 { ...@@ -86,6 +100,7 @@ client c1 {
expect resp.http.sp == "${v1_port}" expect resp.http.sp == "${v1_port}"
expect resp.http.ci == "${localhost}" expect resp.http.ci == "${localhost}"
} -run } -run
delay .1 delay .1
client c1 { client c1 {
...@@ -100,6 +115,7 @@ client c1 { ...@@ -100,6 +115,7 @@ client c1 {
expect resp.http.sp == "${v1_port}" expect resp.http.sp == "${v1_port}"
expect resp.http.ci == "${localhost}" expect resp.http.ci == "${localhost}"
} -run } -run
delay .1 delay .1
client c1 { client c1 {
...@@ -136,6 +152,7 @@ client c1 -proxy2 "1.2.3.4:2314 5.6.7.8:2828" { ...@@ -136,6 +152,7 @@ client c1 -proxy2 "1.2.3.4:2314 5.6.7.8:2828" {
expect resp.http.lp == "${v1_port}" expect resp.http.lp == "${v1_port}"
expect resp.http.ri != "1.2.3.4" expect resp.http.ri != "1.2.3.4"
} -run } -run
delay .1 delay .1
# good IPv6 # good IPv6
...@@ -155,4 +172,7 @@ client c1 \ ...@@ -155,4 +172,7 @@ client c1 \
expect resp.http.lp == "${v1_port}" expect resp.http.lp == "${v1_port}"
expect resp.http.ri != "102:304:506::d0e:f10" expect resp.http.ri != "102:304:506::d0e:f10"
} -run } -run
delay .1 delay .1
logexpect l1 -wait
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment