1 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
2 "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
5 <title>Reference</title>
6 <link rel="stylesheet" href="../luadoc.css" type="text/css" />
7 <!--meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/-->
14 <div id="product_logo"></div>
15 <div id="product_name"><big><b></b></big></div>
16 <div id="product_description"></div>
17 </div> <!-- id="product" -->
27 <li><a href="../index.html">Index</a></li>
38 <a href="../modules/luci.dispatcher.html">luci.dispatcher</a>
41 <li><strong>luci.http</strong></li>
44 <a href="../modules/luci.http.protocol.html">luci.http.protocol</a>
48 <a href="../modules/luci.http.protocol.conditionals.html">luci.http.protocol.conditionals</a>
52 <a href="../modules/luci.http.protocol.date.html">luci.http.protocol.date</a>
56 <a href="../modules/luci.http.protocol.mime.html">luci.http.protocol.mime</a>
60 <a href="../modules/luci.i18n.html">luci.i18n</a>
64 <a href="../modules/luci.ip.html">luci.ip</a>
68 <a href="../modules/luci.ip.cidr.html">luci.ip.cidr</a>
72 <a href="../modules/luci.json.html">luci.json</a>
76 <a href="../modules/luci.jsonc.html">luci.jsonc</a>
80 <a href="../modules/luci.jsonc.parser.html">luci.jsonc.parser</a>
84 <a href="../modules/luci.model.ipkg.html">luci.model.ipkg</a>
88 <a href="../modules/luci.model.uci.html">luci.model.uci</a>
92 <a href="../modules/luci.rpcc.html">luci.rpcc</a>
96 <a href="../modules/luci.rpcc.ruci.html">luci.rpcc.ruci</a>
100 <a href="../modules/luci.sys.html">luci.sys</a>
104 <a href="../modules/luci.sys.init.html">luci.sys.init</a>
108 <a href="../modules/luci.sys.iptparser.html">luci.sys.iptparser</a>
112 <a href="../modules/luci.sys.net.html">luci.sys.net</a>
116 <a href="../modules/luci.sys.process.html">luci.sys.process</a>
120 <a href="../modules/luci.sys.user.html">luci.sys.user</a>
124 <a href="../modules/luci.sys.wifi.html">luci.sys.wifi</a>
128 <a href="../modules/luci.util.html">luci.util</a>
132 <a href="../modules/nixio.html">nixio</a>
136 <a href="../modules/nixio.CHANGELOG.html">nixio.CHANGELOG</a>
140 <a href="../modules/nixio.CryptoHash.html">nixio.CryptoHash</a>
144 <a href="../modules/nixio.File.html">nixio.File</a>
148 <a href="../modules/nixio.README.html">nixio.README</a>
152 <a href="../modules/nixio.Socket.html">nixio.Socket</a>
156 <a href="../modules/nixio.TLSContext.html">nixio.TLSContext</a>
160 <a href="../modules/nixio.TLSSocket.html">nixio.TLSSocket</a>
164 <a href="../modules/nixio.UnifiedIO.html">nixio.UnifiedIO</a>
168 <a href="../modules/nixio.bin.html">nixio.bin</a>
172 <a href="../modules/nixio.bit.html">nixio.bit</a>
176 <a href="../modules/nixio.crypto.html">nixio.crypto</a>
180 <a href="../modules/nixio.fs.html">nixio.fs</a>
195 </div><!-- id="navigation" -->
199 <h1>Class <code>luci.http</code></h1>
210 <table class="function_list">
213 <td class="name" nowrap><a href="#build_querystring">build_querystring</a> (table)</td>
216 Create a querystring out of a table of key - value pairs.</td>
220 <td class="name" nowrap><a href="#close">close</a> ()</td>
223 Close the HTTP-Connection.</td>
227 <td class="name" nowrap><a href="#content">content</a> ()</td>
230 Return the request content if the request was of unknown type.</td>
234 <td class="name" nowrap><a href="#formvalue">formvalue</a> (name, noparse)</td>
237 Get a certain HTTP input value or a table of all input values.</td>
241 <td class="name" nowrap><a href="#formvaluetable">formvaluetable</a> (prefix)</td>
244 Get a table of all HTTP input values with a certain prefix.</td>
248 <td class="name" nowrap><a href="#getcookie">getcookie</a> (name)</td>
251 Get the value of a certain HTTP-Cookie.</td>
255 <td class="name" nowrap><a href="#getenv">getenv</a> (name)</td>
258 Get the value of a certain HTTP environment variable
260 or the environment table itself.</td>
264 <td class="name" nowrap><a href="#header">header</a> (key, value)</td>
267 Send a HTTP-Header.</td>
271 <td class="name" nowrap><a href="#prepare_content">prepare_content</a> (mime)</td>
274 Set the mime type of following content data.</td>
278 <td class="name" nowrap><a href="#redirect">redirect</a> (url)</td>
281 Redirects the client to a new URL and closes the connection.</td>
285 <td class="name" nowrap><a href="#setfilehandler">setfilehandler</a> (callback)</td>
288 Set a handler function for incoming user file uploads.</td>
292 <td class="name" nowrap><a href="#source">source</a> ()</td>
295 Get the RAW HTTP input source
300 <td class="name" nowrap><a href="#splice">splice</a> (fp, size)</td>
303 Splice data from a filedescriptor to the client.</td>
307 <td class="name" nowrap><a href="#status">status</a> (code, message)</td>
310 Set the HTTP status code and status message.</td>
314 <td class="name" nowrap><a href="#write">write</a> (content, src_err)</td>
317 Send a chunk of content data to the client.</td>
321 <td class="name" nowrap><a href="#write_json">write_json</a> (data)</td>
324 Send the given data as JSON encoded string.</td>
338 <h2><a name="functions"></a>Functions</h2>
339 <dl class="function">
343 <dt><a name="build_querystring"></a><strong>build_querystring</strong> (table)</dt>
347 Create a querystring out of a table of key - value pairs.
355 table: Query string source table
365 <h3>Return value:</h3>
366 Encoded HTTP query string
375 <dt><a name="close"></a><strong>close</strong> ()</dt>
379 Close the HTTP-Connection.
396 <dt><a name="content"></a><strong>content</strong> ()</dt>
400 Return the request content if the request was of unknown type.
409 <h3>Return values:</h3>
412 <li>HTTP request body
414 <li>HTTP request body length
425 <dt><a name="formvalue"></a><strong>formvalue</strong> (name, noparse)</dt>
429 Get a certain HTTP input value or a table of all input values.
437 name: Name of the GET or POST variable to fetch
441 noparse: Don't parse POST data before getting the value
451 <h3>Return value:</h3>
452 HTTP input value or table of all input value
461 <dt><a name="formvaluetable"></a><strong>formvaluetable</strong> (prefix)</dt>
465 Get a table of all HTTP input values with a certain prefix.
483 <h3>Return value:</h3>
484 Table of all HTTP input values with given prefix
493 <dt><a name="getcookie"></a><strong>getcookie</strong> (name)</dt>
497 Get the value of a certain HTTP-Cookie.
515 <h3>Return value:</h3>
516 String containing cookie data
525 <dt><a name="getenv"></a><strong>getenv</strong> (name)</dt>
529 Get the value of a certain HTTP environment variable
531 or the environment table itself.
538 name: Environment variable
548 <h3>Return value:</h3>
549 HTTP environment value or environment table
558 <dt><a name="header"></a><strong>header</strong> (key, value)</dt>
591 <dt><a name="prepare_content"></a><strong>prepare_content</strong> (mime)</dt>
595 Set the mime type of following content data.
603 mime: Mimetype of following content
620 <dt><a name="redirect"></a><strong>redirect</strong> (url)</dt>
624 Redirects the client to a new URL and closes the connection.
649 <dt><a name="setfilehandler"></a><strong>setfilehandler</strong> (callback)</dt>
653 Set a handler function for incoming user file uploads.
661 callback: Handler function
678 <dt><a name="source"></a><strong>source</strong> ()</dt>
682 Get the RAW HTTP input source
691 <h3>Return value:</h3>
701 <dt><a name="splice"></a><strong>splice</strong> (fp, size)</dt>
705 Splice data from a filedescriptor to the client.
717 size: Bytes to splice (optional)
734 <dt><a name="status"></a><strong>status</strong> (code, message)</dt>
738 Set the HTTP status code and status message.
750 message: Status message
767 <dt><a name="write"></a><strong>write</strong> (content, src_err)</dt>
771 Send a chunk of content data to the client.
773 This function is as a valid LTN12 sink.
774 If the content chunk is nil this function will automatically invoke close.
781 content: Content chunk
785 src_err: Error object from source (optional)
800 <li><a href="#close">
811 <dt><a name="write_json"></a><strong>write_json</strong> (data)</dt>
815 Send the given data as JSON encoded string.
844 </div> <!-- id="content" -->
846 </div> <!-- id="main" -->
849 <p><a href="http://validator.w3.org/check?uri=referer"><img src="http://www.w3.org/Icons/valid-xhtml10" alt="Valid XHTML 1.0!" height="31" width="88" /></a></p>
850 </div> <!-- id="about" -->
852 </div> <!-- id="container" -->