Skip to content
This repository was archived by the owner on Feb 16, 2026. It is now read-only.

Commit 67ea0c8

Browse files
committed
Distinguish $TYPE.property from $TYPE.method() by insisting in ()
STRING.upper() and STRING.lower() are methods. Relevant to: #3023
1 parent 82ad74a commit 67ea0c8

2 files changed

Lines changed: 25 additions & 12 deletions

File tree

bin/varnishtest/tests/v00058.vtc

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -184,14 +184,14 @@ server s1 {
184184

185185
varnish v1 -vcl+backend {
186186
sub vcl_deliver {
187-
set resp.http.l-proto = resp.proto.lower;
188-
set resp.http.u-proto = resp.proto.upper;
189-
set resp.http.l-req = req.url.lower;
190-
set resp.http.u-req = req.url.upper;
191-
set resp.http.l-mod = (req.url + "bar").lower;
192-
set resp.http.u-mod = (req.url + "bar").upper;
193-
set resp.http.uu-mod = (req.url + "bar").upper.upper;
194-
set resp.http.ul-mod = (req.url + "bar").upper.lower;
187+
set resp.http.l-proto = resp.proto.lower();
188+
set resp.http.u-proto = resp.proto.upper();
189+
set resp.http.l-req = req.url.lower();
190+
set resp.http.u-req = req.url.upper();
191+
set resp.http.l-mod = (req.url + "bar").lower();
192+
set resp.http.u-mod = (req.url + "bar").upper();
193+
set resp.http.uu-mod = (req.url + "bar").upper().upper();
194+
set resp.http.ul-mod = (req.url + "bar").upper().lower();
195195
}
196196
}
197197

lib/libvcc/vcc_expr.c

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -803,23 +803,30 @@ vcc_expr5(struct vcc *tl, struct expr **e, vcc_type_t fmt)
803803
/*--------------------------------------------------------------------
804804
* SYNTAX:
805805
* Expr4:
806-
* Expr5 [ '.' type_method() ]*
806+
* Expr5 [ '.' (type_attribute | type_method()) ]*
807+
*
808+
* type_attributes is information already existing, requiring no
809+
* processing or resource usage.
810+
*
811+
* type_methods are calls and may do (significant processing, change things,
812+
* eat workspace etc.
807813
*/
808814

809815
static const struct vcc_methods {
810816
vcc_type_t type_from;
811817
vcc_type_t type_to;
812818
const char *method;
813819
const char *impl;
820+
int func;
814821
} vcc_methods[] = {
815822
//{ BACKEND, BOOL, "healthy", "VRT_Healthy(ctx, \v1, 0)" },
816823

817824
#define VRTSTVVAR(nm, vtype, ctype, dval) \
818-
{ STEVEDORE, vtype, #nm, "VRT_stevedore_" #nm "(\v1)"},
825+
{ STEVEDORE, vtype, #nm, "VRT_stevedore_" #nm "(\v1)", 0},
819826
#include "tbl/vrt_stv_var.h"
820827

821-
{ STRINGS, STRING, "upper", "VRT_UpperLowerStrands(ctx, \vT, 1)" },
822-
{ STRINGS, STRING, "lower", "VRT_UpperLowerStrands(ctx, \vT, 0)" },
828+
{ STRINGS, STRING, "upper", "VRT_UpperLowerStrands(ctx, \vT, 1)", 1 },
829+
{ STRINGS, STRING, "lower", "VRT_UpperLowerStrands(ctx, \vT, 0)", 1 },
823830

824831
{ NULL, NULL, NULL, NULL},
825832
};
@@ -859,6 +866,12 @@ vcc_expr4(struct vcc *tl, struct expr **e, vcc_type_t fmt)
859866
(*e)->fmt = STRINGS;
860867
(*e)->nstr = 1;
861868
}
869+
if (vm->func) {
870+
ExpectErr(tl, '(');
871+
vcc_NextToken(tl);
872+
ExpectErr(tl, ')');
873+
vcc_NextToken(tl);
874+
}
862875
}
863876
}
864877

0 commit comments

Comments
 (0)