Commit 974857ec authored by Nils Goroll's avatar Nils Goroll

avoid the magic pointer for gzip headers, use T_CRC

parent fb0d4d2c
...@@ -558,6 +558,13 @@ push_subreq(struct req *req, struct bytes_tree *tree, ...@@ -558,6 +558,13 @@ push_subreq(struct req *req, struct bytes_tree *tree,
return (tree->retval); return (tree->retval);
} }
static const uint8_t gzip_hdr[] = {
0x1f, 0x8b, 0x08,
0x00, 0x00, 0x00, 0x00,
0x00,
0x02, 0x03
};
static void static void
gzip_tailbuf(uint8_t tailbuf[GZIP_TAILBUF_SZ], struct nexus_gzip *gz) gzip_tailbuf(uint8_t tailbuf[GZIP_TAILBUF_SZ], struct nexus_gzip *gz)
{ {
...@@ -596,6 +603,9 @@ push_crc(struct req *req, struct bytes_tree *tree, ...@@ -596,6 +603,9 @@ push_crc(struct req *req, struct bytes_tree *tree,
AN(nex->nexus.gzip.is); AN(nex->nexus.gzip.is);
switch(node->crc.ctype) { switch(node->crc.ctype) {
case GZIP_HDR:
return (VDP_bytes(nex->nexus.req,
VDP_NULL, gzip_hdr, sizeof gzip_hdr));
case UPDATE: case UPDATE:
nex->nexus.gzip.crc = crc32_combine( nex->nexus.gzip.crc = crc32_combine(
nex->nexus.gzip.crc, node->crc.icrc, nex->nexus.gzip.crc, node->crc.icrc,
......
...@@ -119,6 +119,7 @@ struct node_nexus { ...@@ -119,6 +119,7 @@ struct node_nexus {
enum t_crc { enum t_crc {
INVALID = 0, INVALID = 0,
GZIP_HDR,
UPDATE, UPDATE,
FINAL // combine with parent or gen tail FINAL // combine with parent or gen tail
}; };
......
...@@ -76,13 +76,6 @@ int block_final = 0; ...@@ -76,13 +76,6 @@ int block_final = 0;
*/ */
int front_push = 0; int front_push = 0;
static const uint8_t gzip_hdr[] = {
0x1f, 0x8b, 0x08,
0x00, 0x00, 0x00, 0x00,
0x00,
0x02, 0x03
};
/* Forward declarations */ /* Forward declarations */
const struct vdp VDP_pesi_buf; const struct vdp VDP_pesi_buf;
static const struct transport VPED_transport; static const struct transport VPED_transport;
...@@ -536,9 +529,7 @@ pesi_buf_bytes(struct req *req, enum vdp_action act, void **priv, ...@@ -536,9 +529,7 @@ pesi_buf_bytes(struct req *req, enum vdp_action act, void **priv,
/* /*
* non-api knowledge from VDP_DeliverObj() * non-api knowledge from VDP_DeliverObj()
* final = req->objcore->flags & (OC_F_PRIVATE | OC_F_HFM | OC_F_HFP); * final = req->objcore->flags & (OC_F_PRIVATE | OC_F_HFM | OC_F_HFP);
*/ *
/*
* if data is coming from a varnish-cache simple storage, we know that * if data is coming from a varnish-cache simple storage, we know that
* - for non-final objects * - for non-final objects
* - as long as we keep a reference * - as long as we keep a reference
...@@ -556,11 +547,7 @@ pesi_buf_bytes(struct req *req, enum vdp_action act, void **priv, ...@@ -556,11 +547,7 @@ pesi_buf_bytes(struct req *req, enum vdp_action act, void **priv,
HSH_Ref(parent->nexus.oc); HSH_Ref(parent->nexus.oc);
} }
// XXX make gzip_hdr a T_CRC ? refok = (parent->nexus.oc != NULL);
refok = ((parent->nexus.oc != NULL) ||
// from vdp_pesi_bytes
(ptr == gzip_hdr));
AN(ptr); AN(ptr);
AZ(node->data.ptr); AZ(node->data.ptr);
...@@ -903,14 +890,16 @@ vdp_pesi_bytes(struct req *req, enum vdp_action act, void **priv, ...@@ -903,14 +890,16 @@ vdp_pesi_bytes(struct req *req, enum vdp_action act, void **priv,
pecx->e = pecx->p + l; pecx->e = pecx->p + l;
if (*pecx->p == VEC_GZ) { if (*pecx->p == VEC_GZ) {
/* if (parent_gzip == NULL) {
* this will, in pesi_buf_bytes(), create a AZ(child);
* T_DATA node which ref's gzip_hdr. Should we child = node_alloc();
* rather add a T_GZIPHDR node? CHECK_OBJ_NOTNULL(child, NODE_MAGIC);
*/ child->type = T_CRC;
if (parent_gzip == NULL) child->state = ST_DATA;
retval = VDP_bytes(req, VDP_NULL, child->crc.ctype = GZIP_HDR;
gzip_hdr, 10); node_insert(tree, node, child);
child = NULL;
}
node->nexus.gzip.is = 1; node->nexus.gzip.is = 1;
node->nexus.gzip.crc = crc32(0L, Z_NULL, 0); node->nexus.gzip.crc = crc32(0L, Z_NULL, 0);
AZ(node->nexus.gzip.l_crc); AZ(node->nexus.gzip.l_crc);
......
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