Commit 17c076b3 authored by Poul-Henning Kamp's avatar Poul-Henning Kamp

Replay of SVN r5773

Add separate anchor fields for vgz for reception and esi work.
(The response vgz is a local variable)
parent 70f943a4
...@@ -279,7 +279,8 @@ struct worker { ...@@ -279,7 +279,8 @@ struct worker {
enum body_status body_status; enum body_status body_status;
struct storage *storage; struct storage *storage;
struct vfp *vfp; struct vfp *vfp;
void *vfp_private; struct vgz *vgz_rx;
struct vgz *vgz_esi;
unsigned do_esi; unsigned do_esi;
unsigned do_gzip; unsigned do_gzip;
unsigned is_gzip; unsigned is_gzip;
......
...@@ -111,6 +111,7 @@ vfp_esi_bytes_ug(struct sess *sp, struct http_conn *htc, size_t bytes) ...@@ -111,6 +111,7 @@ vfp_esi_bytes_ug(struct sess *sp, struct http_conn *htc, size_t bytes)
static int __match_proto__() static int __match_proto__()
vfp_esi_bytes_gu(struct sess *sp, struct http_conn *htc, size_t bytes) vfp_esi_bytes_gu(struct sess *sp, struct http_conn *htc, size_t bytes)
{ {
return (vfp_esi_bytes_uu(sp, htc, bytes)); return (vfp_esi_bytes_uu(sp, htc, bytes));
} }
......
...@@ -171,6 +171,9 @@ VGZ_NewGzip(const struct sess *sp, struct ws *tmp) ...@@ -171,6 +171,9 @@ VGZ_NewGzip(const struct sess *sp, struct ws *tmp)
* memLevel [1..9] (-> 1K->256K) * memLevel [1..9] (-> 1K->256K)
* *
* XXX: They probably needs to be params... * XXX: They probably needs to be params...
*
* XXX: It may be more efficent to malloc them, rather than have
* XXX: too many worker threads grow the stacks.
*/ */
i = deflateInit2(&vg->vz, i = deflateInit2(&vg->vz,
0, /* Level */ 0, /* Level */
...@@ -286,7 +289,7 @@ static void __match_proto__() ...@@ -286,7 +289,7 @@ static void __match_proto__()
vfp_gunzip_begin(struct sess *sp, size_t estimate) vfp_gunzip_begin(struct sess *sp, size_t estimate)
{ {
(void)estimate; (void)estimate;
sp->wrk->vfp_private = VGZ_NewUngzip(sp, sp->ws); sp->wrk->vgz_rx = VGZ_NewUngzip(sp, sp->ws);
} }
static int __match_proto__() static int __match_proto__()
...@@ -300,7 +303,8 @@ vfp_gunzip_bytes(struct sess *sp, struct http_conn *htc, size_t bytes) ...@@ -300,7 +303,8 @@ vfp_gunzip_bytes(struct sess *sp, struct http_conn *htc, size_t bytes)
size_t dl; size_t dl;
const void *dp; const void *dp;
CAST_OBJ_NOTNULL(vg, sp->wrk->vfp_private, VGZ_MAGIC); vg = sp->wrk->vgz_rx;
CHECK_OBJ_NOTNULL(vg, VGZ_MAGIC);
AZ(vg->vz.avail_in); AZ(vg->vz.avail_in);
while (bytes > 0 || vg->vz.avail_in > 0) { while (bytes > 0 || vg->vz.avail_in > 0) {
if (sp->wrk->storage == NULL) if (sp->wrk->storage == NULL)
...@@ -346,7 +350,8 @@ vfp_gunzip_end(struct sess *sp) ...@@ -346,7 +350,8 @@ vfp_gunzip_end(struct sess *sp)
struct vgz *vg; struct vgz *vg;
struct storage *st; struct storage *st;
CAST_OBJ_NOTNULL(vg, sp->wrk->vfp_private, VGZ_MAGIC); vg = sp->wrk->vgz_rx;
CHECK_OBJ_NOTNULL(vg, VGZ_MAGIC);
VGZ_Destroy(&vg); VGZ_Destroy(&vg);
st = sp->wrk->storage; st = sp->wrk->storage;
...@@ -381,11 +386,9 @@ struct vfp vfp_gunzip = { ...@@ -381,11 +386,9 @@ struct vfp vfp_gunzip = {
static void __match_proto__() static void __match_proto__()
vfp_gzip_begin(struct sess *sp, size_t estimate) vfp_gzip_begin(struct sess *sp, size_t estimate)
{ {
struct vgz *vg;
(void)estimate; (void)estimate;
vg = VGZ_NewGzip(sp, sp->ws); sp->wrk->vgz_rx = VGZ_NewGzip(sp, sp->ws);
sp->wrk->vfp_private = vg;
} }
static int __match_proto__() static int __match_proto__()
...@@ -399,7 +402,8 @@ vfp_gzip_bytes(struct sess *sp, struct http_conn *htc, size_t bytes) ...@@ -399,7 +402,8 @@ vfp_gzip_bytes(struct sess *sp, struct http_conn *htc, size_t bytes)
size_t dl; size_t dl;
const void *dp; const void *dp;
CAST_OBJ_NOTNULL(vg, sp->wrk->vfp_private, VGZ_MAGIC); vg = sp->wrk->vgz_rx;
CHECK_OBJ_NOTNULL(vg, VGZ_MAGIC);
AZ(vg->vz.avail_in); AZ(vg->vz.avail_in);
while (bytes > 0 || vg->vz.avail_in > 0) { while (bytes > 0 || vg->vz.avail_in > 0) {
if (sp->wrk->storage == NULL) if (sp->wrk->storage == NULL)
...@@ -445,7 +449,8 @@ vfp_gzip_end(struct sess *sp) ...@@ -445,7 +449,8 @@ vfp_gzip_end(struct sess *sp)
struct vgz *vg; struct vgz *vg;
struct storage *st; struct storage *st;
CAST_OBJ_NOTNULL(vg, sp->wrk->vfp_private, VGZ_MAGIC); vg = sp->wrk->vgz_rx;
CHECK_OBJ_NOTNULL(vg, VGZ_MAGIC);
VGZ_Destroy(&vg); VGZ_Destroy(&vg);
st = sp->wrk->storage; st = sp->wrk->storage;
......
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