Commit bf36a1c5 authored by Martin Blix Grydeland's avatar Martin Blix Grydeland

Fix the length recorded for truncated bans (it should be the length of

the header, not 0).

Add a test case for reload of truncated bans.

Fixes: #1266
parent 86dac723
......@@ -269,7 +269,7 @@ ban_mark_gone(struct ban *b)
b->flags |= BAN_F_GONE;
b->spec[BANS_FLAGS] |= BANS_FLAG_GONE;
VWMB();
vbe32enc(b->spec + BANS_LENGTH, 0);
vbe32enc(b->spec + BANS_LENGTH, BANS_HEAD_LEN);
VSC_C_main->bans_gone++;
VSC_C_main->bans_persisted_fragmentation += ln - ban_len(b->spec);
}
......
varnishtest "#1266 - Check persisted truncated gone bans"
# Test that bans which has been gone'd, truncated and persisted works
shell "rm -f ${tmpdir}/_.per1"
server s1 {
rxreq
txresp -hdr "x-foo: foo"
} -start
varnish v1 \
-arg "-pfeature=+wait_silo" \
-arg "-pban_lurker_sleep=0.01" \
-storage "-sper1=persistent,${tmpdir}/_.per1,10m" \
-vcl+backend {
}
varnish v1 -start
# Add a ban that will (with lurker help) become a truncated gone ban last
# in the list
varnish v1 -cliok "ban obj.http.x-foo == bar"
delay 1
# Add an object that will point to our ban
client c1 {
txreq
rxresp
expect resp.http.x-foo == "foo"
} -run
# Force a reload
varnish v1 -stop
varnish v1 -start
# Check that our object is still there
client c1 {
txreq
rxresp
expect resp.http.x-foo == "foo"
} -run
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