Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
L
libvmod-blobdigest
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
2
Issues
2
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-blobdigest
Commits
3e00cac5
Commit
3e00cac5
authored
Nov 07, 2016
by
Geoff Simmons
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
In Varnish 5.0, hash() is legal in vcl_init and _fini
parent
2036307d
Pipeline
#71
skipped
Changes
4
Pipelines
1
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
46 additions
and
11 deletions
+46
-11
README.rst
README.rst
+3
-2
md5.vtc
src/tests/md5.vtc
+40
-0
vmod_blobdigest.c
src/vmod_blobdigest.c
+0
-7
vmod_blobdigest.vcc
src/vmod_blobdigest.vcc
+3
-2
No files found.
README.rst
View file @
3e00cac5
...
...
@@ -480,8 +480,9 @@ Example::
REQUIREMENTS
============
This VMOD requires at least Varnish version 4.1, and has been tested
against versions through 5.0.0.
This version of the VMOD requires Varnish version 5.0.0. See branch
4.1 in the source repository for versions that are compatible with
Varnish 4.1.
The gcc compiler and Perl 5 are required for the build. For the
self-tests invoked by ``make check``, the VMODs ``blobcode`` and
...
...
src/tests/md5.vtc
View file @
3e00cac5
...
...
@@ -608,3 +608,43 @@ logexpect l1 -v v1 -d 1 -g vxid -q "VCL_Error" {
expect * = VCL_Error "^vmod blobdigest error: already finalized in d1.update..$"
expect * = End
} -run
# hash() is legal in vcl_init and vcl_fini (as of Varnish 5.0)
varnish v2 -arg "-p debug=+vclrel" -vcl {
import blobdigest from "${vmod_topbuild}/src/.libs/libvmod_blobdigest.so";
import blobcode;
import blob;
import std;
backend b { .host = "${bad_ip}"; }
sub vcl_init {
new empty = blobcode.blob(IDENTITY, "");
new md5 = blobcode.blob(HEX,
"D41D8CD98F00B204E9800998ECF8427E");
if (!blob.equal(blobdigest.hash(MD5, empty.get()), md5.get())) {
return(fail);
}
}
sub vcl_fini {
if (blob.equal(blobdigest.hash(MD5, empty.get()), md5.get())) {
std.log("blobs are equal");
}
else {
std.log("blobs not equal");
}
}
} -start
varnish v2 -vcl {
backend b { .host = "${bad_ip}"; }
}
logexpect l2 -v v2 -d 0 -g raw -q "VCL_Log" {
expect 0 * VCL_Log "^blobs are equal$"
} -start
varnish v2 -cliok "vcl.use vcl2"
varnish v2 -cliok "vcl.discard vcl1"
logexpect l2 -wait
src/vmod_blobdigest.c
View file @
3e00cac5
...
...
@@ -56,9 +56,6 @@
#define INIT_FINI(ctx) (((ctx)->method & (VCL_MET_INIT | VCL_MET_FINI)) != 0)
#define ILLEGAL(ctx, m) \
ERR((ctx), m " is illegal in vcl_init() and vcl_fini().")
struct
digest_task
{
unsigned
magic
;
#define VMOD_BLOBDIGEST_DIGEST_TASK_MAGIC 0x646937a8
...
...
@@ -505,10 +502,6 @@ vmod_hash(VRT_CTX, VCL_ENUM hashs, VCL_BLOB msg)
hash_ctx
hctx
[
1
];
CHECK_OBJ_NOTNULL
(
ctx
,
VRT_CTX_MAGIC
);
if
(
INIT_FINI
(
ctx
))
{
ILLEGAL
(
ctx
,
"hash()"
);
return
NULL
;
}
if
(
msg
==
NULL
)
return
NULL
;
...
...
src/vmod_blobdigest.vcc
View file @
3e00cac5
...
...
@@ -412,8 +412,9 @@ Example::
REQUIREMENTS
============
This VMOD requires at least Varnish version 4.1, and has been tested
against versions through 5.0.0.
This version of the VMOD requires Varnish version 5.0.0. See branch
4.1 in the source repository for versions that are compatible with
Varnish 4.1.
The gcc compiler and Perl 5 are required for the build. For the
self-tests invoked by ``make check``, the VMODs ``blobcode`` and
...
...
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