Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
L
libvmod-blobsynth
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
uplex-varnish
libvmod-blobsynth
Commits
b35f21cd
Unverified
Commit
b35f21cd
authored
Jun 13, 2023
by
Nils Goroll
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use $Restrict
parent
c834a405
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
18 additions
and
18 deletions
+18
-18
test01.vtc
src/tests/test01.vtc
+16
-9
vmod_blobsynth.c
src/vmod_blobsynth.c
+1
-6
vmod_blobsynth.vcc
src/vmod_blobsynth.vcc
+1
-3
No files found.
src/tests/test01.vtc
View file @
b35f21cd
...
...
@@ -15,9 +15,7 @@ varnish v1 -vcl+backend {
}
sub vcl_recv {
# wrong, triggers error
blobsynth.synthetic(gif.get());
return(synth(200));
return (synth(200));
}
sub vcl_synth {
...
...
@@ -27,11 +25,6 @@ varnish v1 -vcl+backend {
}
} -start
logexpect l1 -v v1 -g raw -d 1 {
expect 0 0 CLI {^Rd vcl.load}
expect 1001 * VCL_Error {^blobsynth.synthetic.. only valid in}
} -start
client c1 {
txreq -url "/"
rxresp
...
...
@@ -40,4 +33,18 @@ client c1 {
client c1 -run
logexpect l1 -wait
varnish v1 -errvcl {Not available in subroutine 'vcl_recv'} {
import blob;
import ${vmod_blobsynth};
sub vcl_init {
new gif = blob.blob(BASE64,
"R0lGODlhAQABAPAAAAAAAAAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw==");
}
sub vcl_recv {
# wrong, triggers error
blobsynth.synthetic(gif.get());
return(synth(200));
}
}
\ No newline at end of file
src/vmod_blobsynth.c
View file @
b35f21cd
...
...
@@ -16,12 +16,7 @@ vmod_synthetic(VRT_CTX, VCL_BLOB body)
{
struct
vsb
*
vsb
;
if
((
ctx
->
method
&
(
VCL_MET_SYNTH
|
VCL_MET_BACKEND_ERROR
))
==
0
)
{
VSLb
(
ctx
->
vsl
,
SLT_VCL_Error
,
"blobsynth.synthetic() only valid in vcl_synth{}"
" and vcl_backend_error{}"
);
return
;
}
AN
(
ctx
->
method
&
(
VCL_MET_SYNTH
|
VCL_MET_BACKEND_ERROR
));
CAST_OBJ_NOTNULL
(
vsb
,
ctx
->
specific
,
VSB_MAGIC
);
...
...
src/vmod_blobsynth.vcc
View file @
b35f21cd
...
...
@@ -14,6 +14,4 @@ $Function VOID synthetic(BLOB blob)
Create a synthetic response from *blob*, equivalent to the
``synthetic()`` built-in function except for the argument type.
Needs to be called from ``vcl_synth`` or
``vcl_backend_error``. Otherwise, the function has no effect other
than logging a ``VCL_Error`` message to VSL.
$Restrict vcl_synth vcl_backend_error
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