[master] c48e48a Fix IMS fetching of ESI objects.
Poul-Henning Kamp
phk at FreeBSD.org
Tue Mar 4 11:23:05 CET 2014
commit c48e48ad2cbf2bb4b8e957baeeed2784123dffd1
Author: Poul-Henning Kamp <phk at FreeBSD.org>
Date: Tue Mar 4 10:22:43 2014 +0000
Fix IMS fetching of ESI objects.
Fixes #1442
diff --git a/bin/varnishd/cache/cache_fetch.c b/bin/varnishd/cache/cache_fetch.c
index 8672375..2d5f5ae 100644
--- a/bin/varnishd/cache/cache_fetch.c
+++ b/bin/varnishd/cache/cache_fetch.c
@@ -584,7 +584,14 @@ vbf_stp_condfetch(struct worker *wrk, struct busyobj *bo)
obj->gzip_last = bo->ims_obj->gzip_last;
obj->gzip_stop = bo->ims_obj->gzip_stop;
- XXXAZ(bo->ims_obj->esidata);
+ if (bo->ims_obj->esidata != NULL) {
+ obj->esidata = STV_alloc(bo, bo->ims_obj->esidata->len);
+ XXXAN(obj->esidata);
+ xxxassert(obj->esidata->space >= bo->ims_obj->esidata->len);
+ memcpy(obj->esidata->ptr, bo->ims_obj->esidata->ptr,
+ bo->ims_obj->esidata->len);
+ obj->esidata->len = bo->ims_obj->esidata->len;
+ }
if (bo->ims_obj->vary != NULL) {
obj->vary = (void *)WS_Copy(obj->http->ws,
@@ -601,10 +608,10 @@ vbf_stp_condfetch(struct worker *wrk, struct busyobj *bo)
AZ(WS_Overflowed(bo->ws_o));
- VBO_setstate(bo, BOS_STREAM);
+ if (bo->do_stream)
+ VBO_setstate(bo, BOS_STREAM);
HSH_Unbusy(&wrk->stats, obj->objcore);
-
st = NULL;
al = 0;
diff --git a/bin/varnishtest/tests/r01442.vtc b/bin/varnishtest/tests/r01442.vtc
new file mode 100644
index 0000000..939d5c9
--- /dev/null
+++ b/bin/varnishtest/tests/r01442.vtc
@@ -0,0 +1,31 @@
+varnishtest "ESI + IMS"
+
+server s1 {
+ rxreq
+ txresp -hdr "Last-Modified: Thu, 26 Jun 2008 12:00:01 GMT" \
+ -body {<html><esi:remove>bla bla bla</esi:remove></html>}
+ rxreq
+ expect req.http.if-modified-since == "Thu, 26 Jun 2008 12:00:01 GMT"
+ txresp -status "304" -hdr "Last-Modified: Thu, 26 Jun 2008 12:00:01 GMT" -nolen
+
+} -start
+
+varnish v1 -vcl+backend {
+ sub vcl_backend_response {
+ set beresp.do_esi = true;
+ set beresp.grace = 0s;
+ set beresp.keep = 60s;
+ set beresp.ttl = 1s;
+ }
+} -start
+
+client c1 {
+ txreq
+ rxresp
+ expect resp.bodylen == 13
+ delay 3
+ txreq
+ rxresp
+ expect resp.bodylen == 13
+} -run
+
More information about the varnish-commit
mailing list