unsigned magic;
#define VBC_MEM_MAGIC 0x2fd7af01
struct vbe_conn vbc;
- struct http http;
};
/* A backend IP */
vbe_new_conn(void)
{
struct vbc_mem *vbcm;
+ struct vbe_conn *vbc;
+ unsigned char *p;
- vbcm = calloc(sizeof *vbcm + heritage.mem_workspace, 1);
+ vbcm = calloc(sizeof *vbcm + heritage.mem_workspace * 2, 1);
if (vbcm == NULL)
return (NULL);
vbcm->magic = VBC_MEM_MAGIC;
VSL_stats->n_vbe_conn++;
- vbcm->vbc.magic = VBE_CONN_MAGIC;
- vbcm->vbc.vbcm = vbcm;
- vbcm->vbc.http = &vbcm->http;
- http_Setup(&vbcm->http, (void *)(vbcm + 1), heritage.mem_workspace);
- return (&vbcm->vbc);
+ vbc = &vbcm->vbc;
+ vbc->magic = VBE_CONN_MAGIC;
+ vbc->vbcm = vbcm;
+ vbc->http = &vbc->http_mem[0];
+ vbc->http2 = &vbc->http_mem[1];
+ p = (void *)(vbcm + 1);
+ http_Setup(vbc->http, p, heritage.mem_workspace);
+ p += heritage.mem_workspace;
+ http_Setup(vbc->http2, p, heritage.mem_workspace);
+ return (vbc);
}
static void
if (http_GetHdr(vc->http, H_Last_Modified, &b))
sp->obj->last_modified = TIM_parse(b);
- hp = &sp->obj->http;
- hp->s = malloc(heritage.mem_workspace);
- assert(hp->s != NULL);
- hp->e = hp->s + heritage.mem_workspace;
- hp->v = hp->s;
- /*
- * We borrow the sessions workspace and http header for building the
- * headers to store in the object, then copy them over there.
- * The actual headers to reply with are built later on over in
- * cache_response.c
- */
+ hp = vc->http2;
http_ClrHeader(hp);
hp->logtag = HTTP_Obj;
http_CopyResp(sp->fd, hp, vc->http);
} else
cls = 0;
+ http_CopyHttp(&sp->obj->http, hp);
+
if (http_GetHdr(vc->http, H_Connection, &b) && !strcasecmp(b, "close"))
cls = 1;