Varnish Enterprise 6.0.18r7 is a feature and bug fix release.
The highlight of this release is a major update of the VCL compiler, bringing the VCL syntax of Varnish Enterprise almost on par with Varnish Cache 9.0. The update adds ACL options, BLOB literals, VMOD import aliases, glob includes and string methods. It does not add new VCL variables.
The update comes with a few minor breaking changes to VCL, and major
breaking changes for third-party VMODs, which must be adapted and
rebuilt. VMODs shipped with Varnish Enterprise are already updated.
Read the breaking changes before upgrading, and
run varnishd -C -f /etc/varnish/default.vcl to confirm your VCL
still compiles. The VCL changes are narrow, and most VCL should
compile without modification. As with any upgrade, we recommend
validating it in a staging environment before rolling it out to
production.
Quoted header names: Header names that are not valid VCL
identifiers must now be quoted. This removes ambiguities like
req.http.req.http.example, where it was impossible to tell a
spelling mistake from a header actually called req.http.example.
set resp.http."123" = "456";
set req.http."req.http.example" = "value";
unused keyword: The new unused keyword marks backends,
probes, ACLs and subroutines as intentionally unused, which disables
the compilation error for them. A VCL symbol named unused, for
example an object created with new unused = ..., must be renamed.
Assigning resp.body and beresp.body: An assignment now
replaces the body instead of appending to it. Use the new +=
operator to append. synthetic() still appends.
sub vcl_synth {
set resp.body = "Hello ";
set resp.body += "world";
return (deliver);
}
Scientific notation: Numbers in scientific notation, like
2.5e-3, are no longer accepted.
VMOD API: There are many breaking changes for VMODs, most
prominently the removal of the STRING_LIST type and slightly
different code generation from vmodtool.py. See vrt.h for the
list of additions and breaking changes. Third-party VMODs must be
adapted and rebuilt for this release.
ACL options: ACLs can now take options, enabled or disabled with a
plus or minus prefix: +log logs in VSL whether the ACL matched,
+table implements the ACL with a table instead of compiled code,
-pedantic allows masks covering non-zero host bits, and -fold
disables folding of subnets and adjacent networks.
acl purgers -pedantic +log {
"firewall.example.com" / 24;
}
ACL diagnostics were improved, so existing ACLs may produce new compilation warnings.
BLOB literals: Base64 data between colons is a BLOB literal. It
can be passed to VMOD functions taking a BLOB argument, or assigned to
resp.body and beresp.body, which now accept both strings and
BLOBs.
sub vcl_synth {
set resp.body = :aGVsbG8gd29ybGQ=:;
return (deliver);
}
VMOD import aliases: A VMOD can be imported under a different name.
import headerplus as hdr;
sub vcl_recv {
hdr.init_req();
}
Glob includes: include +glob includes all files matching a
pattern. The pattern must be an absolute path or start with ./.
include +glob "/etc/varnish/example.org/*.vcl";
String methods: String types (STRING, STRANDS and HEADER)
have .lower() and .upper() methods returning a lower- or
upper-case copy of the string.
sub vcl_hash {
hash_data(req.http.host.lower());
}
For VMOD authors: New REGEX and SUB types represent compiled
regular expressions and VCL subroutines. The new $Alias stanza
renames a function or method while keeping the old name as a
deprecated alias. Varnish Enterprise VMODs may use it to improve
naming, with a grace period before obsolete aliases are removed.
A few VCL changes from Varnish Cache are not part of this release,
including the .resolve() method and the .via attribute for backends.
See the changelog for the full list. They may appear in future
releases.
Fixed several crashes in the cache: a grace object banned or evicted
during a lookup could still be delivered (VS issue #3540), a
connection arriving during socket.close or while the child was
stopping could crash it (VS issue #2327), and an object’s storage
could be freed twice during eviction (VS issue #3539).
std.rollback() no longer panics when given the wrong HTTP argument.
The argument is now optional and ignored, and the right HTTP object is
inferred from where it is called.
Piped requests, CONNECT tunnels and HTTP/2 sessions over TLS could stall when a TLS record carried more data than the internal read buffer.
vmod_file.exec() with output_stdout or output_stderr set to
false no longer stalls until its timeout when the program writes a
lot of output to the discarded stream. (VS issue #3475)
See the changelog for the complete list of changes.