Commit b581c6da authored by Nils Goroll's avatar Nils Goroll

mark that the tree isgzip status is also to be replaced

gzip status needs to be per esi inlcude (= per nexus):

If the esi is gzipped and is used in an ungzip context, the ungzip vdp
gets pushed by varnish-cache, yet still all content below needs to be
(pretend-)gzipped for that ungzip to work.
parent d2cbdfd6
......@@ -216,7 +216,7 @@ struct bytes_tree {
int npending;
uint32_t bad_crc;
int retval;
int isgzip:1;
int bad_isgzip:1;
};
/*
......@@ -939,7 +939,7 @@ vped_include(struct req *preq, const char *src, const char *host,
/* Set Accept-Encoding according to what we want */
http_Unset(req->http, H_Accept_Encoding);
if (tree->isgzip)
if (tree->bad_isgzip)
http_ForceHeader(req->http, H_Accept_Encoding, "gzip");
/* Client content already taken care of */
......@@ -1184,7 +1184,7 @@ bytes_unpend_worklist(struct req *req, struct bytes_tree *tree,
const uint8_t *t = p;
VSLdbg(req, "bytes_unpend: gzip-in-gzip tailbuf");
AN(tree->isgzip);
AN(tree->bad_isgzip);
AN(t);
icrc = vle32dec(t);
ilen = vle32dec(t + 4);
......@@ -1623,7 +1623,7 @@ pesi_buf_bytes(struct req *req, enum vdp_action act, void **priv,
const uint8_t *t = ptr;
VSLdbg(req, "bytes_add: gzip-in-gzip tailbuf");
AN(tree->isgzip);
AN(tree->bad_isgzip);
AN(t);
icrc = vle32dec(t);
ilen = vle32dec(t + 4);
......@@ -1810,9 +1810,9 @@ push_vdps_esi(struct req *req)
}
i = ObjCheckFlag(req->wrk, req->objcore, OF_GZIPED);
VSLdbgv(req, "push_vdps_esi: OF_GZIPED=%d tree->isgzip=%d RES_ESI=%d",
i, tree->isgzip, (req->res_mode & RES_ESI) == 0);
if (tree->isgzip && i && !(req->res_mode & RES_ESI)) {
VSLdbgv(req, "push_vdps_esi: OF_GZIPED=%d tree->bad_isgzip=%d RES_ESI=%d",
i, tree->bad_isgzip, (req->res_mode & RES_ESI) == 0);
if (tree->bad_isgzip && i && !(req->res_mode & RES_ESI)) {
/* A gzip'ed include which is not ESI processed */
VSLdbg(req, "push_vdps_esi: pushing bad_gzgz");
......@@ -1826,7 +1826,7 @@ push_vdps_esi(struct req *req)
XXXAZ(VDP_Push(req, &bad_gzgz, foo));
VDP_Push(req, &VDP_pesi_buf, tree);
}
else if (tree->isgzip && !i) {
else if (tree->bad_isgzip && !i) {
VSLdbg(req, "push_vdps_esi: pushing bad_pretend_gz");
/* Non-Gzip'ed include in gzip'ed parent */
XXXAZ(VDP_Push(req, &bad_pretend_gz, pecx));
......@@ -1880,9 +1880,9 @@ push_vdps_NOesi(struct req *req)
}
i = ObjCheckFlag(req->wrk, req->objcore, OF_GZIPED);
VSLdbgv(req, "push_vdps_NOesi: OF_GZIPED=%d tree->isgzip=%d RES_ESI=%d",
i, tree->isgzip, (req->res_mode & RES_ESI) == 0);
if (tree->isgzip && i && !(req->res_mode & RES_ESI)) {
VSLdbgv(req, "push_vdps_NOesi: OF_GZIPED=%d tree->bad_isgzip=%d RES_ESI=%d",
i, tree->bad_isgzip, (req->res_mode & RES_ESI) == 0);
if (tree->bad_isgzip && i && !(req->res_mode & RES_ESI)) {
/* A gzip'ed include which is not ESI processed */
VSLdbg(req, "push_vdps_NOesi: pushing bad_gzgz");
......@@ -1895,7 +1895,7 @@ push_vdps_NOesi(struct req *req)
foo->pecx = pecx;
XXXAZ(VDP_Push(req, &bad_gzgz, foo));
}
else if (tree->isgzip && !i) {
else if (tree->bad_isgzip && !i) {
VSLdbg(req, "push_vdps_NOesi: pushing bad_pretend_gz");
/* Non-Gzip'ed include in gzip'ed parent */
XXXAZ(VDP_Push(req, &bad_pretend_gz, pecx));
......@@ -2160,7 +2160,7 @@ vdp_pesi_bytes(struct req *req, enum vdp_action act, void **priv,
CAST_OBJ_NOTNULL(ppesi, req->transport_priv, PESI_MAGIC);
ppecx = ppesi->pecx;
CHECK_OBJ_NOTNULL(ppecx, PECX_MAGIC);
if (!tree->isgzip)
if (!tree->bad_isgzip)
ppecx = NULL;
}
......@@ -2180,7 +2180,7 @@ vdp_pesi_bytes(struct req *req, enum vdp_action act, void **priv,
gzip_hdr, 10);
tree->bad_l_crc = 0;
tree->bad_crc = crc32(0L, Z_NULL, 0);
tree->isgzip = 1;
tree->bad_isgzip = 1;
pecx->p++;
}
pecx->state = 1;
......@@ -2198,7 +2198,7 @@ vdp_pesi_bytes(struct req *req, enum vdp_action act, void **priv,
if (pecx->l < 0)
return (-1);
Debug("VEC_V(%d)\n", (int)pecx->l);
if (tree->isgzip) {
if (tree->bad_isgzip) {
assert(*pecx->p == VEC_C1 ||
*pecx->p == VEC_C2 ||
*pecx->p == VEC_C8);
......@@ -2267,7 +2267,7 @@ vdp_pesi_bytes(struct req *req, enum vdp_action act, void **priv,
}
break;
case 2:
if (tree->isgzip && ppecx == NULL) {
if (tree->bad_isgzip && ppecx == NULL) {
AN(gzip_fini);
VSLdbgv(req, "ved_vdp: push gzip_fini=%p "
"pecx=%p", gzip_fini, pecx);
......@@ -2514,9 +2514,9 @@ vped_deliver(struct req *req, struct boc *boc, int wantbody)
/* XXX needed ??? */
i = ObjCheckFlag(req->wrk, req->objcore, OF_GZIPED);
VSLdbgv(req, "vped_deliver: OF_GZIPED=%d tree->isgzip=%d RES_ESI=%d",
i, tree->isgzip, req->res_mode & RES_ESI);
if (tree->isgzip && i && !(req->res_mode & RES_ESI)) {
VSLdbgv(req, "vped_deliver: OF_GZIPED=%d tree->bad_isgzip=%d RES_ESI=%d",
i, tree->bad_isgzip, req->res_mode & RES_ESI);
if (tree->bad_isgzip && i && !(req->res_mode & RES_ESI)) {
/* OA_GZIPBITS are not valid until BOS_FINISHED */
if (boc != NULL)
ObjWaitState(req->objcore, BOS_FINISHED);
......
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