dragonfly-newlisp / example-site / dragonfly-api / request.lsp.html

<!DOCTYPE HTML PUBLIC "HTML 4.01 Transitional">
<META http-equiv="Content-Type" content="text/html; charset=utf-8">

<link rel="stylesheet" type="text/css" href="newlispdoc.css" />

<body style="margin: 20px;" text="#111111" bgcolor="#FFFFFF" 
			link="#376590" vlink="#551A8B" alink="#ffAA28">
<p><a href="index.html">Module index</a></p>
<br/><h2>Module:&nbsp;request.lsp</h2><b>Author: </b>Greg Slepak <greg at><br/>
 These are very similar to the PHP $_GET and $_POST associative arrays.
 Use them to retrieve the GET/POST values.
 If a variable was specified, but no value assigned (i.e. <tt>/?foo</tt>), then
 the value will be an empty string (you can use <tt>empty?</tt> to check for this).
 If the variable does not exist, <tt>nil</tt> will be returned.
 <br><br>The values are url decoded:
 <pre> "What+time+is+it%3f"  => "What time is it?"</pre>
 If a <tt>multipart/form-data</tt> content type was submitted, then
 STDIN is read for the values. Any files are placed in <tt>$FILES</tt>, while
 other key/value pairs are placed in <tt>$POST</tt>.
 <br><br>The values in <tt>$FILES</tt> contain an associative array with more information
 about the files.
 If the environment variable <tt>HTTP_CONTENT_TRANSFER_ENCODING</tt> is set to
 "binary" then STDIN is read (up to <tt>MAX_POST_LENGTH</tt>) and the data is
 stored in <tt>$BINARY</tt>. Note that unlike the other symbols in this file,
 <tt>$BINARY</tt> is a string, not a function.
 The environment variable <tt>HTTP_COOKIE</tt> is parsed and the cookies are placed in
 in <tt>$COOKIES</tt> as key/value pairs just like <tt>$GET</tt> and <tt>$POST</tt>.
<br/><br/><center>- &sect; -</center><br/>
<a name="_$GET"></a><h3><font color=#CC0000>$GET</font></h3>
<b>syntax: (<font color=#CC0000>$GET</font> <em>str-key</em>)</b><br/>
<p><b>return: </b>the value of the GET parameter for <em>str-key</em>, nil if no such GET variable was passed in.</p>
<br/><br/><center>- &sect; -</center><br/>
<a name="_$POST"></a><h3><font color=#CC0000>$POST</font></h3>
<b>syntax: (<font color=#CC0000>$POST</font> <em>str-key</em>)</b><br/>
<p><b>return: </b>the value of the POST parameter for <em>str-key</em>, nil if no such POST variable was passed in.</p>
<br/><br/><center>- &sect; -</center><br/>
<a name="_$FILES"></a><h3><font color=#CC0000>$FILES</font></h3>
<b>syntax: (<font color=#CC0000>$FILES</font> <em>str-key</em>)</b><br/>
 <p>Returns an association list with keys <tt>'name</tt>, <tt>'data</tt>, and <tt>'length</tt> for the result
 of a <tt>multipart/form-data</tt> posted form.</p>
<br/><br/><center>- &sect; -</center><br/>
<a name="_$COOKIES"></a><h3><font color=#CC0000>$COOKIES</font></h3>
<b>syntax: (<font color=#CC0000>$COOKIES</font> <em>str-key</em>)</b><br/>
<p><b>return: </b>the value of the cookie with the key <em>str-key</em>, or nil if no such cookie exists.</p>
<br/><br/><center>- &sect; -</center><br/>
<a name="_$BINARY"></a><h3><font color=#CC0000>$BINARY</font></h3>
<b>syntax: $BINARY</b><br/>
 <p>This is a global buffer that contains what was sent to STDIN (up to <tt>MAX_POST_LENGTH</tt>)
 when the value of environment variable <tt>HTTP_CONTENT_TRANSFER_ENCODING</tt> is set to "binary".</p>

<br/><br/><center>- &sect; -</center><br/>
<a name="_MAX_POST_LENGTH"></a><h3><font color=#CC0000>MAX_POST_LENGTH</font></h3>
<b>syntax: MAX_POST_LENGTH</b><br/>
 <p>A constant global integer whose value by default is <tt>1048576</tt>. This represents
 the maximum amount of binary data (in bytes) that can be sent in the body of the
 request (which gets stored in <tt>$BINARY</tt>).</p>
 <p>Minimum value is <tt>8192</tt>. Set this value prior to the loading of this file
 (for example in <tt>config.lsp</tt>) to customize it.</p>

<br/><br/><center>- &sect; -</center><br/>
<a name="_utf8-urlencode"></a><h3><font color=#CC0000>utf8-urlencode</font></h3>
<b>syntax: (<font color=#CC0000>utf8-urlencode</font> <em>str</em> [<em>bool-everything</em>])</b><br/>
<b>parameter: </b>str - the string to encode<br/>
<b>parameter: </b>bool-everything - whether to escape the entire string or just most of the "non-ascii friendly" parts.<br/>
 <p>Use this function to safely encode data that might have foreign characters in it, or simply
 characters that should be placed into URLs:</p>
 <pre> (utf8-urlencode "What time is it?")  => "What%20time%20is%20it%3F"</pre>

<br/><br/><center>- &sect; -</center><br/>
<a name="_utf8-urldecode"></a><h3><font color=#CC0000>utf8-urldecode</font></h3>
<b>syntax: (<font color=#CC0000>utf8-urldecode</font> <em>str</em>)</b><br/>
 <p>Decodes a utf8-urlencoded string. Converts '+'&apos;s to spaces.</p>

<br/><br/><center>- &part; -</center><br/>
<center><font face='Arial' size='-2' color='#444444'>
generated with <a href="">newLISP</a>&nbsp;
and <a href="">newLISPdoc</a>