Commit 51e92b44 authored by Federico G. Schwindt's avatar Federico G. Schwindt

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@.

Fixes #1662
parent 934964d9
......@@ -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);
}
}
/*--------------------------------------------------------------------*/
......
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
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