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
6ba917d8
Commit
6ba917d8
authored
Jul 13, 2020
by
Poul-Henning Kamp
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add parsing for structured-fields `sf-bytes` to VCL.
Currently fails with "unsupported", later will turn into BLOB.
parent
6b0c55b7
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
55 additions
and
1 deletion
+55
-1
README
bin/varnishtest/tests/README
+1
-0
i00000.vtc
bin/varnishtest/tests/i00000.vtc
+10
-0
vcc_token.c
lib/libvcc/vcc_token.c
+44
-1
No files found.
bin/varnishtest/tests/README
View file @
6ba917d8
...
@@ -22,6 +22,7 @@ Naming scheme
...
@@ -22,6 +22,7 @@ Naming scheme
id ~ ^f --> Security related tests
id ~ ^f --> Security related tests
id ~ ^g --> GZIP tests
id ~ ^g --> GZIP tests
id ~ ^h --> HAproxy tests
id ~ ^h --> HAproxy tests
id ~ ^i --> Interoperability and standards compliance
id ~ ^j --> JAIL tests
id ~ ^j --> JAIL tests
id ~ ^l --> VSL tests
id ~ ^l --> VSL tests
id ~ ^m --> VMOD tests excluding director
id ~ ^m --> VMOD tests excluding director
...
...
bin/varnishtest/tests/i00000.vtc
0 → 100644
View file @
6ba917d8
varnishtest "SF-blob parsing in VCL"
varnish v1 -errvcl "BLOB must have n*3 base64 characters" { sub vcl_recv { :a: } }
varnish v2 -errvcl "BLOB must have n*3 base64 characters" { sub vcl_recv { :aa: } }
varnish v3 -errvcl "Illegal BLOB character:" { sub vcl_recv { :aa?: } }
varnish v4 -errvcl "BLOB must have n*3 base64 characters" { sub vcl_recv { :aaaa: } }
varnish v5 -errvcl "Wrong padding ('=') in BLOB" { sub vcl_recv { :aaa=aa: } }
varnish v6 -errvcl "Wrong padding ('=') in BLOB" { sub vcl_recv { :aaa==a: } }
varnish v7 -errvcl "Wrong padding ('=') in BLOB" { sub vcl_recv { :aaaa=a: } }
varnish v8 -errvcl "BLOB is not supported yet" { sub vcl_recv { :aaaa==: } }
lib/libvcc/vcc_token.c
View file @
6ba917d8
...
@@ -388,7 +388,7 @@ vcc_addtoken(struct vcc *tl, unsigned tok,
...
@@ -388,7 +388,7 @@ vcc_addtoken(struct vcc *tl, unsigned tok,
void
void
vcc_Lexer
(
struct
vcc
*
tl
,
const
struct
source
*
sp
,
int
eoi
)
vcc_Lexer
(
struct
vcc
*
tl
,
const
struct
source
*
sp
,
int
eoi
)
{
{
const
char
*
p
,
*
q
;
const
char
*
p
,
*
q
,
*
r
;
unsigned
u
;
unsigned
u
;
for
(
p
=
sp
->
b
;
p
<
sp
->
e
;
)
{
for
(
p
=
sp
->
b
;
p
<
sp
->
e
;
)
{
...
@@ -483,6 +483,49 @@ vcc_Lexer(struct vcc *tl, const struct source *sp, int eoi)
...
@@ -483,6 +483,49 @@ vcc_Lexer(struct vcc *tl, const struct source *sp, int eoi)
return
;
return
;
}
}
/* Recognize BLOB (= SF-binary) */
if
(
*
p
==
':'
)
{
r
=
NULL
;
for
(
q
=
p
+
1
;
q
<
sp
->
e
&&
vct_isbase64
(
*
q
);
q
++
)
{
if
(
r
==
NULL
&&
*
q
==
'='
)
r
=
q
;
}
if
(
q
==
sp
->
e
||
*
q
!=
':'
)
{
VSB_cat
(
tl
->
sb
,
"Illegal BLOB character:
\n
"
);
vcc_addtoken
(
tl
,
EOI
,
sp
,
q
,
q
+
1
);
vcc_ErrWhere
(
tl
,
tl
->
t
);
return
;
}
if
((
q
-
p
)
%
3
!=
1
)
{
u
=
((
q
-
1
)
-
p
)
/
3
;
vcc_addtoken
(
tl
,
EOI
,
sp
,
p
+
u
*
3
+
1
,
q
);
VSB_cat
(
tl
->
sb
,
"BLOB must have n*3 base64 characters
\n
"
);
vcc_ErrWhere
(
tl
,
tl
->
t
);
return
;
}
if
(
r
==
NULL
)
{
/* No padding; */
}
else
if
(
r
+
1
==
q
)
{
/* One pad char */
}
else
if
(
r
+
2
==
q
&&
r
[
1
]
==
'='
)
{
/* Two (valid) pad chars */
}
else
{
VSB_cat
(
tl
->
sb
,
"Wrong padding ('=') in BLOB:
\n
"
);
vcc_addtoken
(
tl
,
EOI
,
sp
,
r
,
r
+
1
);
vcc_ErrWhere
(
tl
,
tl
->
t
);
return
;
}
p
=
q
+
1
;
vcc_addtoken
(
tl
,
EOI
,
sp
,
p
,
q
);
VSB_cat
(
tl
->
sb
,
"BLOB is not supported yet.
\n
"
);
vcc_ErrWhere
(
tl
,
tl
->
t
);
return
;
}
/* Match for the fixed tokens (see generate.py) */
/* Match for the fixed tokens (see generate.py) */
u
=
vcl_fixed_token
(
p
,
&
q
);
u
=
vcl_fixed_token
(
p
,
&
q
);
if
(
u
!=
0
)
{
if
(
u
!=
0
)
{
...
...
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