r1617 - in trunk/varnish-cache: include lib/libvcl
phk at projects.linpro.no
phk at projects.linpro.no
Mon Jul 2 15:28:03 CEST 2007
Author: phk
Date: 2007-07-02 15:28:03 +0200 (Mon, 02 Jul 2007)
New Revision: 1617
Modified:
trunk/varnish-cache/include/vrt.h
trunk/varnish-cache/lib/libvcl/vcc_fixed_token.c
trunk/varnish-cache/lib/libvcl/vcc_var.c
Log:
Generate correct code for bereq.http and obj.http
Modified: trunk/varnish-cache/include/vrt.h
===================================================================
--- trunk/varnish-cache/include/vrt.h 2007-07-02 13:22:36 UTC (rev 1616)
+++ trunk/varnish-cache/include/vrt.h 2007-07-02 13:28:03 UTC (rev 1617)
@@ -74,7 +74,7 @@
void VRT_error(struct sess *, unsigned, const char *);
int VRT_switch_config(const char *);
-enum gethdr_e { HDR_REQ, HDR_RESP };
+enum gethdr_e { HDR_REQ, HDR_RESP, HDR_OBJ, HDR_BEREQ };
char *VRT_GetHdr(struct sess *, enum gethdr_e where, const char *);
void VRT_handling(struct sess *sp, unsigned hand);
Modified: trunk/varnish-cache/lib/libvcl/vcc_fixed_token.c
===================================================================
--- trunk/varnish-cache/lib/libvcl/vcc_fixed_token.c 2007-07-02 13:22:36 UTC (rev 1616)
+++ trunk/varnish-cache/lib/libvcl/vcc_fixed_token.c 2007-07-02 13:28:03 UTC (rev 1617)
@@ -430,7 +430,7 @@
vsb_cat(sb, "void VRT_error(struct sess *, unsigned, const char *);\n");
vsb_cat(sb, "int VRT_switch_config(const char *);\n");
vsb_cat(sb, "\n");
- vsb_cat(sb, "enum gethdr_e { HDR_REQ, HDR_RESP };\n");
+ vsb_cat(sb, "enum gethdr_e { HDR_REQ, HDR_RESP, HDR_OBJ, HDR_BEREQ };\n");
vsb_cat(sb, "char *VRT_GetHdr(struct sess *, enum gethdr_e where, const char *);\n");
vsb_cat(sb, "void VRT_handling(struct sess *sp, unsigned hand);\n");
vsb_cat(sb, "\n");
Modified: trunk/varnish-cache/lib/libvcl/vcc_var.c
===================================================================
--- trunk/varnish-cache/lib/libvcl/vcc_var.c 2007-07-02 13:22:36 UTC (rev 1616)
+++ trunk/varnish-cache/lib/libvcl/vcc_var.c 2007-07-02 13:28:03 UTC (rev 1617)
@@ -49,8 +49,11 @@
EncToken(tl->fb, tl->t);
vcc_NextToken(tl);
return;
- }
- ExpectErr(tl, VAR);
+ } else if (tl->t->tok != VAR) {
+ vsb_printf(tl->sb, "Expected string variable or constant\n");
+ vcc_ErrWhere(tl, tl->t);
+ return;
+ }
ERRCHK(tl);
vp = vcc_FindVar(tl, tl->t, vcc_vars);
ERRCHK(tl);
@@ -88,18 +91,27 @@
memcpy(p, t->b, i);
p[i] = '\0';
v->name = p;
+ v->access = V_RW;
v->fmt = STRING;
v->methods = vh->methods;
if (!memcmp(vh->name, "req.", 4))
wh = "HDR_REQ";
else if (!memcmp(vh->name, "resp.", 5))
wh = "HDR_RESP";
+ else if (!memcmp(vh->name, "obj.", 4))
+ wh = "HDR_OBJ";
+ else if (!memcmp(vh->name, "bereq.", 6))
+ wh = "HDR_BEREQ";
else
assert(0 == 1);
asprintf(&p, "VRT_GetHdr(sp, %s, \"\\%03o%s:\")", wh,
(unsigned)(strlen(v->name + vh->len) + 1), v->name + vh->len);
- assert(p != NULL);
+ AN(p);
v->rname = p;
+ asprintf(&p, "VRT_SetHdr(sp, %s, \"\\%03o%s:\")", wh,
+ (unsigned)(strlen(v->name + vh->len) + 1), v->name + vh->len);
+ AN(p);
+ v->lname = p;
return (v);
}
More information about the varnish-commit
mailing list