Commit 70ae3864 authored by Poul-Henning Kamp's avatar Poul-Henning Kamp

Implement beresp.storage as a string variable which lives entirely

inside vcl_fetch()



git-svn-id: http://www.varnish-cache.org/svn/trunk/varnish-cache@5660 d4fa192b-c00b-0410-8231-f00ffab90ce4
parent 1df877ca
......@@ -258,6 +258,8 @@ struct worker {
double grace;
unsigned do_esi;
char *storage;
/* Timeouts */
double connect_timeout;
double first_byte_timeout;
......
......@@ -524,6 +524,8 @@ cnt_fetch(struct sess *sp)
sp->wrk->body_status = RFC2616_Body(sp);
AZ(sp->wrk->storage);
VCL_fetch_method(sp);
if (sp->objcore == NULL) {
......@@ -568,6 +570,8 @@ cnt_fetch(struct sess *sp)
sp->obj = STV_NewObject(sp, l, sp->wrk->ttl, nhttp);
CHECK_OBJ_NOTNULL(sp->obj, OBJECT_MAGIC);
sp->wrk->storage = NULL;
if (vary != NULL) {
sp->obj->vary =
(void *)WS_Alloc(sp->obj->http->ws, varyl);
......@@ -1249,6 +1253,7 @@ CNT_Session(struct sess *sp)
CHECK_OBJ_NOTNULL(sp->wrk, WORKER_MAGIC);
CHECK_OBJ_ORNULL(w->nobjhead, OBJHEAD_MAGIC);
WS_Assert(w->ws);
AZ(sp->wrk->storage);
switch (sp->step) {
#define STEP(l,u) \
......
......@@ -181,6 +181,7 @@ wrk_thread_real(struct wq *qp, unsigned shm_workspace, unsigned sess_workspace,
w->beresp1 = NULL;
w->beresp = NULL;
w->resp = NULL;
w->storage = NULL;
w->wrq->func(w, w->wrq->priv);
AZ(w->bereq);
AZ(w->beresp1);
......@@ -188,6 +189,7 @@ wrk_thread_real(struct wq *qp, unsigned shm_workspace, unsigned sess_workspace,
AZ(w->resp);
WS_Assert(w->ws);
AZ(w->wfd);
AZ(w->storage);
assert(w->wlp == w->wlb);
w->wrq = NULL;
if (params->diag_bitmap & 0x00040000) {
......
......@@ -309,6 +309,28 @@ VRT_r_beresp_backend_port(const struct sess *sp)
return (TCP_port(sp->vbc->addr));
}
const char * __match_proto__()
VRT_r_beresp_storage(struct sess *sp)
{
CHECK_OBJ_NOTNULL(sp, SESS_MAGIC);
if (sp->wrk->storage != NULL)
return (sp->wrk->storage);
else
return (NULL);
}
void
VRT_l_beresp_storage(struct sess *sp, const char *str, ...)
{
va_list ap;
char *b;
va_start(ap, str);
b = VRT_String(sp->wrk->ws, NULL, str, ap);
va_end(ap);
sp->wrk->storage = b;
}
void
VRT_l_obj_ttl(const struct sess *sp, double a)
{
......
......@@ -316,6 +316,12 @@ sp_variables = (
( ),
'const struct sess *'
),
('beresp.storage',
'STRING',
( 'fetch',),
( 'fetch',),
'struct sess *'
),
('obj.proto',
'STRING',
( 'hit', 'error',),
......
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