Linux server.kiran-academy.com 3.10.0-1160.108.1.el7.x86_64 #1 SMP Thu Jan 25 16:17:31 UTC 2024 x86_64
Apache/2.4.57 (Unix) OpenSSL/1.0.2k-fips
: 194.233.91.196 | : 216.73.216.172
Cant Read [ /etc/named.conf ]
7.4.32
finalho
www.github.com/MadExploits
Terminal
AUTO ROOT
Adminer
Backdoor Destroyer
Linux Exploit
Lock Shell
Lock File
Create User
CREATE RDP
PHP Mailer
BACKCONNECT
UNLOCK SHELL
HASH IDENTIFIER
CPANEL RESET
CREATE WP USER
README
+ Create Folder
+ Create File
/
usr /
share /
doc /
varnish-5.2.1 /
html /
reference /
[ HOME SHELL ]
Name
Size
Permission
Action
directors.html
17.15
KB
-rw-r--r--
index.html
11.66
KB
-rw-r--r--
states.html
6.61
KB
-rw-r--r--
varnish-cli.html
42.86
KB
-rw-r--r--
varnish-counters.html
47.32
KB
-rw-r--r--
varnishadm.html
11.39
KB
-rw-r--r--
varnishd.html
97.37
KB
-rw-r--r--
varnishhist.html
13.74
KB
-rw-r--r--
varnishlog.html
14.57
KB
-rw-r--r--
varnishncsa.html
20.51
KB
-rw-r--r--
varnishstat.html
15.77
KB
-rw-r--r--
varnishtest.html
20.91
KB
-rw-r--r--
varnishtop.html
14.9
KB
-rw-r--r--
vcl.html
60.01
KB
-rw-r--r--
vmod.html
38.09
KB
-rw-r--r--
vmod_blob.generated.html
60.21
KB
-rw-r--r--
vmod_directors.generated.html
47.28
KB
-rw-r--r--
vmod_purge.generated.html
11.75
KB
-rw-r--r--
vmod_std.generated.html
36.32
KB
-rw-r--r--
vmod_vtc.generated.html
21.55
KB
-rw-r--r--
vsl-query.html
23.18
KB
-rw-r--r--
vsl.html
57.59
KB
-rw-r--r--
vsm.html
10.09
KB
-rw-r--r--
vtc.html
57.21
KB
-rw-r--r--
Delete
Unzip
Zip
${this.title}
Close
Code Editor : vmod_std.generated.html
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>vmod_std — Varnish version 5.2.1 documentation</title> <link rel="stylesheet" href="../_static/classic.css" type="text/css" /> <link rel="stylesheet" href="../_static/pygments.css" type="text/css" /> <script type="text/javascript"> var DOCUMENTATION_OPTIONS = { URL_ROOT: '../', VERSION: '5.2.1', COLLAPSE_INDEX: false, FILE_SUFFIX: '.html', HAS_SOURCE: true }; </script> <script type="text/javascript" src="../_static/jquery.js"></script> <script type="text/javascript" src="../_static/underscore.js"></script> <script type="text/javascript" src="../_static/doctools.js"></script> <link rel="index" title="Index" href="../genindex.html" /> <link rel="search" title="Search" href="../search.html" /> <link rel="top" title="Varnish version 5.2.1 documentation" href="../index.html" /> <link rel="up" title="The Varnish Reference Manual" href="index.html" /> <link rel="next" title="vmod_directors" href="vmod_directors.generated.html" /> <link rel="prev" title="VMOD - Varnish Modules" href="vmod.html" /> </head> <body role="document"> <div class="related" role="navigation" aria-label="related navigation"> <h3>Navigation</h3> <ul> <li class="right" style="margin-right: 10px"> <a href="../genindex.html" title="General Index" accesskey="I">index</a></li> <li class="right" > <a href="vmod_directors.generated.html" title="vmod_directors" accesskey="N">next</a> |</li> <li class="right" > <a href="vmod.html" title="VMOD - Varnish Modules" accesskey="P">previous</a> |</li> <li class="nav-item nav-item-0"><a href="../index.html">Varnish version 5.2.1 documentation</a> »</li> <li class="nav-item nav-item-1"><a href="index.html" accesskey="U">The Varnish Reference Manual</a> »</li> </ul> </div> <div class="document"> <div class="documentwrapper"> <div class="bodywrapper"> <div class="body" role="main"> <div class="section" id="vmod-std"> <span id="vmod-std-3"></span><h1>vmod_std<a class="headerlink" href="#vmod-std" title="Permalink to this headline">¶</a></h1> <div class="section" id="varnish-standard-module"> <h2>Varnish Standard Module<a class="headerlink" href="#varnish-standard-module" title="Permalink to this headline">¶</a></h2> <table class="docutils field-list" frame="void" rules="none"> <col class="field-name" /> <col class="field-body" /> <tbody valign="top"> <tr class="field-odd field"><th class="field-name">Manual section:</th><td class="field-body">3</td> </tr> </tbody> </table> <div class="section" id="synopsis"> <h3>SYNOPSIS<a class="headerlink" href="#synopsis" title="Permalink to this headline">¶</a></h3> <p>import std [from "path"] ;</p> </div> <div class="section" id="contents"> <h3>CONTENTS<a class="headerlink" href="#contents" title="Permalink to this headline">¶</a></h3> <ul class="simple"> <li><a class="reference internal" href="#func-cache-req-body"><span class="std std-ref">cache_req_body</span></a></li> <li><a class="reference internal" href="#func-collect"><span class="std std-ref">collect</span></a></li> <li><a class="reference internal" href="#func-duration"><span class="std std-ref">duration</span></a></li> <li><a class="reference internal" href="#func-file-exists"><span class="std std-ref">file_exists</span></a></li> <li><a class="reference internal" href="#func-fileread"><span class="std std-ref">fileread</span></a></li> <li><a class="reference internal" href="#func-getenv"><span class="std std-ref">getenv</span></a></li> <li><a class="reference internal" href="#func-healthy"><span class="std std-ref">healthy</span></a></li> <li><a class="reference internal" href="#func-integer"><span class="std std-ref">integer</span></a></li> <li><a class="reference internal" href="#func-ip"><span class="std std-ref">ip</span></a></li> <li><a class="reference internal" href="#func-late-100-continue"><span class="std std-ref">late_100_continue</span></a></li> <li><a class="reference internal" href="#func-log"><span class="std std-ref">log</span></a></li> <li><a class="reference internal" href="#func-port"><span class="std std-ref">port</span></a></li> <li><a class="reference internal" href="#func-querysort"><span class="std std-ref">querysort</span></a></li> <li><a class="reference internal" href="#func-random"><span class="std std-ref">random</span></a></li> <li><a class="reference internal" href="#func-real"><span class="std std-ref">real</span></a></li> <li><a class="reference internal" href="#func-real2integer"><span class="std std-ref">real2integer</span></a></li> <li><a class="reference internal" href="#func-real2time"><span class="std std-ref">real2time</span></a></li> <li><a class="reference internal" href="#func-rollback"><span class="std std-ref">rollback</span></a></li> <li><a class="reference internal" href="#func-set-ip-tos"><span class="std std-ref">set_ip_tos</span></a></li> <li><a class="reference internal" href="#func-strstr"><span class="std std-ref">strstr</span></a></li> <li><a class="reference internal" href="#func-syslog"><span class="std std-ref">syslog</span></a></li> <li><a class="reference internal" href="#func-time"><span class="std std-ref">time</span></a></li> <li><a class="reference internal" href="#func-time2integer"><span class="std std-ref">time2integer</span></a></li> <li><a class="reference internal" href="#func-time2real"><span class="std std-ref">time2real</span></a></li> <li><a class="reference internal" href="#func-timestamp"><span class="std std-ref">timestamp</span></a></li> <li><a class="reference internal" href="#func-tolower"><span class="std std-ref">tolower</span></a></li> <li><a class="reference internal" href="#func-toupper"><span class="std std-ref">toupper</span></a></li> </ul> </div> <div class="section" id="description"> <h3>DESCRIPTION<a class="headerlink" href="#description" title="Permalink to this headline">¶</a></h3> <p><cite>vmod_std</cite> contains basic functions which are part and parcel of Varnish, but which for reasons of architecture fit better in a VMOD.</p> <p>One particular class of functions in vmod_std is the conversions functions which all have the form:</p> <div class="highlight-default"><div class="highlight"><pre><span></span><span class="n">TYPE</span> <span class="nb">type</span><span class="p">(</span><span class="n">STRING</span><span class="p">,</span> <span class="n">TYPE</span><span class="p">)</span> </pre></div> </div> <p>These functions attempt to convert STRING to the TYPE, and if that fails, they return the second argument, which must have the given TYPE.</p> <div class="section" id="toupper"> <span id="func-toupper"></span><h4>toupper<a class="headerlink" href="#toupper" title="Permalink to this headline">¶</a></h4> <div class="highlight-default"><div class="highlight"><pre><span></span><span class="n">STRING</span> <span class="n">toupper</span><span class="p">(</span><span class="n">STRING</span> <span class="n">s</span><span class="p">)</span> </pre></div> </div> <dl class="docutils"> <dt>Description</dt> <dd>Converts the string <em>s</em> to uppercase.</dd> <dt>Example</dt> <dd>set beresp.http.scream = std.toupper("yes!");</dd> </dl> </div> <div class="section" id="tolower"> <span id="func-tolower"></span><h4>tolower<a class="headerlink" href="#tolower" title="Permalink to this headline">¶</a></h4> <div class="highlight-default"><div class="highlight"><pre><span></span><span class="n">STRING</span> <span class="n">tolower</span><span class="p">(</span><span class="n">STRING</span> <span class="n">s</span><span class="p">)</span> </pre></div> </div> <dl class="docutils"> <dt>Description</dt> <dd>Converts the string <em>s</em> to lowercase.</dd> <dt>Example</dt> <dd>set beresp.http.nice = std.tolower("VerY");</dd> </dl> </div> <div class="section" id="set-ip-tos"> <span id="func-set-ip-tos"></span><h4>set_ip_tos<a class="headerlink" href="#set-ip-tos" title="Permalink to this headline">¶</a></h4> <div class="highlight-default"><div class="highlight"><pre><span></span><span class="n">VOID</span> <span class="n">set_ip_tos</span><span class="p">(</span><span class="n">INT</span> <span class="n">tos</span><span class="p">)</span> </pre></div> </div> <dl class="docutils"> <dt>Description</dt> <dd>Sets the IP type-of-service (TOS) field for the current session to <em>tos</em>. Please note that the TOS field is not removed by the end of the request so probably want to set it on every request should you utilize it.</dd> <dt>Example</dt> <dd><div class="first last line-block"> <div class="line">if (req.url ~ "^/slow/") {</div> <div class="line-block"> <div class="line">std.set_ip_tos(0);</div> </div> <div class="line">}</div> </div> </dd> </dl> </div> <div class="section" id="random"> <span id="func-random"></span><h4>random<a class="headerlink" href="#random" title="Permalink to this headline">¶</a></h4> <div class="highlight-default"><div class="highlight"><pre><span></span><span class="n">REAL</span> <span class="n">random</span><span class="p">(</span><span class="n">REAL</span> <span class="n">lo</span><span class="p">,</span> <span class="n">REAL</span> <span class="n">hi</span><span class="p">)</span> </pre></div> </div> <dl class="docutils"> <dt>Description</dt> <dd>Returns a random real number between <em>lo</em> and <em>hi</em>. This function uses the "testable" random generator in varnishd which enables determinstic tests to be run (See m00002.vtc). This function should not be used for cryptographic applications.</dd> <dt>Example</dt> <dd>set beresp.http.random-number = std.random(1, 100);</dd> </dl> </div> <div class="section" id="log"> <span id="func-log"></span><h4>log<a class="headerlink" href="#log" title="Permalink to this headline">¶</a></h4> <div class="highlight-default"><div class="highlight"><pre><span></span><span class="n">VOID</span> <span class="n">log</span><span class="p">(</span><span class="n">STRING</span> <span class="n">s</span><span class="p">)</span> </pre></div> </div> <dl class="docutils"> <dt>Description</dt> <dd>Logs the string <em>s</em> to the shared memory log, using VSL tag <em>SLT_VCL_Log</em>.</dd> <dt>Example</dt> <dd>std.log("Something fishy is going on with the vhost " + req.http.host);</dd> </dl> </div> <div class="section" id="syslog"> <span id="func-syslog"></span><h4>syslog<a class="headerlink" href="#syslog" title="Permalink to this headline">¶</a></h4> <div class="highlight-default"><div class="highlight"><pre><span></span><span class="n">VOID</span> <span class="n">syslog</span><span class="p">(</span><span class="n">INT</span> <span class="n">priority</span><span class="p">,</span> <span class="n">STRING</span> <span class="n">s</span><span class="p">)</span> </pre></div> </div> <dl class="docutils"> <dt>Description</dt> <dd>Logs the string <em>s</em> to syslog tagged with <em>priority</em>. <em>priority</em> is formed by ORing the facility and level values. See your system's syslog.h file for possible values.</dd> <dt>Example</dt> <dd><p class="first">std.syslog(9, "Something is wrong");</p> <p class="last">This will send a message to syslog using LOG_USER | LOG_ALERT.</p> </dd> </dl> </div> <div class="section" id="fileread"> <span id="func-fileread"></span><h4>fileread<a class="headerlink" href="#fileread" title="Permalink to this headline">¶</a></h4> <div class="highlight-default"><div class="highlight"><pre><span></span><span class="n">STRING</span> <span class="n">fileread</span><span class="p">(</span><span class="n">PRIV_CALL</span><span class="p">,</span> <span class="n">STRING</span><span class="p">)</span> </pre></div> </div> <dl class="docutils"> <dt>Description</dt> <dd>Reads a file and returns a string with the content. Please note that it is not recommended to send variables to this function the caching in the function doesn't take this into account. Also, files are not re-read.</dd> <dt>Example</dt> <dd>set beresp.http.served-by = std.fileread("/etc/hostname");</dd> </dl> </div> <div class="section" id="file-exists"> <span id="func-file-exists"></span><h4>file_exists<a class="headerlink" href="#file-exists" title="Permalink to this headline">¶</a></h4> <div class="highlight-default"><div class="highlight"><pre><span></span><span class="n">BOOL</span> <span class="n">file_exists</span><span class="p">(</span><span class="n">STRING</span> <span class="n">path</span><span class="p">)</span> </pre></div> </div> <dl class="docutils"> <dt>Description</dt> <dd>Returns <cite>true</cite> if path or the file pointed to by path exists, <cite>false</cite> otherwise.</dd> <dt>Example</dt> <dd><div class="first last line-block"> <div class="line">if (std.file_exists("/etc/return_503")) {</div> <div class="line-block"> <div class="line">return (synth(503, "Varnish is in maintenance"));</div> </div> <div class="line">}</div> </div> </dd> </dl> </div> <div class="section" id="collect"> <span id="func-collect"></span><h4>collect<a class="headerlink" href="#collect" title="Permalink to this headline">¶</a></h4> <div class="highlight-default"><div class="highlight"><pre><span></span><span class="n">VOID</span> <span class="n">collect</span><span class="p">(</span><span class="n">HEADER</span> <span class="n">hdr</span><span class="p">,</span> <span class="n">STRING</span> <span class="n">sep</span><span class="o">=</span><span class="s2">", "</span><span class="p">)</span> </pre></div> </div> <dl class="docutils"> <dt>Description</dt> <dd><p class="first">Collapses multiple <em>hdr</em> headers into one long header. The default separator <em>sep</em> is the standard comma separator to use when collapsing headers, with an additional whitespace for pretty printing.</p> <p class="last">Care should be taken when collapsing headers. In particular collapsing Set-Cookie will lead to unexpected results on the browser side.</p> </dd> <dt>Examples</dt> <dd><div class="first last line-block"> <div class="line">std.collect(req.http.accept);</div> <div class="line">std.collect(req.http.cookie, "; ");</div> </div> </dd> </dl> </div> <div class="section" id="duration"> <span id="func-duration"></span><h4>duration<a class="headerlink" href="#duration" title="Permalink to this headline">¶</a></h4> <div class="highlight-default"><div class="highlight"><pre><span></span><span class="n">DURATION</span> <span class="n">duration</span><span class="p">(</span><span class="n">STRING</span> <span class="n">s</span><span class="p">,</span> <span class="n">DURATION</span> <span class="n">fallback</span><span class="p">)</span> </pre></div> </div> <dl class="docutils"> <dt>Description</dt> <dd>Converts the string <em>s</em> to seconds. <em>s</em> must be quantified with ms (milliseconds), s (seconds), m (minutes), h (hours), d (days), w (weeks) or y (years) units. If conversion fails, <em>fallback</em> will be returned.</dd> <dt>Example</dt> <dd>set beresp.ttl = std.duration("1w", 3600s);</dd> </dl> </div> <div class="section" id="integer"> <span id="func-integer"></span><h4>integer<a class="headerlink" href="#integer" title="Permalink to this headline">¶</a></h4> <div class="highlight-default"><div class="highlight"><pre><span></span><span class="n">INT</span> <span class="n">integer</span><span class="p">(</span><span class="n">STRING</span> <span class="n">s</span><span class="p">,</span> <span class="n">INT</span> <span class="n">fallback</span><span class="p">)</span> </pre></div> </div> <dl class="docutils"> <dt>Description</dt> <dd>Converts the string <em>s</em> to an integer. If conversion fails, <em>fallback</em> will be returned.</dd> <dt>Example</dt> <dd><div class="first last line-block"> <div class="line">if (std.integer(req.http.foo, 0) > 5) {</div> <div class="line-block"> <div class="line">...</div> </div> <div class="line">}</div> </div> </dd> </dl> </div> <div class="section" id="ip"> <span id="func-ip"></span><h4>ip<a class="headerlink" href="#ip" title="Permalink to this headline">¶</a></h4> <div class="highlight-default"><div class="highlight"><pre><span></span><span class="n">IP</span> <span class="n">ip</span><span class="p">(</span><span class="n">STRING</span> <span class="n">s</span><span class="p">,</span> <span class="n">IP</span> <span class="n">fallback</span><span class="p">)</span> </pre></div> </div> <dl class="docutils"> <dt>Description</dt> <dd>Converts the string <em>s</em> to the first IP number returned by the system library function getaddrinfo(3). If conversion fails, <em>fallback</em> will be returned.</dd> <dt>Example</dt> <dd><div class="first last line-block"> <div class="line">if (std.ip(req.http.X-forwarded-for, "0.0.0.0") ~ my_acl) {</div> <div class="line-block"> <div class="line">...</div> </div> <div class="line">}</div> </div> </dd> </dl> </div> <div class="section" id="real"> <span id="func-real"></span><h4>real<a class="headerlink" href="#real" title="Permalink to this headline">¶</a></h4> <div class="highlight-default"><div class="highlight"><pre><span></span><span class="n">REAL</span> <span class="n">real</span><span class="p">(</span><span class="n">STRING</span> <span class="n">s</span><span class="p">,</span> <span class="n">REAL</span> <span class="n">fallback</span><span class="p">)</span> </pre></div> </div> <dl class="docutils"> <dt>Description</dt> <dd>Converts the string <em>s</em> to a real. If conversion fails, <em>fallback</em> will be returned.</dd> <dt>Example</dt> <dd><div class="first last line-block"> <div class="line">if (std.real(req.http.foo, 0.0) > 5.5) {</div> <div class="line-block"> <div class="line">...</div> </div> <div class="line">}</div> </div> </dd> </dl> </div> <div class="section" id="real2integer"> <span id="func-real2integer"></span><h4>real2integer<a class="headerlink" href="#real2integer" title="Permalink to this headline">¶</a></h4> <div class="highlight-default"><div class="highlight"><pre><span></span><span class="n">INT</span> <span class="n">real2integer</span><span class="p">(</span><span class="n">REAL</span> <span class="n">r</span><span class="p">,</span> <span class="n">INT</span> <span class="n">fallback</span><span class="p">)</span> </pre></div> </div> <dl class="docutils"> <dt>Description</dt> <dd>Converts the real <em>r</em> to an integer. If conversion fails, <em>fallback</em> will be returned.</dd> <dt>Example</dt> <dd>set req.http.integer = std.real2integer(1140618699.00, 0);</dd> </dl> </div> <div class="section" id="real2time"> <span id="func-real2time"></span><h4>real2time<a class="headerlink" href="#real2time" title="Permalink to this headline">¶</a></h4> <div class="highlight-default"><div class="highlight"><pre><span></span><span class="n">TIME</span> <span class="n">real2time</span><span class="p">(</span><span class="n">REAL</span> <span class="n">r</span><span class="p">,</span> <span class="n">TIME</span> <span class="n">fallback</span><span class="p">)</span> </pre></div> </div> <dl class="docutils"> <dt>Description</dt> <dd>Converts the real <em>r</em> to a time. If conversion fails, <em>fallback</em> will be returned.</dd> <dt>Example</dt> <dd>set req.http.time = std.real2time(1140618699.00, now);</dd> </dl> </div> <div class="section" id="time2integer"> <span id="func-time2integer"></span><h4>time2integer<a class="headerlink" href="#time2integer" title="Permalink to this headline">¶</a></h4> <div class="highlight-default"><div class="highlight"><pre><span></span><span class="n">INT</span> <span class="n">time2integer</span><span class="p">(</span><span class="n">TIME</span> <span class="n">t</span><span class="p">,</span> <span class="n">INT</span> <span class="n">fallback</span><span class="p">)</span> </pre></div> </div> <dl class="docutils"> <dt>Description</dt> <dd>Converts the time <em>t</em> to a integer. If conversion fails, <em>fallback</em> will be returned.</dd> <dt>Example</dt> <dd>set req.http.int = std.time2integer(now, 0);</dd> </dl> </div> <div class="section" id="time2real"> <span id="func-time2real"></span><h4>time2real<a class="headerlink" href="#time2real" title="Permalink to this headline">¶</a></h4> <div class="highlight-default"><div class="highlight"><pre><span></span><span class="n">REAL</span> <span class="n">time2real</span><span class="p">(</span><span class="n">TIME</span> <span class="n">t</span><span class="p">,</span> <span class="n">REAL</span> <span class="n">fallback</span><span class="p">)</span> </pre></div> </div> <dl class="docutils"> <dt>Description</dt> <dd>Converts the time <em>t</em> to a real. If conversion fails, <em>fallback</em> will be returned.</dd> <dt>Example</dt> <dd>set req.http.real = std.time2real(now, 1.0);</dd> </dl> </div> <div class="section" id="healthy"> <span id="func-healthy"></span><h4>healthy<a class="headerlink" href="#healthy" title="Permalink to this headline">¶</a></h4> <div class="highlight-default"><div class="highlight"><pre><span></span><span class="n">BOOL</span> <span class="n">healthy</span><span class="p">(</span><span class="n">BACKEND</span> <span class="n">be</span><span class="p">)</span> </pre></div> </div> <dl class="docutils"> <dt>Description</dt> <dd>Returns <cite>true</cite> if the backend <em>be</em> is healthy.</dd> </dl> </div> <div class="section" id="port"> <span id="func-port"></span><h4>port<a class="headerlink" href="#port" title="Permalink to this headline">¶</a></h4> <div class="highlight-default"><div class="highlight"><pre><span></span><span class="n">INT</span> <span class="n">port</span><span class="p">(</span><span class="n">IP</span> <span class="n">ip</span><span class="p">)</span> </pre></div> </div> <dl class="docutils"> <dt>Description</dt> <dd>Returns the port number of the IP address <em>ip</em>.</dd> </dl> </div> <div class="section" id="rollback"> <span id="func-rollback"></span><h4>rollback<a class="headerlink" href="#rollback" title="Permalink to this headline">¶</a></h4> <div class="highlight-default"><div class="highlight"><pre><span></span><span class="n">VOID</span> <span class="n">rollback</span><span class="p">(</span><span class="n">HTTP</span> <span class="n">h</span><span class="p">)</span> </pre></div> </div> <dl class="docutils"> <dt>Description</dt> <dd>Restores the <em>h</em> HTTP headers to their original state.</dd> <dt>Example</dt> <dd>std.rollback(bereq);</dd> </dl> </div> <div class="section" id="timestamp"> <span id="func-timestamp"></span><h4>timestamp<a class="headerlink" href="#timestamp" title="Permalink to this headline">¶</a></h4> <div class="highlight-default"><div class="highlight"><pre><span></span><span class="n">VOID</span> <span class="n">timestamp</span><span class="p">(</span><span class="n">STRING</span> <span class="n">s</span><span class="p">)</span> </pre></div> </div> <dl class="docutils"> <dt>Description</dt> <dd>Introduces a timestamp in the log with the current time, using the string <em>s</em> as the label. This is useful to time the execution of lengthy VCL procedures, and makes the timestamps inserted automatically by Varnish more accurate.</dd> <dt>Example</dt> <dd>std.timestamp("curl-request");</dd> </dl> </div> <div class="section" id="querysort"> <span id="func-querysort"></span><h4>querysort<a class="headerlink" href="#querysort" title="Permalink to this headline">¶</a></h4> <div class="highlight-default"><div class="highlight"><pre><span></span><span class="n">STRING</span> <span class="n">querysort</span><span class="p">(</span><span class="n">STRING</span><span class="p">)</span> </pre></div> </div> <dl class="docutils"> <dt>Description</dt> <dd>Sorts the query string for cache normalization purposes.</dd> <dt>Example</dt> <dd>set req.url = std.querysort(req.url);</dd> </dl> </div> <div class="section" id="cache-req-body"> <span id="func-cache-req-body"></span><h4>cache_req_body<a class="headerlink" href="#cache-req-body" title="Permalink to this headline">¶</a></h4> <div class="highlight-default"><div class="highlight"><pre><span></span><span class="n">BOOL</span> <span class="n">cache_req_body</span><span class="p">(</span><span class="n">BYTES</span> <span class="n">size</span><span class="p">)</span> </pre></div> </div> <dl class="docutils"> <dt>Description</dt> <dd><p class="first">Caches the request body if it is smaller than <em>size</em>. Returns <cite>true</cite> if the body was cached, <cite>false</cite> otherwise.</p> <p class="last">Normally the request body is not available after sending it to the backend. By caching it is possible to retry pass operations, e.g. POST and PUT.</p> </dd> <dt>Example</dt> <dd><div class="first last line-block"> <div class="line">if (std.cache_req_body(1KB)) {</div> <div class="line-block"> <div class="line">...</div> </div> <div class="line">}</div> </div> </dd> </dl> </div> <div class="section" id="strstr"> <span id="func-strstr"></span><h4>strstr<a class="headerlink" href="#strstr" title="Permalink to this headline">¶</a></h4> <div class="highlight-default"><div class="highlight"><pre><span></span><span class="n">STRING</span> <span class="n">strstr</span><span class="p">(</span><span class="n">STRING</span> <span class="n">s1</span><span class="p">,</span> <span class="n">STRING</span> <span class="n">s2</span><span class="p">)</span> </pre></div> </div> <dl class="docutils"> <dt>Description</dt> <dd><p class="first">Returns a string beginning at the first occurrence of the string <em>s2</em> in the string <em>s1</em>, or an empty string if <em>s2</em> is not found.</p> <p class="last">Note that the comparison is case sensitive.</p> </dd> <dt>Example</dt> <dd><div class="first line-block"> <div class="line">if (std.strstr(req.url, req.http.restrict)) {</div> <div class="line-block"> <div class="line">...</div> </div> <div class="line">}</div> </div> <p class="last">This will check if the content of req.http.restrict occurs anywhere in req.url.</p> </dd> </dl> </div> <div class="section" id="time"> <span id="func-time"></span><h4>time<a class="headerlink" href="#time" title="Permalink to this headline">¶</a></h4> <div class="highlight-default"><div class="highlight"><pre><span></span><span class="n">TIME</span> <span class="n">time</span><span class="p">(</span><span class="n">STRING</span> <span class="n">s</span><span class="p">,</span> <span class="n">TIME</span> <span class="n">fallback</span><span class="p">)</span> </pre></div> </div> <dl class="docutils"> <dt>Description</dt> <dd><p class="first">Converts the string <em>s</em> to a time. If conversion fails, <em>fallback</em> will be returned.</p> <p>Supported formats:</p> <div class="last line-block"> <div class="line">"Sun, 06 Nov 1994 08:49:37 GMT"</div> <div class="line">"Sunday, 06-Nov-94 08:49:37 GMT"</div> <div class="line">"Sun Nov 6 08:49:37 1994"</div> <div class="line">"1994-11-06T08:49:37"</div> <div class="line">"784111777.00"</div> <div class="line">"784111777"</div> </div> </dd> <dt>Example</dt> <dd><div class="first last line-block"> <div class="line">if (std.time(resp.http.last-modified, now) < now - 1w) {</div> <div class="line-block"> <div class="line">...</div> </div> <div class="line">}</div> </div> </dd> </dl> </div> <div class="section" id="getenv"> <span id="func-getenv"></span><h4>getenv<a class="headerlink" href="#getenv" title="Permalink to this headline">¶</a></h4> <div class="highlight-default"><div class="highlight"><pre><span></span><span class="n">STRING</span> <span class="n">getenv</span><span class="p">(</span><span class="n">STRING</span> <span class="n">name</span><span class="p">)</span> </pre></div> </div> <dl class="docutils"> <dt>Description</dt> <dd><p class="first">Return environment variable <em>name</em> or the empty string.</p> <p class="last">See getenv(3)</p> </dd> <dt>Example</dt> <dd><div class="first last line-block"> <div class="line">set req.http.My-Env = std.getenv("MY_ENV");</div> </div> </dd> </dl> </div> <div class="section" id="late-100-continue"> <span id="func-late-100-continue"></span><h4>late_100_continue<a class="headerlink" href="#late-100-continue" title="Permalink to this headline">¶</a></h4> <div class="highlight-default"><div class="highlight"><pre><span></span><span class="n">VOID</span> <span class="n">late_100_continue</span><span class="p">(</span><span class="n">BOOL</span> <span class="n">late</span><span class="p">)</span> </pre></div> </div> <dl class="docutils"> <dt>Description</dt> <dd><p class="first">Controls when varnish reacts to an <cite>Expect: 100-continue</cite> client request header.</p> <p>Varnish always generates a <cite>100 Continue</cite> response if requested by the client trough the <cite>Expect: 100-continue</cite> header when waiting for request body data.</p> <p>But, by default, the <cite>100 Continue</cite> response is already generated immediately after <cite>vcl_recv</cite> returns to reduce latencies under the assumption that the request body will be read eventually.</p> <p>Calling <cite>std.late_100_continue(true)</cite> in <cite>vcl_recv</cite> will cause the <cite>100 Continue</cite> response to only be sent when needed. This may cause additional latencies for processing request bodies, but is the correct behavior by strict interpretation of RFC7231.</p> <p class="last">This function has no effect outside <cite>vcl_recv</cite> and after calling <cite>std.cache_req_body()</cite> or any other function consuming the request body.</p> </dd> <dt>Example</dt> <dd><div class="first last line-block"> <div class="line">vcl_recv {</div> <div class="line-block"> <div class="line">std.late_100_continue(true);</div> <div class="line"><br /></div> <div class="line">if (req.method == "POST") {</div> <div class="line-block"> <div class="line">std.late_100_continue(false);</div> <div class="line">return (pass);</div> </div> <div class="line">}</div> <div class="line">...</div> </div> <div class="line">}</div> </div> </dd> </dl> </div> </div> <div class="section" id="see-also"> <h3>SEE ALSO<a class="headerlink" href="#see-also" title="Permalink to this headline">¶</a></h3> <ul class="simple"> <li><a class="reference internal" href="varnishd.html#varnishd-1"><span class="std std-ref">varnishd</span></a></li> <li><a class="reference internal" href="vsl.html#vsl-7"><span class="std std-ref">VSL</span></a></li> </ul> </div> <div class="section" id="copyright"> <h3>COPYRIGHT<a class="headerlink" href="#copyright" title="Permalink to this headline">¶</a></h3> <div class="highlight-default"><div class="highlight"><pre><span></span>Copyright (c) 2010-2017 Varnish Software AS All rights reserved. Author: Poul-Henning Kamp <phk@FreeBSD.org> Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. </pre></div> </div> </div> </div> </div> </div> </div> </div> <div class="sphinxsidebar" role="navigation" aria-label="main navigation"> <div class="sphinxsidebarwrapper"> <h3><a href="../index.html">Table Of Contents</a></h3> <ul> <li><a class="reference internal" href="#">vmod_std</a><ul> <li><a class="reference internal" href="#varnish-standard-module">Varnish Standard Module</a><ul> <li><a class="reference internal" href="#synopsis">SYNOPSIS</a></li> <li><a class="reference internal" href="#contents">CONTENTS</a></li> <li><a class="reference internal" href="#description">DESCRIPTION</a><ul> <li><a class="reference internal" href="#toupper">toupper</a></li> <li><a class="reference internal" href="#tolower">tolower</a></li> <li><a class="reference internal" href="#set-ip-tos">set_ip_tos</a></li> <li><a class="reference internal" href="#random">random</a></li> <li><a class="reference internal" href="#log">log</a></li> <li><a class="reference internal" href="#syslog">syslog</a></li> <li><a class="reference internal" href="#fileread">fileread</a></li> <li><a class="reference internal" href="#file-exists">file_exists</a></li> <li><a class="reference internal" href="#collect">collect</a></li> <li><a class="reference internal" href="#duration">duration</a></li> <li><a class="reference internal" href="#integer">integer</a></li> <li><a class="reference internal" href="#ip">ip</a></li> <li><a class="reference internal" href="#real">real</a></li> <li><a class="reference internal" href="#real2integer">real2integer</a></li> <li><a class="reference internal" href="#real2time">real2time</a></li> <li><a class="reference internal" href="#time2integer">time2integer</a></li> <li><a class="reference internal" href="#time2real">time2real</a></li> <li><a class="reference internal" href="#healthy">healthy</a></li> <li><a class="reference internal" href="#port">port</a></li> <li><a class="reference internal" href="#rollback">rollback</a></li> <li><a class="reference internal" href="#timestamp">timestamp</a></li> <li><a class="reference internal" href="#querysort">querysort</a></li> <li><a class="reference internal" href="#cache-req-body">cache_req_body</a></li> <li><a class="reference internal" href="#strstr">strstr</a></li> <li><a class="reference internal" href="#time">time</a></li> <li><a class="reference internal" href="#getenv">getenv</a></li> <li><a class="reference internal" href="#late-100-continue">late_100_continue</a></li> </ul> </li> <li><a class="reference internal" href="#see-also">SEE ALSO</a></li> <li><a class="reference internal" href="#copyright">COPYRIGHT</a></li> </ul> </li> </ul> </li> </ul> <h4>Previous topic</h4> <p class="topless"><a href="vmod.html" title="previous chapter">VMOD - Varnish Modules</a></p> <h4>Next topic</h4> <p class="topless"><a href="vmod_directors.generated.html" title="next chapter">vmod_directors</a></p> <div role="note" aria-label="source link"> <h3>This Page</h3> <ul class="this-page-menu"> <li><a href="../_sources/reference/vmod_std.generated.txt" rel="nofollow">Show Source</a></li> </ul> </div> <div id="searchbox" style="display: none" role="search"> <h3>Quick search</h3> <form class="search" action="../search.html" method="get"> <div><input type="text" name="q" /></div> <div><input type="submit" value="Go" /></div> <input type="hidden" name="check_keywords" value="yes" /> <input type="hidden" name="area" value="default" /> </form> </div> <script type="text/javascript">$('#searchbox').show(0);</script> </div> </div> <div class="clearer"></div> </div> <div class="related" role="navigation" aria-label="related navigation"> <h3>Navigation</h3> <ul> <li class="right" style="margin-right: 10px"> <a href="../genindex.html" title="General Index" >index</a></li> <li class="right" > <a href="vmod_directors.generated.html" title="vmod_directors" >next</a> |</li> <li class="right" > <a href="vmod.html" title="VMOD - Varnish Modules" >previous</a> |</li> <li class="nav-item nav-item-0"><a href="../index.html">Varnish version 5.2.1 documentation</a> »</li> <li class="nav-item nav-item-1"><a href="index.html" >The Varnish Reference Manual</a> »</li> </ul> </div> <div class="footer" role="contentinfo"> © Copyright 2010-2014, Varnish Software AS. Created using <a href="http://sphinx-doc.org/">Sphinx</a> 1.4.9. </div> </body> </html>
Close