Commit 654a81d5 authored by Andreas Plesner Jacobsen's avatar Andreas Plesner Jacobsen Committed by Tollef Fog Heen

Documentation fixes from Federico G. Schwindt <fgsch@lodoss.net>

- mention vmod_std(7)
- HEADER is released and used by vmod_std(7) so put it in its own line.
  The explanation is still needed though.
- for consistency replace leading tabs with spaces
- *fallback* are not strings so avoid mentioning the type
- use ascii characters in vmod_std(7)

And a few style changes from me to vmod_std.rst
parent 63874031
...@@ -22,7 +22,7 @@ For instance:: ...@@ -22,7 +22,7 @@ For instance::
The "std" vmod is one you get with Varnish, it will always be there The "std" vmod is one you get with Varnish, it will always be there
and we will put "boutique" functions in it, such as the "toupper" and we will put "boutique" functions in it, such as the "toupper"
function shown above. The full contents of the "std" module is function shown above. The full contents of the "std" module is
documented in XXX:TBW. documented in vmod_std(7).
This part of the manual is about how you go about writing your own This part of the manual is about how you go about writing your own
VMOD, how the language interface between C and VCC works etc. This VMOD, how the language interface between C and VCC works etc. This
...@@ -185,7 +185,12 @@ VOID ...@@ -185,7 +185,12 @@ VOID
Can only be used for return-value, which makes the function a VCL Can only be used for return-value, which makes the function a VCL
procedure. procedure.
IP, BOOL, HEADER HEADER
C-type: ``enum gethdr_e, const char *``
XXX: explain me
IP, BOOL
XXX: these types are not released for use in vmods yet. XXX: these types are not released for use in vmods yet.
......
...@@ -31,31 +31,31 @@ toupper ...@@ -31,31 +31,31 @@ toupper
------- -------
Prototype Prototype
toupper(STRING S) toupper(STRING s)
Return value Return value
String String
Description Description
Converts the STRING S to upper case. Converts the string *s* to upper case.
Example Example
set beresp.http.x-scream = std.toupper("yes!"); set beresp.http.x-scream = std.toupper("yes!");
tolower tolower
------- -------
Prototype Prototype
tolower(STRING S) tolower(STRING s)
Return value Return value
String String
Description Description
Converts the STRING to lower case. Converts the string *s* to lower case.
Example Example
set beresp.http.x-nice = std.tolower("VerY"); set beresp.http.x-nice = std.tolower("VerY");
set_up_tos set_up_tos
---------- ----------
Prototype Prototype
set_ip_tos(INT I) set_ip_tos(INT i)
Return value Return value
Void Void
Description Description
Sets the Type-of-Service flag for the current session. Please Sets the Type-of-Service flag for the current session. Please
note that the TOS flag is not removed by the end of the note that the TOS flag is not removed by the end of the
...@@ -71,7 +71,7 @@ random ...@@ -71,7 +71,7 @@ random
Prototype Prototype
random(REAL a, REAL b) random(REAL a, REAL b)
Return value Return value
Real Real
Description Description
Returns a random REAL number between *a* and *b*. Returns a random REAL number between *a* and *b*.
Example Example
...@@ -82,9 +82,9 @@ log ...@@ -82,9 +82,9 @@ log
Prototype Prototype
log(STRING string) log(STRING string)
Return value Return value
Void Void
Description Description
Logs string to the shared memory log. Logs *string* to the shared memory log.
Example Example
std.log("Something fishy is going on with the vhost " + req.host); std.log("Something fishy is going on with the vhost " + req.host);
...@@ -93,7 +93,7 @@ syslog ...@@ -93,7 +93,7 @@ syslog
Prototype Prototype
syslog(INT priority, STRING string) syslog(INT priority, STRING string)
Return value Return value
Void Void
Description Description
Logs *string* to syslog marked with *priority*. Logs *string* to syslog marked with *priority*.
Example Example
...@@ -104,7 +104,7 @@ fileread ...@@ -104,7 +104,7 @@ fileread
Prototype Prototype
fileread(STRING filename) fileread(STRING filename)
Return value Return value
String String
Description Description
Reads a file and returns a string with the content. Please Reads a file and returns a string with the content. Please
note that it is not recommended to send variables to this note that it is not recommended to send variables to this
...@@ -118,12 +118,11 @@ duration ...@@ -118,12 +118,11 @@ duration
Prototype Prototype
duration(STRING s, DURATION fallback) duration(STRING s, DURATION fallback)
Return value Return value
Duration Duration
Description Description
Converts the string s to seconds. s can be quantified with the Converts the string *s* to seconds. *s* can be quantified with
usual s (seconds), m (minutes), h (hours), d (days) and w the usual s (seconds), m (minutes), h (hours), d (days) and w
(weeks) units. If it fails to parse the string *fallback* (weeks) units. If *s* fails to parse, *fallback* will be used.
will be used
Example Example
set beresp.ttl = std.duration("1w", 3600); set beresp.ttl = std.duration("1w", 3600);
...@@ -132,19 +131,19 @@ integer ...@@ -132,19 +131,19 @@ integer
Prototype Prototype
integer(STRING s, INT fallback) integer(STRING s, INT fallback)
Return value Return value
Int Int
Description Description
Converts the string s to an integer. If it fails to parse the Converts the string *s* to an integer. If *s* fails to parse,
string *fallback* will be used *fallback* will be used
Example Example
if (std.integer(beresp.http.x-foo, 0) > 5) { } if (std.integer(beresp.http.x-foo, 0) > 5) { ... }
collect collect
------- -------
Prototype Prototype
collect(HEADER header) collect(HEADER header)
Return value Return value
Void Void
Description Description
Collapses the header, joining the headers into one. Collapses the header, joining the headers into one.
Example Example
......
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