Commit 5375a6cf authored by Shohei Tanaka(@xcir)'s avatar Shohei Tanaka(@xcir) Committed by Poul-Henning Kamp

Add show ESI option(-e)

parent f4dcf8f0
...@@ -140,6 +140,7 @@ static struct ctx { ...@@ -140,6 +140,7 @@ static struct ctx {
int a_opt; int a_opt;
int b_opt; int b_opt;
int c_opt; int c_opt;
int e_opt;
char *w_arg; char *w_arg;
FILE *fo; FILE *fo;
...@@ -891,7 +892,7 @@ dispatch_f(struct VSL_data *vsl, struct VSL_transaction * const pt[], ...@@ -891,7 +892,7 @@ dispatch_f(struct VSL_data *vsl, struct VSL_transaction * const pt[],
be_mark = BACKEND_MARKER; be_mark = BACKEND_MARKER;
} else } else
continue; continue;
if (t->reason == VSL_r_esi) if (t->reason == VSL_r_esi && !CTX.e_opt)
/* Skip ESI requests */ /* Skip ESI requests */
continue; continue;
CTX.hitmiss = "-"; CTX.hitmiss = "-";
...@@ -1111,6 +1112,10 @@ main(int argc, char * const *argv) ...@@ -1111,6 +1112,10 @@ main(int argc, char * const *argv)
/* client mode */ /* client mode */
CTX.c_opt = 1; CTX.c_opt = 1;
break; break;
case 'e':
/* show ESI */
CTX.e_opt = 1;
break;
case 'F': case 'F':
if (format != NULL) if (format != NULL)
VUT_Error(vut, 1, "Format already set"); VUT_Error(vut, 1, "Format already set");
......
...@@ -72,10 +72,15 @@ ...@@ -72,10 +72,15 @@
"Log client requests. This is the default. If -b is" \ "Log client requests. This is the default. If -b is" \
" specified, then -c is needed to also log client requests" \ " specified, then -c is needed to also log client requests" \
) )
#define NCSA_OPT_e \
VOPT("e", "[-e]", "Show ESI request", \
"Show ESI request." \
)
NCSA_OPT_a NCSA_OPT_a
NCSA_OPT_b NCSA_OPT_b
NCSA_OPT_c NCSA_OPT_c
NCSA_OPT_e
VSL_OPT_C VSL_OPT_C
VUT_OPT_d VUT_OPT_d
VUT_GLOBAL_OPT_D VUT_GLOBAL_OPT_D
......
varnishtest "varnishncsa show ESI request"
server s1 {
rxreq
txresp -body {
<html>
Before include
<esi:include src="/esi"/>
After include
</html>
}
rxreq
txresp -body {
Included file
}
} -start
varnish v1 -vcl+backend {
sub vcl_backend_response {
set beresp.do_esi = true;
}
} -start
client c1 {
txreq
rxresp
} -run
shell -match "^0$" "varnishncsa -n ${v1_name} -d -q \"requrl ~ '/esi'\" | wc -l"
shell -match "^1$" "varnishncsa -n ${v1_name} -d -q \"requrl ~ '/esi'\" -e | wc -l"
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