Commit 312e1f89 authored by Geoff Simmons's avatar Geoff Simmons

add an event function to check version compatibility with Varnish

parent 7cb06c72
AC_PREREQ(2.59) AC_PREREQ(2.59)
AC_COPYRIGHT([Copyright (c) 2015-2016 UPLEX - Nils Goroll Systemoptimierung]) AC_COPYRIGHT([Copyright (c) 2015-2016 UPLEX - Nils Goroll Systemoptimierung])
AC_INIT([libvmod-blobcode], [0.1]) AC_INIT([libvmod-blobcode], [1.0])
AC_CONFIG_MACRO_DIR([m4]) AC_CONFIG_MACRO_DIR([m4])
m4_ifndef([VARNISH_VMOD_INCLUDES], AC_MSG_ERROR([Need varnish.m4 -- see README.rst])) m4_ifndef([VARNISH_VMOD_INCLUDES], AC_MSG_ERROR([Need varnish.m4 -- see README.rst]))
AC_CONFIG_SRCDIR(src/vmod_blobcode.vcc) AC_CONFIG_SRCDIR(src/vmod_blobcode.vcc)
......
...@@ -197,6 +197,23 @@ err_decode(VRT_CTX, const char *enc) ...@@ -197,6 +197,23 @@ err_decode(VRT_CTX, const char *enc)
} }
} }
/* Event function */
int __match_proto__(vmod_event_f)
event(VRT_CTX, struct vmod_priv *priv, enum vcl_event_e e)
{
if (e != VCL_EVENT_LOAD)
return 0;
if (VRT_MAJOR_VERSION < 3
|| (VRT_MAJOR_VERSION == 3 && VRT_MINOR_VERSION < 2)) {
AN(ctx->msg);
VSB_cat(ctx->msg,
"vmod blobcode: not compatible with Varnish versions < 4.1.2");
return 1;
}
return 0;
}
/* Objects */ /* Objects */
VCL_VOID __match_proto__(td_blobcode_blob__init) VCL_VOID __match_proto__(td_blobcode_blob__init)
......
...@@ -10,6 +10,8 @@ ...@@ -10,6 +10,8 @@
$Module blobcode 3 binary-to-text encodings and decodings for the VCL blob type $Module blobcode 3 binary-to-text encodings and decodings for the VCL blob type
$Event event
:: ::
sub vcl_init { sub vcl_init {
...@@ -355,6 +357,10 @@ REQUIREMENTS ...@@ -355,6 +357,10 @@ REQUIREMENTS
This VMOD requires at least Varnish version 4.1.2, and has been tested This VMOD requires at least Varnish version 4.1.2, and has been tested
with versions through 5.0.0. with versions through 5.0.0.
Later versions of this VMOD are only compatible with Varnish versions
since 5.0.0, and permit the use of the ``encode``, ``decode`` and
``transcode`` functions in ``vcl_init``.
Perl 5 is required for the build. Perl 5 is required for the build.
INSTALLATION INSTALLATION
...@@ -441,6 +447,8 @@ HISTORY ...@@ -441,6 +447,8 @@ HISTORY
* version 0.1: initial version * version 0.1: initial version
* version 1.0: compatible with Varnish versions since 4.1.2.
SEE ALSO SEE ALSO
======== ========
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment