unsigned refcnt;
unsigned xid;
struct objhead *objhead;
+ struct storage *objstore;
struct ws ws_o[1];
unsigned char *vary;
int Fetch(struct sess *sp);
/* cache_hash.c */
-void HSH_Prealloc(const struct sess *sp);
+void HSH_Prealloc(struct sess *sp);
int HSH_Compare(const struct sess *sp, const struct objhead *o);
void HSH_Copy(const struct sess *sp, const struct objhead *o);
struct object *HSH_Lookup(struct sess *sp);
struct storage *st;
struct bereq *bereq;
int mklen, is_head;
- unsigned len;
struct http_conn htc[1];
int i;
sp->obj->xid = sp->xid;
+ /* Set up obj's workspace */
+ st = sp->obj->objstore;
+ WS_Init(sp->obj->ws_o, st->ptr + st->len, st->space - st->len);
+ st->len = st->space;
+ WS_Assert(sp->obj->ws_o);
+ http_Setup(sp->obj->http, sp->obj->ws_o);
+
vc = VBE_GetFd(sp);
if (vc == NULL)
return (1);
/* Filter into object */
hp2 = sp->obj->http;
- len = Tlen(htc->rxbuf);
- len += 256; /* XXX: margin for content-length etc */
-
- b = malloc(len);
- AN(b);
- WS_Init(sp->obj->ws_o, b, len);
- http_Setup(hp2, sp->obj->ws_o);
hp2->logtag = HTTP_Obj;
http_CopyResp(hp2, hp);
/* Precreate an objhead and object for later use */
void
-HSH_Prealloc(const struct sess *sp)
+HSH_Prealloc(struct sess *sp)
{
struct worker *w;
+ struct storage *st;
CHECK_OBJ_NOTNULL(sp, SESS_MAGIC);
w = sp->wrk;
} else
CHECK_OBJ_NOTNULL(w->nobjhead, OBJHEAD_MAGIC);
if (w->nobj == NULL) {
- w->nobj = calloc(sizeof *w->nobj, 1);
- XXXAN(w->nobj);
+ st = STV_alloc(sp, params->mem_workspace);
+ XXXAN(st);
+ w->nobj = (void *)st->ptr;
+ st->len = sizeof *w->nobj;
+ memset(w->nobj, 0, sizeof *w->nobj);
+ w->nobj->objstore = st;
w->nobj->magic = OBJECT_MAGIC;
w->nobj->http->magic = HTTP_MAGIC;
w->nobj->busy = 1;
if (r != 0)
return;
- if (o->http->ws != NULL && o->http->ws->s != NULL)
- free(o->http->ws->s);
-
if (o->vary != NULL)
free(o->vary);
HSH_Freestore(o);
- FREE_OBJ(o);
+ STV_free(o->objstore);
VSL_stats->n_object--;
if (oh == NULL)
#include "vcl.h"
#include "cli_priv.h"
#include "cache.h"
+#include "stevedore.h"
VTAILQ_HEAD(workerhead, worker);
FREE_OBJ(w->nobjhead);
}
if (w->nobj!= NULL)
- FREE_OBJ(w->nobj);
+ STV_free(w->nobj->objstore);
return (NULL);
}