Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
varnish-cache
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Commits
Open sidebar
varnishcache
varnish-cache
Commits
3f2c0b0c
Commit
3f2c0b0c
authored
Jan 20, 2015
by
Federico G. Schwindt
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Rework some examples
parent
e8bfec12
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
5 deletions
+11
-5
vmod.vcc
lib/libvmod_std/vmod.vcc
+11
-5
No files found.
lib/libvmod_std/vmod.vcc
View file @
3f2c0b0c
...
...
@@ -58,13 +58,14 @@ Example
$Function VOID set_ip_tos(INT tos)
Description
Sets the IP type-of-service (TOS) field for the current session to *tos*.
Sets the IP type-of-service (TOS) field for the current session
to *tos*.
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.
Example
| if (req.url ~ ^/slow/) {
|
std.set_ip_tos(0x0);
|
std.set_ip_tos(0x0);
| }
$Function REAL random(REAL lo, REAL hi)
...
...
@@ -89,7 +90,7 @@ Description
is formed by ORing the facility and priority values. See your
system's syslog.h file for priorities and facility codes.
Example
std.syslog(
8 + 1
, "Something is wrong");
std.syslog(
9
, "Something is wrong");
This will send a message to syslog using LOG_USER | LOG_PID.
...
...
@@ -129,7 +130,7 @@ Description
Converts the string *s* to an integer. If conversion fails,
*fallback* will be returned.
Example
| if (std.integer(
beresp
.http.x-foo, 0) > 5) {
| if (std.integer(
req
.http.x-foo, 0) > 5) {
| ...
| }
...
...
@@ -150,7 +151,9 @@ Description
Converts the string *s* to a real. If conversion fails,
*fallback* will be returned.
Example
set req.http.x-real = std.real(req.http.x-foo, 0.0);
| if (std.real(req.http.x-foo, 0.0) > 5.5) {
| ...
| }
$Function TIME real2time(REAL r)
...
...
@@ -231,6 +234,9 @@ Example
| ...
| }
This will check if the content of req.http.x-restrict occurs
anywhere in req.url.
$Function TIME time(STRING s, TIME fallback)
Description
...
...
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