Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
varnish-cache
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Commits
Open sidebar
varnishcache
varnish-cache
Commits
c9d1478f
Commit
c9d1478f
authored
Jun 14, 2013
by
Poul-Henning Kamp
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Be a bit more helpful with the VCC error messages with the names
which are restricted to valid C language names. Fixes #1310
parent
63f7dfa0
Changes
8
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
69 additions
and
2 deletions
+69
-2
m00010.vtc
bin/varnishtest/tests/m00010.vtc
+7
-0
v00020.vtc
bin/varnishtest/tests/v00020.vtc
+28
-0
vcc_acl.c
lib/libvcl/vcc_acl.c
+6
-0
vcc_action.c
lib/libvcl/vcc_action.c
+6
-0
vcc_compile.c
lib/libvcl/vcc_compile.c
+4
-0
vcc_compile.h
lib/libvcl/vcc_compile.h
+2
-0
vcc_parse.c
lib/libvcl/vcc_parse.c
+15
-1
vcc_token.c
lib/libvcl/vcc_token.c
+1
-1
No files found.
bin/varnishtest/tests/m00010.vtc
View file @
c9d1478f
...
...
@@ -22,6 +22,13 @@ server s4 {
txresp -body "4444"
} -start
varnish v1 -errvcl {Names of VCL objects cannot contain '-'} {
import directors from "${topbuild}/lib/libvmod_directors/.libs/libvmod_directors.so" ;
backend b1 { .host = "127.0.0.1"; .port = "8080";}
sub vcl_init {
new rr1-xx = directors.round_robin();
}
}
varnish v1 -vcl+backend {
...
...
bin/varnishtest/tests/v00020.vtc
View file @
c9d1478f
...
...
@@ -247,3 +247,31 @@ varnish v1 -vcl {
}
}
}
varnish v1 -errvcl {Names of VCL sub's cannot contain '-'} {
backend b { .host = "127.0.0.1"; }
sub foo-bar {
}
sub vcl_recv {
call foo-bar;
}
}
varnish v1 -errvcl {VCL sub's named 'vcl*' are reserved names.} {
backend b { .host = "127.0.0.1"; }
sub vcl_bar {
}
sub vcl_recv {
call vcl_bar;
}
}
varnish v1 -errvcl {Names of VCL acl's cannot contain '-'} {
backend b { .host = "127.0.0.1"; }
acl foo-bar {
}
sub vcl_recv {
if (client.ip ~ foo.bar) {
}
}
}
lib/libvcl/vcc_acl.c
View file @
c9d1478f
...
...
@@ -472,6 +472,12 @@ vcc_Acl(struct vcc *tl)
VTAILQ_INIT
(
&
tl
->
acl
);
ExpectErr
(
tl
,
ID
);
if
(
!
vcc_isCid
(
tl
->
t
))
{
VSB_printf
(
tl
->
sb
,
"Names of VCL acl's cannot contain '-'
\n
"
);
vcc_ErrWhere
(
tl
,
tl
->
t
);
return
;
}
an
=
tl
->
t
;
vcc_NextToken
(
tl
);
...
...
lib/libvcl/vcc_action.c
View file @
c9d1478f
...
...
@@ -171,6 +171,12 @@ parse_new(struct vcc *tl)
vcc_NextToken
(
tl
);
ExpectErr
(
tl
,
ID
);
if
(
!
vcc_isCid
(
tl
->
t
))
{
VSB_printf
(
tl
->
sb
,
"Names of VCL objects cannot contain '-'
\n
"
);
vcc_ErrWhere
(
tl
,
tl
->
t
);
return
;
}
sy1
=
VCC_FindSymbol
(
tl
,
tl
->
t
,
SYM_NONE
);
XXXAZ
(
sy1
);
...
...
lib/libvcl/vcc_compile.c
View file @
c9d1478f
...
...
@@ -133,6 +133,10 @@ IsMethod(const struct token *t)
if
(
vcc_IdIs
(
t
,
m
->
name
))
return
(
m
-
method_tab
);
}
if
((
t
->
b
[
0
]
==
'v'
||
t
->
b
[
0
]
==
'V'
)
&&
(
t
->
b
[
1
]
==
'c'
||
t
->
b
[
1
]
==
'C'
)
&&
(
t
->
b
[
2
]
==
'l'
||
t
->
b
[
2
]
==
'L'
))
return
(
-
2
);
return
(
-
1
);
}
...
...
lib/libvcl/vcc_compile.h
View file @
c9d1478f
...
...
@@ -49,10 +49,12 @@
#endif
struct
vsb
;
struct
token
;
#define isident1(c) (isalpha(c))
#define isident(c) (isalpha(c) || isdigit(c) || (c) == '_' || (c) == '-')
#define isvar(c) (isident(c) || (c) == '.')
int
vcc_isCid
(
const
struct
token
*
t
);
unsigned
vcl_fixed_token
(
const
char
*
p
,
const
char
**
q
);
extern
const
char
*
const
vcl_tnames
[
256
];
void
vcl_output_lang_h
(
struct
vsb
*
sb
);
...
...
lib/libvcl/vcc_parse.c
View file @
c9d1478f
...
...
@@ -212,9 +212,23 @@ vcc_Function(struct vcc *tl)
vcc_NextToken
(
tl
);
ExpectErr
(
tl
,
ID
);
if
(
!
vcc_isCid
(
tl
->
t
))
{
VSB_printf
(
tl
->
sb
,
"Names of VCL sub's cannot contain '-'
\n
"
);
vcc_ErrWhere
(
tl
,
tl
->
t
);
return
;
}
m
=
IsMethod
(
tl
->
t
);
if
(
m
!=
-
1
)
{
if
(
m
==
-
2
)
{
VSB_printf
(
tl
->
sb
,
"VCL sub's named 'vcl*' are reserved names.
\n
"
);
vcc_ErrWhere
(
tl
,
tl
->
t
);
VSB_printf
(
tl
->
sb
,
"Valid vcl_* methods are:
\n
"
);
for
(
i
=
0
;
method_tab
[
i
].
name
!=
NULL
;
i
++
)
VSB_printf
(
tl
->
sb
,
"
\t
%s
\n
"
,
method_tab
[
i
].
name
);
return
;
}
else
if
(
m
!=
-
1
)
{
assert
(
m
<
VCL_MET_MAX
);
tl
->
fb
=
tl
->
fm
[
m
];
if
(
tl
->
mprocs
[
m
]
==
NULL
)
{
...
...
lib/libvcl/vcc_token.c
View file @
c9d1478f
...
...
@@ -293,7 +293,7 @@ vcc_IdIs(const struct token *t, const char *p)
* Check that we have a C-identifier
*/
static
int
int
vcc_isCid
(
const
struct
token
*
t
)
{
const
char
*
q
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment