[master] 1087f15 Send PROXY v2 LOCAL header with probes

Dridi Boukelmoune dridi.boukelmoune at gmail.com
Mon Mar 6 13:55:07 CET 2017


commit 1087f15425daca463d137d5ba187fdb0c5c32026
Author: Dridi Boukelmoune <dridi.boukelmoune at gmail.com>
Date:   Fri Mar 3 14:03:36 2017 +0100

    Send PROXY v2 LOCAL header with probes
    
    Fixes #2151

diff --git a/bin/varnishd/cache/cache_backend_probe.c b/bin/varnishd/cache/cache_backend_probe.c
index 9f451c7..e862431 100644
--- a/bin/varnishd/cache/cache_backend_probe.c
+++ b/bin/varnishd/cache/cache_backend_probe.c
@@ -92,6 +92,11 @@ static struct lock			vbp_mtx;
 static pthread_cond_t			vbp_cond;
 static struct binheap			*vbp_heap;
 
+static unsigned char vbp_proxy_local[] = {
+	0x0d, 0x0a, 0x0d, 0x0a, 0x00, 0x0d, 0x0a, 0x51,
+	0x55, 0x49, 0x54, 0x0a, 0x20, 0x00, 0x00, 0x00,
+};
+
 /*--------------------------------------------------------------------*/
 
 static void
@@ -300,8 +305,9 @@ vbp_poke(struct vbp_target *vt)
 	if (vt->backend->proxy_header == 1) {
 		if (vbp_write_proxy_v1(vt, s) != 0)
 			return;
-	} else if (vt->backend->proxy_header == 2)
-		INCOMPL();
+	} else if (vt->backend->proxy_header == 2 &&
+	    vbp_write(vt, s, vbp_proxy_local, sizeof vbp_proxy_local) != 0)
+		return;
 
 	/* Send the request */
 	if (vbp_write(vt, s, vt->req, vt->req_len) != 0)
diff --git a/bin/varnishtest/tests/o00004.vtc b/bin/varnishtest/tests/o00004.vtc
index 03c67d5..4d4c082 100644
--- a/bin/varnishtest/tests/o00004.vtc
+++ b/bin/varnishtest/tests/o00004.vtc
@@ -21,7 +21,7 @@ varnish v1 -proto PROXY -vcl+backend {
 varnish v2 -proto PROXY -vcl {
 	import std;
 
-	probe p {
+	probe default {
 		.window = 1;
 		.threshold = 1;
 		.interval =0.5s;
@@ -30,7 +30,6 @@ varnish v2 -proto PROXY -vcl {
 		.host = "${v1_addr}";
 		.port = "${v1_port}";
 		.proxy_header = 1;
-		.probe = p;
 	}
 	backend bp2 {
 		.host = "${v1_addr}";
@@ -48,3 +47,4 @@ server s1 -wait
 
 delay 1
 varnish v2 -cliexpect "vcl1.bp1[ ]+probe[ ]+Healthy[ ]+1/1" backend.list
+varnish v2 -cliexpect "vcl1.bp2[ ]+probe[ ]+Healthy[ ]+1/1" backend.list



More information about the varnish-commit mailing list