[master] 51e92b4 Log calls http_ForceField() in VSL using xxxUnset
Federico G. Schwindt
fgsch at lodoss.net
Wed Mar 2 19:56:13 CET 2016
commit 51e92b447c64f88afa3feb368f41a1136711aaa8
Author: Federico G. Schwindt <fgsch at lodoss.net>
Date: Wed Mar 2 18:18:35 2016 +0000
Log calls http_ForceField() in VSL using xxxUnset
Previously we would force the protocol and method fields to HTTP/1.1 and
GET, respectively, but hide this from VSL showing 2 different entries
for BereqProtocol and/or BereqMethod.
Discussed with arianna at .
Fixes #1662
diff --git a/bin/varnishd/cache/cache_http.c b/bin/varnishd/cache/cache_http.c
index 7caaafd..8de17ec 100644
--- a/bin/varnishd/cache/cache_http.c
+++ b/bin/varnishd/cache/cache_http.c
@@ -752,11 +752,17 @@ http_GetMethod(const struct http *hp)
void
http_ForceField(const struct http *to, unsigned n, const char *t)
{
+ int i;
+
CHECK_OBJ_NOTNULL(to, HTTP_MAGIC);
assert(n < HTTP_HDR_FIRST);
AN(t);
- if (to->hd[n].b == NULL || strcmp(to->hd[n].b, t))
+ if (to->hd[n].b == NULL || strcmp(to->hd[n].b, t)) {
+ i = (HTTP_HDR_UNSET - HTTP_HDR_METHOD);
+ i += to->logtag;
+ VSLbt(to->vsl, (enum VSL_tag_e)i, to->hd[n]);
http_SetH(to, n, t);
+ }
}
/*--------------------------------------------------------------------*/
diff --git a/bin/varnishtest/tests/r01662.vtc b/bin/varnishtest/tests/r01662.vtc
new file mode 100644
index 0000000..84d4800
--- /dev/null
+++ b/bin/varnishtest/tests/r01662.vtc
@@ -0,0 +1,27 @@
+varnishtest "Unhide http_ForceField() calls in VSL"
+
+server s1 {
+ rxreq
+ expect req.method == "GET"
+ expect req.proto == "HTTP/1.1"
+ txresp
+} -start
+
+varnish v1 -vcl+backend {
+} -start
+
+logexpect l1 -v v1 -g request {
+ expect * 1001 ReqMethod "HEAD"
+ expect * = ReqProtocol "HTTP/1.0"
+ expect * 1002 BereqUnset "HEAD"
+ expect 0 = BereqMethod "GET"
+ expect * = BereqUnset "HTTP/1.0"
+ expect 0 = BereqProtocol "HTTP/1.1"
+} -start
+
+client c1 {
+ txreq -req HEAD -proto HTTP/1.0
+ rxresp
+} -run
+
+logexpect l1 -wait
More information about the varnish-commit
mailing list