/*--------------------------------------------------------------------*/
char *
-VRT_GetHdr(struct sess *sp, const char *n)
+VRT_GetHdr(struct sess *sp, int where, const char *n)
{
char *p;
+ struct http *hp;
CHECK_OBJ_NOTNULL(sp, SESS_MAGIC);
- AN(sp->http);
- if (!http_GetHdr(sp->http, n, &p))
+ switch (where) {
+ case 1:
+ hp = sp->http;
+ break;
+ case 2:
+ hp = sp->vbc->http;
+ break;
+ default:
+ INCOMPL();
+ }
+ CHECK_OBJ_NOTNULL(hp, HTTP_MAGIC);
+ if (!http_GetHdr(hp, n, &p))
return (NULL);
return (p);
}
void VRT_error(struct sess *, unsigned, const char *);
int VRT_switch_config(const char *);
-char *VRT_GetHdr(struct sess *, const char *);
+char *VRT_GetHdr(struct sess *, int where, const char *);
void VRT_handling(struct sess *sp, unsigned hand);
/* Backend related */
void VRT_l_obj_ttl(struct sess *, double);
const char * VRT_r_req_http_(struct sess *);
void VRT_l_req_http_(struct sess *, const char *);
+const char * VRT_r_resp_http_(struct sess *);
+void VRT_l_resp_http_(struct sess *, const char *);
{
char *p;
struct var *v;
- int i;
+ int i, w;
(void)tl;
p[i] = '\0';
v->name = p;
v->fmt = STRING;
- asprintf(&p, "VRT_GetHdr(sp, \"\\%03o%s:\")",
+ if (!memcmp(vh->name, "req.", 4))
+ w = 1;
+ else
+ w = 2;
+ asprintf(&p, "VRT_GetHdr(sp, %d, \"\\%03o%s:\")", w,
(unsigned)(strlen(v->name + vh->len) + 1), v->name + vh->len);
assert(p != NULL);
v->rname = p;
fputs("void VRT_error(struct sess *, unsigned, const char *);\n", f);
fputs("int VRT_switch_config(const char *);\n", f);
fputs("\n", f);
- fputs("char *VRT_GetHdr(struct sess *, const char *);\n", f);
+ fputs("char *VRT_GetHdr(struct sess *, int where, const char *);\n", f);
fputs("void VRT_handling(struct sess *sp, unsigned hand);\n", f);
fputs("\n", f);
fputs("/* Backend related */\n", f);
{ obj.cacheable BOOL }
{ obj.ttl TIME }
{ req.http. HEADER }
+ { resp.http. HEADER }
}
set tt(IP) "const unsigned char *"
"VRT_r_req_http_(sp)",
"VRT_l_req_http_(sp, ",
},
+ { "resp.http.", HEADER, 10,
+ "VRT_r_resp_http_(sp)",
+ "VRT_l_resp_http_(sp, ",
+ },
{ NULL }
};
"void VRT_l_obj_ttl(struct sess *, double);\n"
"const char * VRT_r_req_http_(struct sess *);\n"
"void VRT_l_req_http_(struct sess *, const char *);\n"
+ "const char * VRT_r_resp_http_(struct sess *);\n"
+ "void VRT_l_resp_http_(struct sess *, const char *);\n"
;