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
6f587a30
Commit
6f587a30
authored
Oct 26, 2020
by
Andrew Wiik
Committed by
Dridi Boukelmoune
Nov 24, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add """ ... """ as a long string format in VCL
parent
7a12b1c3
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
53 additions
and
1 deletion
+53
-1
v00019.vtc
bin/varnishtest/tests/v00019.vtc
+5
-0
v00066.vtc
bin/varnishtest/tests/v00066.vtc
+22
-0
vcc_token.c
lib/libvcc/vcc_token.c
+26
-1
No files found.
bin/varnishtest/tests/v00019.vtc
View file @
6f587a30
...
...
@@ -18,6 +18,11 @@ varnish v1 -errvcl {Unterminated long-string, starting at} {
{" }
}
varnish v1 -errvcl {Unterminated long-string, starting at} {
backend b { .host = "127.0.0.1"; }
""" ""
}
varnish v1 -errvcl {Unterminated string at} {
backend b { .host = "127.0.0.1"; }
"
...
...
bin/varnishtest/tests/v00066.vtc
0 → 100644
View file @
6f587a30
varnishtest "long string coverage"
varnish v1 -vcl {
backend default none;
sub vcl_recv {
return (synth(200));
}
sub vcl_synth {
set resp.body = """{"key":"value"}""";
return (deliver);
}
} -start
client c1 {
txreq
rxresp
expect resp.status == 200
expect resp.bodylen == 15
expect resp.body == {{"key":"value"}}
} -run
lib/libvcc/vcc_token.c
View file @
6f587a30
...
...
@@ -462,7 +462,7 @@ vcc_Lexer(struct vcc *tl, const struct source *sp, int eoi)
return
;
}
/* Recognize long-strings */
/* Recognize long-strings
{" "}
*/
if
(
*
p
==
'{'
&&
p
[
1
]
==
'"'
)
{
for
(
q
=
p
+
2
;
q
<
sp
->
e
;
q
++
)
{
if
(
*
q
==
'"'
&&
q
[
1
]
==
'}'
)
{
...
...
@@ -487,6 +487,31 @@ vcc_Lexer(struct vcc *tl, const struct source *sp, int eoi)
return
;
}
/* Recognize long-strings """ """ */
if
(
*
p
==
'"'
&&
p
[
1
]
==
'"'
&&
p
[
2
]
==
'"'
)
{
for
(
q
=
p
+
3
;
q
<
sp
->
e
;
q
++
)
{
if
(
*
q
==
'"'
&&
q
[
1
]
==
'"'
&&
q
[
2
]
==
'"'
)
{
vcc_addtoken
(
tl
,
CSTR
,
sp
,
p
,
q
+
3
);
break
;
}
}
if
(
q
<
sp
->
e
)
{
p
=
q
+
3
;
u
=
tl
->
t
->
e
-
tl
->
t
->
b
;
u
-=
6
;
/* """ ... """ */
tl
->
t
->
dec
=
TlAlloc
(
tl
,
u
+
1
);
AN
(
tl
->
t
->
dec
);
memcpy
(
tl
->
t
->
dec
,
tl
->
t
->
b
+
3
,
u
);
tl
->
t
->
dec
[
u
]
=
'\0'
;
continue
;
}
vcc_addtoken
(
tl
,
EOI
,
sp
,
p
,
p
+
3
);
VSB_cat
(
tl
->
sb
,
"Unterminated long-string, starting at
\n
"
);
vcc_ErrWhere
(
tl
,
tl
->
t
);
return
;
}
/* Recognize BLOB (= SF-binary) */
if
(
*
p
==
':'
)
{
vsb
=
VSB_new_auto
();
...
...
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