Commit 2e22c1c3 authored by Poul-Henning Kamp's avatar Poul-Henning Kamp

I broke discarding old objects when they have been replaced

in c709e110.

Spotted by:	Martin
Test-case by:	Martin
parent 75b1392b
...@@ -186,7 +186,8 @@ vbf_stp_mkbereq(const struct worker *wrk, struct busyobj *bo) ...@@ -186,7 +186,8 @@ vbf_stp_mkbereq(const struct worker *wrk, struct busyobj *bo)
} else } else
AZ(bo->stale_oc); AZ(bo->stale_oc);
if (bo->stale_oc != NULL) { if (bo->stale_oc != NULL &&
ObjCheckFlag(bo->wrk, bo->stale_oc, OF_IMSCAND)) {
q = HTTP_GetHdrPack(bo->wrk, bo->stale_oc, H_Last_Modified); q = HTTP_GetHdrPack(bo->wrk, bo->stale_oc, H_Last_Modified);
if (q != NULL) if (q != NULL)
http_PrintfHeader(bo->bereq0, http_PrintfHeader(bo->bereq0,
...@@ -393,7 +394,8 @@ vbf_stp_startfetch(struct worker *wrk, struct busyobj *bo) ...@@ -393,7 +394,8 @@ vbf_stp_startfetch(struct worker *wrk, struct busyobj *bo)
AZ(bo->was_304); AZ(bo->was_304);
if (http_IsStatus(bo->beresp, 304)) { if (http_IsStatus(bo->beresp, 304)) {
if (bo->stale_oc != NULL) { if (bo->stale_oc != NULL &&
ObjCheckFlag(bo->wrk, bo->stale_oc, OF_IMSCAND)) {
if (ObjCheckFlag(bo->wrk, bo->stale_oc, OF_CHGGZIP)) { if (ObjCheckFlag(bo->wrk, bo->stale_oc, OF_CHGGZIP)) {
/* /*
* If we changed the gzip status of the object * If we changed the gzip status of the object
...@@ -904,12 +906,14 @@ vbf_fetch_thread(struct worker *wrk, void *priv) ...@@ -904,12 +906,14 @@ vbf_fetch_thread(struct worker *wrk, void *priv)
bo->wrk = wrk; bo->wrk = wrk;
wrk->vsl = bo->vsl; wrk->vsl = bo->vsl;
#if 0
if (bo->stale_oc != NULL) { if (bo->stale_oc != NULL) {
CHECK_OBJ_NOTNULL(bo->stale_oc, OBJCORE_MAGIC); CHECK_OBJ_NOTNULL(bo->stale_oc, OBJCORE_MAGIC);
/* We don't want the oc/stevedore ops in fetching thread */ /* We don't want the oc/stevedore ops in fetching thread */
if (!ObjCheckFlag(wrk, bo->stale_oc, OF_IMSCAND)) if (!ObjCheckFlag(wrk, bo->stale_oc, OF_IMSCAND))
(void)HSH_DerefObjCore(wrk, &bo->stale_oc); (void)HSH_DerefObjCore(wrk, &bo->stale_oc);
} }
#endif
while (stp != F_STP_DONE) { while (stp != F_STP_DONE) {
CHECK_OBJ_NOTNULL(bo, BUSYOBJ_MAGIC); CHECK_OBJ_NOTNULL(bo, BUSYOBJ_MAGIC);
......
varnishtest "purge stale on refresh with and without IMS"
server s1 {
rxreq
txresp -hdr "foo: bar"
rxreq
txresp -hdr "foo: bar" -hdr {ETag: "asdf"}
rxreq
txresp -hdr "foo: baz"
rxreq
expect req.http.if-none-match == {"asdf"}
txresp -status 304 -nolen -hdr "foo: baz"
} -start
varnish v1 -vcl+backend {
sub vcl_backend_response {
set beresp.ttl = 0.1s;
set beresp.grace = 0s;
set beresp.keep = 60s;
}
} -start
client c1 {
txreq -url /no-ims
rxresp
expect resp.http.foo == "bar"
txreq -url /ims
rxresp
expect resp.http.foo == "bar"
} -run
# Wait for ttl to expire on both objects
delay 0.2
varnish v1 -expect n_object == 2
client c1 {
txreq -url /no-ims
rxresp
expect resp.http.foo == "baz"
txreq -url /ims
rxresp
expect resp.http.foo == "baz"
} -run
# Make sure expiry is done
delay 1
# Only one of each of /no-ims and /ims should be left
varnish v1 -expect n_object == 2
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