[master] 49a2600e7 Quote VSL fields that are known to contain spaces
Dridi Boukelmoune
dridi.boukelmoune at gmail.com
Thu Oct 24 16:58:06 UTC 2019
commit 49a2600e71959b7989197013d16c7560d1fb0fb8
Author: Dridi Boukelmoune <dridi.boukelmoune at gmail.com>
Date: Fri Dec 21 11:09:03 2018 +0100
Quote VSL fields that are known to contain spaces
The test case covers the last field of Backend_health records.
diff --git a/bin/varnishd/cache/cache_acceptor.c b/bin/varnishd/cache/cache_acceptor.c
index 0b7c5cede..9e86c9b62 100644
--- a/bin/varnishd/cache/cache_acceptor.c
+++ b/bin/varnishd/cache/cache_acceptor.c
@@ -508,7 +508,7 @@ vca_accept_task(struct worker *wrk, void *arg)
lport, VTCP_PORTBUFSIZE);
}
- VSL(SLT_SessError, 0, "%s %s %s %d %d %s",
+ VSL(SLT_SessError, 0, "%s %s %s %d %d \"%s\"",
wa.acceptlsock->name, laddr, lport,
ls->sock, i, vstrerror(i));
(void)Pool_TrySumstat(wrk);
diff --git a/bin/varnishd/cache/cache_backend_probe.c b/bin/varnishd/cache/cache_backend_probe.c
index 571154859..d51da01a2 100644
--- a/bin/varnishd/cache/cache_backend_probe.c
+++ b/bin/varnishd/cache/cache_backend_probe.c
@@ -181,7 +181,7 @@ VBP_Update_Backend(struct vbp_target *vt)
vt->backend->sick = i;
AN(dir->vcl_name);
- VSL(SLT_Backend_health, 0, "%s %s %s %s %u %u %u %.6f %.6f %s",
+ VSL(SLT_Backend_health, 0, "%s %s %s %s %u %u %u %.6f %.6f \"%s\"",
dir->vcl_name, chg ? "Went" : "Still",
i ? "sick" : "healthy", bits,
vt->good, vt->threshold, vt->window,
diff --git a/bin/varnishtest/tests/r02872.vtc b/bin/varnishtest/tests/r02872.vtc
index e43af59cb..657cd6c7f 100644
--- a/bin/varnishtest/tests/r02872.vtc
+++ b/bin/varnishtest/tests/r02872.vtc
@@ -1,8 +1,16 @@
varnishtest "VSL quoted fields"
+server s1 {
+ rxreq
+ txresp
+} -start
+
varnish v1 -vcl {
import std;
- backend be none;
+ backend be {
+ .host = "${s1_sock}";
+ .probe = { .interval = 1m; }
+ }
sub vcl_recv {
# a series of 3-fields log records
std.log({" custom log "ok" "});
@@ -24,3 +32,10 @@ client c1 {
shell -expect "2" {
varnishlog -d -n ${v1_name} -g raw -q 'VCL_Log[3]' | wc -l
}
+
+server s1 -wait
+
+shell -expect "Went healthy" {
+ varnishlog -d -n ${v1_name} -g raw \
+ -q 'Backend_health[10] eq "HTTP/1.1 200 OK"'
+}
diff --git a/include/tbl/vsl_tags.h b/include/tbl/vsl_tags.h
index 905042cbe..f38f2f3c2 100644
--- a/include/tbl/vsl_tags.h
+++ b/include/tbl/vsl_tags.h
@@ -191,7 +191,7 @@ SLTM(Length, 0, "Size of object body",
SLTM(FetchError, 0, "Error while fetching object",
"Logs the error message of a failed fetch operation.\n\n"
- "Error messages should be self-explanatory, yet the http connection"
+ "Error messages should be self-explanatory, yet the http connection\n"
"(HTC) class of errors is reported with these symbols:\n\n"
"\t* junk (-5): Received unexpected data\n"
"\t* close (-4): Connection closed\n"
@@ -272,11 +272,11 @@ SLTM(TTL, 0, "TTL set on object",
SLTM(Fetch_Body, 0, "Body fetched from backend",
"Ready to fetch body from backend.\n\n"
"The format is::\n\n"
- "\t%d (%s) %s\n"
- "\t| | |\n"
- "\t| | +---- 'stream' or '-'\n"
- "\t| +--------- Text description of body fetch mode\n"
- "\t+------------- Body fetch mode\n"
+ "\t%d %s %s\n"
+ "\t| | |\n"
+ "\t| | +---- 'stream' or '-'\n"
+ "\t| +------- Text description of body fetch mode\n"
+ "\t+---------- Body fetch mode\n"
"\n"
)
More information about the varnish-commit
mailing list