Commit 384d6732 authored by Poul-Henning Kamp's avatar Poul-Henning Kamp

Record the http-header-spec for wildcard'ed variables.

parent 4dac2303
......@@ -166,7 +166,7 @@ parse_unset(struct vcc *tl)
vp = vcc_FindVar(tl, tl->t, 1, "cannot be unset");
ERRCHK(tl);
assert(vp != NULL);
if (vp->fmt != STRING || vp->hdr == NULL) {
if (vp->fmt != STRING || vp->http == NULL) {
vsb_printf(tl->sb,
"Only http header variables can be unset.\n");
vcc_ErrWhere(tl, tl->t);
......
......@@ -178,6 +178,7 @@ struct var {
unsigned r_methods;
const char *lname;
unsigned w_methods;
const char *http;
const char *hdr;
};
......
......@@ -61,15 +61,15 @@ vcc_Var_Wildcard(struct vcc *tl, const struct token *t, const struct symbol *wc)
v->r_methods = vh->r_methods;
v->w_methods = vh->w_methods;
v->fmt = STRING;
v->hdr = vh->hdr;
v->http = vh->http;
l = strlen(v->name + vh->len) + 1;
bprintf(buf, "VRT_GetHdr(sp, %s, \"\\%03o%s:\")",
v->hdr, (unsigned)l, v->name + vh->len);
bprintf(buf, "\\%03o%s:", (unsigned)l, v->name + vh->len);
v->hdr = TlDup(tl, buf);
bprintf(buf, "VRT_GetHdr(sp, %s, \"%s\")", v->http, v->hdr);
v->rname = TlDup(tl, buf);
bprintf(buf, "VRT_SetHdr(sp, %s, \"\\%03o%s:\", ",
v->hdr, (unsigned)l, v->name + vh->len);
bprintf(buf, "VRT_SetHdr(sp, %s, \"%s\", ", v->http, v->hdr);
v->lname = TlDup(tl, buf);
sym = VCC_AddSymbolTok(tl, t, SYM_VAR);
......
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