Commit 349269f1 authored by Poul-Henning Kamp's avatar Poul-Henning Kamp

Centralize obj->gzipped setting and get it right up front.

Edging closer to streap+gunzip
parent 4b9d3f43
......@@ -264,12 +264,11 @@ struct stream_ctx {
unsigned magic;
#define STREAM_CTX_MAGIC 0x8213728b
#if 0
struct vgz *vgz;
void *obuf;
ssize_t obuf_len;
ssize_t obuf_ptr;
#endif
/* Next byte we will take from storage */
ssize_t stream_next;
......
......@@ -414,6 +414,7 @@ cnt_error(struct sess *sp)
EXP_Clr(&w->exp);
sp->obj = STV_NewObject(sp, NULL, 1024, &w->exp,
params->http_max_hdr);
XXXAN(sp->obj);
sp->obj->xid = sp->xid;
sp->obj->entered = sp->t_req;
} else {
......@@ -754,8 +755,8 @@ cnt_fetchbody(struct sess *sp)
sp->wrk->storage_hint = NULL;
/* VFP will update as needed */
sp->obj->gziped = sp->wrk->is_gzip;
if (sp->wrk->do_gzip || (sp->wrk->is_gzip && !sp->wrk->do_gunzip))
sp->obj->gziped = 1;
if (vary != NULL) {
sp->obj->vary =
......@@ -840,13 +841,20 @@ cnt_streambody(struct sess *sp)
{
int i;
struct stream_ctx sctx;
uint8_t obuf[sp->wrk->res_mode & RES_GUNZIP ?
params->gzip_stack_buffer : 1];
memset(&sctx, 0, sizeof sctx);
sctx.magic = STREAM_CTX_MAGIC;
AZ(sp->wrk->sctx);
sp->wrk->sctx = &sctx;
if (sp->wrk->res_mode & RES_GUNZIP) {
sctx.vgz = VGZ_NewUngzip(sp, "U S -");
sctx.obuf = obuf;
sctx.obuf_len = sizeof (obuf);
}
RES_StreamStart(sp);
/* Use unmodified headers*/
......
......@@ -386,10 +386,7 @@ vfp_esi_end(struct sess *sp)
VGZ_UpdateObj(vef->vgz, sp->obj);
VGZ_Destroy(&vef->vgz);
XXXAZ(vef->error);
sp->obj->gziped = 1;
FREE_OBJ(vef);
} else {
sp->obj->gziped = 0;
}
return (0);
}
......
......@@ -491,7 +491,6 @@ vfp_gunzip_end(struct sess *sp)
sp->wrk->vgz_rx = NULL;
CHECK_OBJ_NOTNULL(vg, VGZ_MAGIC);
VGZ_Destroy(&vg);
sp->obj->gziped = 0;
return (0);
}
......@@ -572,7 +571,6 @@ vfp_gzip_end(struct sess *sp)
} while (i != Z_STREAM_END);
VGZ_UpdateObj(vg, sp->obj);
VGZ_Destroy(&vg);
sp->obj->gziped = 1;
return (0);
}
......@@ -653,7 +651,6 @@ vfp_testgzip_end(struct sess *sp)
CHECK_OBJ_NOTNULL(vg, VGZ_MAGIC);
VGZ_UpdateObj(vg, sp->obj);
VGZ_Destroy(&vg);
sp->obj->gziped = 1;
return (0);
}
......
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