Manual section: | 3 |
---|
import std [from "path"] ;
vmod_std contains basic functions which are part and parcel of Varnish, but which for reasons of architecture fit better in a VMOD.
One particular class of functions in vmod_std is the conversions functions which all have the form:
TYPE type(STRING, TYPE)
These functions attempt to convert STRING to the TYPE, and if that fails, they return the second argument, which must have the given TYPE.
std.syslog(9, "Something is wrong");
This will send a message to syslog using LOG_USER | LOG_ALERT.
Collapses multiple hdr headers into one long header. The header values are joined with a comma (",").
Care should be taken when collapsing headers. In particular collapsing Set-Cookie will lead to unexpected results on the browser side.
Cache the req.body if it is smaller than size.
Caching the req.body makes it possible to retry pass operations (POST, PUT).
std.cache_req_body(1KB);
This will cache the req.body if its size is smaller than 1KB.
Returns a string beginning at the first occurrence of the string s2 in the string s1, or an empty string if s2 is not found.
Note that the comparison is case sensitive.
This will check if the content of req.http.restrict occurs anywhere in req.url.
Converts the string s to a time. If conversion fails, fallback will be returned.
Supported formats:
The Varnish standard module was released along with Varnish Cache 3.0. This manual page was written by Per Buer with help from Martin Blix Grydeland.
This document is licensed under the same licence as Varnish itself. See LICENCE for details.