[master] 384d673 Record the http-header-spec for wildcard'ed variables.
Poul-Henning Kamp
phk at varnish-cache.org
Mon Mar 14 10:21:27 CET 2011
commit 384d67320a8c748330cd134367e3152cb52f025f
Author: Poul-Henning Kamp <phk at FreeBSD.org>
Date: Mon Mar 14 09:20:52 2011 +0000
Record the http-header-spec for wildcard'ed variables.
diff --git a/lib/libvcl/vcc_action.c b/lib/libvcl/vcc_action.c
index 8850909..dd36d23 100644
--- a/lib/libvcl/vcc_action.c
+++ b/lib/libvcl/vcc_action.c
@@ -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);
diff --git a/lib/libvcl/vcc_compile.h b/lib/libvcl/vcc_compile.h
index 3d570b3..8453f1a 100644
--- a/lib/libvcl/vcc_compile.h
+++ b/lib/libvcl/vcc_compile.h
@@ -178,6 +178,7 @@ struct var {
unsigned r_methods;
const char *lname;
unsigned w_methods;
+ const char *http;
const char *hdr;
};
diff --git a/lib/libvcl/vcc_var.c b/lib/libvcl/vcc_var.c
index ca91d1c..8bec564 100644
--- a/lib/libvcl/vcc_var.c
+++ b/lib/libvcl/vcc_var.c
@@ -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);
More information about the varnish-commit
mailing list