[master] 1000b772c varnishncsa: -E implies -c

Dridi Boukelmoune dridi.boukelmoune at gmail.com
Mon Jan 18 16:06:07 UTC 2021


commit 1000b772c2c18c9e5e4d787589357cec1edaaf61
Author: Dridi Boukelmoune <dridi.boukelmoune at gmail.com>
Date:   Fri Nov 13 14:49:07 2020 +0100

    varnishncsa: -E implies -c
    
    Otherwise the combination of -E and -b only outputs backend requests.

diff --git a/bin/varnishncsa/varnishncsa.c b/bin/varnishncsa/varnishncsa.c
index 9078eed92..1bdf8fb09 100644
--- a/bin/varnishncsa/varnishncsa.c
+++ b/bin/varnishncsa/varnishncsa.c
@@ -1157,7 +1157,7 @@ main(int argc, char * const *argv)
 		}
 	}
 	/* default is client mode: */
-	if (!CTX.b_opt)
+	if (!CTX.b_opt || CTX.E_opt)
 		CTX.c_opt = 1;
 
 	if (optind != argc)
diff --git a/bin/varnishncsa/varnishncsa_options.h b/bin/varnishncsa/varnishncsa_options.h
index fb9ab474d..8c86761ed 100644
--- a/bin/varnishncsa/varnishncsa_options.h
+++ b/bin/varnishncsa/varnishncsa_options.h
@@ -70,13 +70,13 @@
 	    " backend requests will trigger log lines."			\
 	)
 #define NCSA_OPT_c							\
-	VOPT("c", "[-c]", "Client mode",					\
+	VOPT("c", "[-c]", "Client mode",				\
 	    "Log client requests. This is the default. If -b is"	\
 	    " specified, then -c is needed to also log client requests"	\
 	)
 #define NCSA_OPT_E							\
-	VOPT("E", "[-E]", "Show ESI request",				\
-	    "Show ESI request."	\
+	VOPT("E", "[-E]", "Show ESI requests",				\
+	    "Show ESI requests, implies client mode."			\
 	)
 
 NCSA_OPT_a
diff --git a/bin/varnishtest/tests/e00003.vtc b/bin/varnishtest/tests/e00003.vtc
index c93c6aec1..1e73e27df 100644
--- a/bin/varnishtest/tests/e00003.vtc
+++ b/bin/varnishtest/tests/e00003.vtc
@@ -1,6 +1,5 @@
 varnishtest "ESI include"
 
-
 server s1 {
 	rxreq
 	expect req.http.esi0 == "foo"
@@ -92,3 +91,19 @@ logexpect l2 -wait
 logexpect l3 -wait
 logexpect l4 -wait
 logexpect l5 -wait
+
+shell {
+	varnishncsa -n ${v1_name} -d -b -E \
+		-F '%{Varnish:vxid}x %{Varnish:side}x %{VSL:Begin[3]}x' |
+	sort > ncsa.txt
+
+	cat >expected.txt <<-EOF
+	1001 c rxreq
+	1002 b fetch
+	1003 c esi
+	1004 b fetch
+	1005 c rxreq
+	1006 c esi
+	EOF
+	diff -u expected.txt ncsa.txt
+}


More information about the varnish-commit mailing list