Commit fd081460 authored by Poul-Henning Kamp's avatar Poul-Henning Kamp

Add another easy bit of code: including a ungzip'ed non-ESI object

in an gzip'ed ESI object.
parent 66e7a250
......@@ -815,6 +815,7 @@ char *VRT_String(struct ws *ws, const char *h, const char *p, va_list ap);
char *VRT_StringList(char *d, unsigned dl, const char *p, va_list ap);
void ESI_Deliver(struct sess *);
void ESI_DeliverChild(struct sess *);
/* cache_vrt_vmod.c */
void VMOD_Init(void);
......
......@@ -333,3 +333,20 @@ ESI_Deliver(struct sess *sp)
}
(void)WRW_Flush(sp->wrk);
}
/*---------------------------------------------------------------------
* Include an object in a gzip'ed ESI object delivery
*/
void
ESI_DeliverChild(struct sess *sp)
{
struct storage *st;
if (sp->obj->gziped) {
INCOMPL();
} else {
VTAILQ_FOREACH(st, &sp->obj->store, list)
ved_pretend_gzip(sp, st->ptr, st->len);
}
}
......@@ -390,6 +390,8 @@ RES_WriteObj(struct sess *sp)
/* Nothing to do here */
} else if (sp->wrk->res_mode & RES_ESI) {
ESI_Deliver(sp);
} else if (sp->wrk->res_mode & RES_ESI_CHILD && sp->wrk->gzip_resp) {
ESI_DeliverChild(sp);
} else if (sp->wrk->res_mode & RES_GUNZIP) {
res_WriteGunzipObj(sp);
} else {
......
# $Id$
test "Include an ungzip'ed ESI object in a gzip'ed ESI object"
test "Include an ungzip'ed (ESI) object in a gzip'ed ESI object"
server s1 {
rxreq
expect req.http.accept-encoding == gzip
txresp -gzipbody {
<html> 1
Before include 2
Before includes 2
<esi:include src="/foo"/> 3
After include 4
Between includes 4
<esi:include src="/bar"/> 5
After includes 6
}
rxreq
expect req.url == "/foo"
txresp -body {<h1>/////<h2>}
rxreq
expect req.url == "/bar"
txresp -body {*****}
} -start
varnish v1 -vcl+backend {
......@@ -33,7 +38,7 @@ client c1 {
expect resp.http.content-encoding == gzip
gunzip
expect resp.status == 200
expect resp.bodylen == 79
expect resp.bodylen == 115
}
client c1 -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