[master] 2200493 Get the field order right for PROXYv1

Poul-Henning Kamp phk at FreeBSD.org
Tue Apr 28 16:14:13 CEST 2015


commit 22004936371ff45d3cbdb8feffdcd88994dd2090
Author: Poul-Henning Kamp <phk at FreeBSD.org>
Date:   Tue Apr 28 14:13:53 2015 +0000

    Get the field order right for PROXYv1
    
    Fixes #1727

diff --git a/bin/varnishd/proxy/cache_proxy_proto.c b/bin/varnishd/proxy/cache_proxy_proto.c
index 299777f..6ddcae5 100644
--- a/bin/varnishd/proxy/cache_proxy_proto.c
+++ b/bin/varnishd/proxy/cache_proxy_proto.c
@@ -110,7 +110,7 @@ vpx_proto1(const struct worker *wrk, struct req *req)
 	hints.ai_socktype = SOCK_STREAM;
 	hints.ai_flags = AI_NUMERICHOST | AI_NUMERICSERV;
 
-	i = getaddrinfo(fld[1], fld[2], &hints, &res);
+	i = getaddrinfo(fld[1], fld[3], &hints, &res);
 	if (i != 0) {
 		VSLb(req->vsl, SLT_ProxyGarbage,
 		    "PROXY1: Cannot resolve source address (%s)",
@@ -131,7 +131,7 @@ vpx_proto1(const struct worker *wrk, struct req *req)
 	SES_Set_String_Attr(req->sp, SA_CLIENT_PORT, fld[2]);
 	freeaddrinfo(res);
 
-	i = getaddrinfo(fld[3], fld[4], &hints, &res);
+	i = getaddrinfo(fld[2], fld[4], &hints, &res);
 	if (i != 0) {
 		VSLb(req->vsl, SLT_ProxyGarbage,
 		    "PROXY1: Cannot resolve destination address (%s)",
@@ -151,7 +151,7 @@ vpx_proto1(const struct worker *wrk, struct req *req)
 	freeaddrinfo(res);
 
 	VSLb(req->vsl, SLT_Proxy, "1 %s %s %s %s",
-	    fld[1], fld[2], fld[3], fld[4]);
+	    fld[1], fld[3], fld[2], fld[4]);
 	req->htc->pipeline_b = q;
 	return (0);
 }
diff --git a/bin/varnishtest/tests/o00000.vtc b/bin/varnishtest/tests/o00000.vtc
index ef535e2..6af0abc 100644
--- a/bin/varnishtest/tests/o00000.vtc
+++ b/bin/varnishtest/tests/o00000.vtc
@@ -71,14 +71,14 @@ client c1 {
 delay .1
 
 client c1 {
-	send "PROXY TCP4 1.2.3.4 1234 D E\r\n"
+	send "PROXY TCP4 1.2.3.4 D 1234 E\r\n"
 	timeout 8
 	expect_close
 } -run
 delay .1
 
 client c1 {
-	send "PROXY TCP4 1.2.3.4 1234 5.6.7.8 E\r\n"
+	send "PROXY TCP4 1.2.3.4 5.6.7.8 1234 E\r\n"
 	timeout 8
 	expect_close
 } -run
@@ -106,21 +106,21 @@ client c1 {
 delay .1
 
 client c1 {
-	send "PROXY TCP6 1:f::2 1234 5:a::8 E\r\n"
+	send "PROXY TCP6 1:f::2 5:a::8 1234 E\r\n"
 	timeout 8
 	expect_close
 } -run
 delay .1
 
 client c1 {
-	send "PROXY TCP4 1:f::2 1234 5:a::8 5678\r\n"
+	send "PROXY TCP4 1:f::2 5:a::8 1234 5678\r\n"
 	timeout 8
 	expect_close
 } -run
 delay .1
 
 client c1 {
-	send "PROXY TCP6 1.2.3.4 1234 5.6.7.8 5678\r\n"
+	send "PROXY TCP6 1.2.3.4 5.6.7.8 1234 5678\r\n"
 	timeout 8
 	expect_close
 } -run
@@ -128,7 +128,7 @@ delay .1
 
 # Finally try something which works...
 client c1 {
-	send "PROXY TCP4 1.2.3.4 1234 5.6.7.8 5678\r\n"
+	send "PROXY TCP4 1.2.3.4 5.6.7.8 1234 5678\r\n"
 	txreq
 	rxresp
 	expect resp.http.ci == "1.2.3.4"
@@ -143,7 +143,7 @@ client c1 {
 delay .1
 
 client c1 {
-	send "PROXY TCP6 1:f::2 1234 5:a::8 5678\r\n"
+	send "PROXY TCP6 1:f::2 5:a::8 1234 5678\r\n"
 	txreq
 	rxresp
 	expect resp.http.ci == "1:f::2"



More information about the varnish-commit mailing list