luci.http.html 17 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267
  1. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
  2. "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
  3. <html>
  4. <head>
  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"/-->
  8. </head>
  9. <body>
  10. <div id="container">
  11. <div id="product">
  12. <div id="product_logo"></div>
  13. <div id="product_name"><big><b></b></big></div>
  14. <div id="product_description"></div>
  15. </div> <!-- id="product" -->
  16. <div id="main">
  17. <div id="navigation">
  18. <h1>LuaDoc</h1>
  19. <ul>
  20. <li><a href="../index.html">Index</a></li>
  21. </ul>
  22. <!-- Module list -->
  23. <h1>Modules</h1>
  24. <ul>
  25. <li>
  26. <a href="../modules/luci.dispatcher.html">luci.dispatcher</a>
  27. </li>
  28. <li><strong>luci.http</strong></li>
  29. <li>
  30. <a href="../modules/luci.http.conditionals.html">luci.http.conditionals</a>
  31. </li>
  32. <li>
  33. <a href="../modules/luci.http.date.html">luci.http.date</a>
  34. </li>
  35. <li>
  36. <a href="../modules/luci.http.mime.html">luci.http.mime</a>
  37. </li>
  38. <li>
  39. <a href="../modules/luci.i18n.html">luci.i18n</a>
  40. </li>
  41. <li>
  42. <a href="../modules/luci.ip.html">luci.ip</a>
  43. </li>
  44. <li>
  45. <a href="../modules/luci.ip.cidr.html">luci.ip.cidr</a>
  46. </li>
  47. <li>
  48. <a href="../modules/luci.json.html">luci.json</a>
  49. </li>
  50. <li>
  51. <a href="../modules/luci.jsonc.html">luci.jsonc</a>
  52. </li>
  53. <li>
  54. <a href="../modules/luci.jsonc.parser.html">luci.jsonc.parser</a>
  55. </li>
  56. <li>
  57. <a href="../modules/luci.model.ipkg.html">luci.model.ipkg</a>
  58. </li>
  59. <li>
  60. <a href="../modules/luci.model.uci.html">luci.model.uci</a>
  61. </li>
  62. <li>
  63. <a href="../modules/luci.rpcc.html">luci.rpcc</a>
  64. </li>
  65. <li>
  66. <a href="../modules/luci.rpcc.ruci.html">luci.rpcc.ruci</a>
  67. </li>
  68. <li>
  69. <a href="../modules/luci.sys.html">luci.sys</a>
  70. </li>
  71. <li>
  72. <a href="../modules/luci.sys.init.html">luci.sys.init</a>
  73. </li>
  74. <li>
  75. <a href="../modules/luci.sys.iptparser.html">luci.sys.iptparser</a>
  76. </li>
  77. <li>
  78. <a href="../modules/luci.sys.net.html">luci.sys.net</a>
  79. </li>
  80. <li>
  81. <a href="../modules/luci.sys.process.html">luci.sys.process</a>
  82. </li>
  83. <li>
  84. <a href="../modules/luci.sys.user.html">luci.sys.user</a>
  85. </li>
  86. <li>
  87. <a href="../modules/luci.sys.wifi.html">luci.sys.wifi</a>
  88. </li>
  89. <li>
  90. <a href="../modules/luci.util.html">luci.util</a>
  91. </li>
  92. <li>
  93. <a href="../modules/nixio.html">nixio</a>
  94. </li>
  95. <li>
  96. <a href="../modules/nixio.CHANGELOG.html">nixio.CHANGELOG</a>
  97. </li>
  98. <li>
  99. <a href="../modules/nixio.CryptoHash.html">nixio.CryptoHash</a>
  100. </li>
  101. <li>
  102. <a href="../modules/nixio.File.html">nixio.File</a>
  103. </li>
  104. <li>
  105. <a href="../modules/nixio.README.html">nixio.README</a>
  106. </li>
  107. <li>
  108. <a href="../modules/nixio.Socket.html">nixio.Socket</a>
  109. </li>
  110. <li>
  111. <a href="../modules/nixio.TLSContext.html">nixio.TLSContext</a>
  112. </li>
  113. <li>
  114. <a href="../modules/nixio.TLSSocket.html">nixio.TLSSocket</a>
  115. </li>
  116. <li>
  117. <a href="../modules/nixio.UnifiedIO.html">nixio.UnifiedIO</a>
  118. </li>
  119. <li>
  120. <a href="../modules/nixio.bin.html">nixio.bin</a>
  121. </li>
  122. <li>
  123. <a href="../modules/nixio.bit.html">nixio.bit</a>
  124. </li>
  125. <li>
  126. <a href="../modules/nixio.crypto.html">nixio.crypto</a>
  127. </li>
  128. <li>
  129. <a href="../modules/nixio.fs.html">nixio.fs</a>
  130. </li>
  131. </ul>
  132. <!-- File list -->
  133. </div><!-- id="navigation" -->
  134. <div id="content">
  135. <h1>Class <code>luci.http</code></h1>
  136. <p></p>
  137. <h2>Functions</h2>
  138. <table class="function_list">
  139. <tr>
  140. <td class="name" nowrap><a href="#build_querystring">build_querystring</a>&nbsp;(table)</td>
  141. <td class="summary">
  142. Create a querystring out of a table of key - value pairs.</td>
  143. </tr>
  144. <tr>
  145. <td class="name" nowrap><a href="#close">close</a>&nbsp;()</td>
  146. <td class="summary">
  147. Close the HTTP-Connection.</td>
  148. </tr>
  149. <tr>
  150. <td class="name" nowrap><a href="#content">content</a>&nbsp;()</td>
  151. <td class="summary">
  152. Return the request content if the request was of unknown type.</td>
  153. </tr>
  154. <tr>
  155. <td class="name" nowrap><a href="#formvalue">formvalue</a>&nbsp;(name, noparse)</td>
  156. <td class="summary">
  157. Get a certain HTTP input value or a table of all input values.</td>
  158. </tr>
  159. <tr>
  160. <td class="name" nowrap><a href="#formvaluetable">formvaluetable</a>&nbsp;(prefix)</td>
  161. <td class="summary">
  162. Get a table of all HTTP input values with a certain prefix.</td>
  163. </tr>
  164. <tr>
  165. <td class="name" nowrap><a href="#getcookie">getcookie</a>&nbsp;(name)</td>
  166. <td class="summary">
  167. Get the value of a certain HTTP-Cookie.</td>
  168. </tr>
  169. <tr>
  170. <td class="name" nowrap><a href="#getenv">getenv</a>&nbsp;(name)</td>
  171. <td class="summary">
  172. Get the value of a certain HTTP environment variable
  173. or the environment table itself.</td>
  174. </tr>
  175. <tr>
  176. <td class="name" nowrap><a href="#header">header</a>&nbsp;(key, value)</td>
  177. <td class="summary">
  178. Send a HTTP-Header.</td>
  179. </tr>
  180. <tr>
  181. <td class="name" nowrap><a href="#mimedecode_message_body">mimedecode_message_body</a>&nbsp;(src, msg, filecb)</td>
  182. <td class="summary">
  183. Decode a mime encoded http message body with multipart/form-data Content-Type.</td>
  184. </tr>
  185. <tr>
  186. <td class="name" nowrap><a href="#parse_message_body">parse_message_body</a>&nbsp;(src, msg, filecb)</td>
  187. <td class="summary">
  188. Try to extract and decode a http message body from the given ltn12 source.</td>
  189. </tr>
  190. <tr>
  191. <td class="name" nowrap><a href="#prepare_content">prepare_content</a>&nbsp;(mime)</td>
  192. <td class="summary">
  193. Set the mime type of following content data.</td>
  194. </tr>
  195. <tr>
  196. <td class="name" nowrap><a href="#redirect">redirect</a>&nbsp;(url)</td>
  197. <td class="summary">
  198. Redirects the client to a new URL and closes the connection.</td>
  199. </tr>
  200. <tr>
  201. <td class="name" nowrap><a href="#setfilehandler">setfilehandler</a>&nbsp;(callback)</td>
  202. <td class="summary">
  203. Set a handler function for incoming user file uploads.</td>
  204. </tr>
  205. <tr>
  206. <td class="name" nowrap><a href="#source">source</a>&nbsp;()</td>
  207. <td class="summary">
  208. Get the RAW HTTP input source
  209. </td>
  210. </tr>
  211. <tr>
  212. <td class="name" nowrap><a href="#splice">splice</a>&nbsp;(fp, size)</td>
  213. <td class="summary">
  214. Splice data from a filedescriptor to the client.</td>
  215. </tr>
  216. <tr>
  217. <td class="name" nowrap><a href="#status">status</a>&nbsp;(code, message)</td>
  218. <td class="summary">
  219. Set the HTTP status code and status message.</td>
  220. </tr>
  221. <tr>
  222. <td class="name" nowrap><a href="#urldecode">urldecode</a>&nbsp;(str, no_plus)</td>
  223. <td class="summary">
  224. Return the URL-decoded equivalent of a string.</td>
  225. </tr>
  226. <tr>
  227. <td class="name" nowrap><a href="#urldecode_message_body">urldecode_message_body</a>&nbsp;(src, msg)</td>
  228. <td class="summary">
  229. Decode an urlencoded http message body with application/x-www-urlencoded
  230. Content-Type.</td>
  231. </tr>
  232. <tr>
  233. <td class="name" nowrap><a href="#urldecode_params">urldecode_params</a>&nbsp;(url, tbl)</td>
  234. <td class="summary">
  235. Extract and split urlencoded data pairs, separated bei either "&" or ";"
  236. from given url or string.</td>
  237. </tr>
  238. <tr>
  239. <td class="name" nowrap><a href="#urlencode">urlencode</a>&nbsp;(str)</td>
  240. <td class="summary">
  241. Return the URL-encoded equivalent of a string.</td>
  242. </tr>
  243. <tr>
  244. <td class="name" nowrap><a href="#urlencode_params">urlencode_params</a>&nbsp;(tbl)</td>
  245. <td class="summary">
  246. Encode each key-value-pair in given table to x-www-urlencoded format,
  247. separated by "&".</td>
  248. </tr>
  249. <tr>
  250. <td class="name" nowrap><a href="#write">write</a>&nbsp;(content, src_err)</td>
  251. <td class="summary">
  252. Send a chunk of content data to the client.</td>
  253. </tr>
  254. <tr>
  255. <td class="name" nowrap><a href="#write_json">write_json</a>&nbsp;(data)</td>
  256. <td class="summary">
  257. Send the given data as JSON encoded string.</td>
  258. </tr>
  259. </table>
  260. <br/>
  261. <br/>
  262. <h2><a name="functions"></a>Functions</h2>
  263. <dl class="function">
  264. <dt><a name="build_querystring"></a><strong>build_querystring</strong>&nbsp;(table)</dt>
  265. <dd>
  266. Create a querystring out of a table of key - value pairs.
  267. <h3>Parameters</h3>
  268. <ul>
  269. <li>
  270. table: Query string source table
  271. </li>
  272. </ul>
  273. <h3>Return value:</h3>
  274. Encoded HTTP query string
  275. </dd>
  276. <dt><a name="close"></a><strong>close</strong>&nbsp;()</dt>
  277. <dd>
  278. Close the HTTP-Connection.
  279. </dd>
  280. <dt><a name="content"></a><strong>content</strong>&nbsp;()</dt>
  281. <dd>
  282. Return the request content if the request was of unknown type.
  283. <h3>Return values:</h3>
  284. <ol>
  285. <li>HTTP request body
  286. <li>HTTP request body length
  287. </ol>
  288. </dd>
  289. <dt><a name="formvalue"></a><strong>formvalue</strong>&nbsp;(name, noparse)</dt>
  290. <dd>
  291. Get a certain HTTP input value or a table of all input values.
  292. <h3>Parameters</h3>
  293. <ul>
  294. <li>
  295. name: Name of the GET or POST variable to fetch
  296. </li>
  297. <li>
  298. noparse: Don't parse POST data before getting the value
  299. </li>
  300. </ul>
  301. <h3>Return value:</h3>
  302. HTTP input value or table of all input value
  303. </dd>
  304. <dt><a name="formvaluetable"></a><strong>formvaluetable</strong>&nbsp;(prefix)</dt>
  305. <dd>
  306. Get a table of all HTTP input values with a certain prefix.
  307. <h3>Parameters</h3>
  308. <ul>
  309. <li>
  310. prefix: Prefix
  311. </li>
  312. </ul>
  313. <h3>Return value:</h3>
  314. Table of all HTTP input values with given prefix
  315. </dd>
  316. <dt><a name="getcookie"></a><strong>getcookie</strong>&nbsp;(name)</dt>
  317. <dd>
  318. Get the value of a certain HTTP-Cookie.
  319. <h3>Parameters</h3>
  320. <ul>
  321. <li>
  322. name: Cookie Name
  323. </li>
  324. </ul>
  325. <h3>Return value:</h3>
  326. String containing cookie data
  327. </dd>
  328. <dt><a name="getenv"></a><strong>getenv</strong>&nbsp;(name)</dt>
  329. <dd>
  330. Get the value of a certain HTTP environment variable
  331. or the environment table itself.
  332. <h3>Parameters</h3>
  333. <ul>
  334. <li>
  335. name: Environment variable
  336. </li>
  337. </ul>
  338. <h3>Return value:</h3>
  339. HTTP environment value or environment table
  340. </dd>
  341. <dt><a name="header"></a><strong>header</strong>&nbsp;(key, value)</dt>
  342. <dd>
  343. Send a HTTP-Header.
  344. <h3>Parameters</h3>
  345. <ul>
  346. <li>
  347. key: Header key
  348. </li>
  349. <li>
  350. value: Header value
  351. </li>
  352. </ul>
  353. </dd>
  354. <dt><a name="mimedecode_message_body"></a><strong>mimedecode_message_body</strong>&nbsp;(src, msg, filecb)</dt>
  355. <dd>
  356. Decode a mime encoded http message body with multipart/form-data Content-Type.
  357. Stores all extracted data associated with its parameter name
  358. in the params table within the given message object. Multiple parameter
  359. values are stored as tables, ordinary ones as strings.
  360. If an optional file callback function is given then it is fed with the
  361. file contents chunk by chunk and only the extracted file name is stored
  362. within the params table. The callback function will be called subsequently
  363. with three arguments:
  364. o Table containing decoded (name, file) and raw (headers) mime header data
  365. o String value containing a chunk of the file data
  366. o Boolean which indicates whether the current chunk is the last one (eof)
  367. <h3>Parameters</h3>
  368. <ul>
  369. <li>
  370. src: Ltn12 source function
  371. </li>
  372. <li>
  373. msg: HTTP message object
  374. </li>
  375. <li>
  376. filecb: File callback function (optional)
  377. </li>
  378. </ul>
  379. <h3>Return values:</h3>
  380. <ol>
  381. <li>Value indicating successful operation (not nil means "ok")
  382. <li>String containing the error if unsuccessful
  383. </ol>
  384. <h3>See also:</h3>
  385. <ul>
  386. <li><a href="">
  387. parse_message_header
  388. </a>
  389. </ul>
  390. </dd>
  391. <dt><a name="parse_message_body"></a><strong>parse_message_body</strong>&nbsp;(src, msg, filecb)</dt>
  392. <dd>
  393. Try to extract and decode a http message body from the given ltn12 source.
  394. This function will examine the Content-Type within the given message object
  395. to select the appropriate content decoder.
  396. Currently the application/x-www-urlencoded and application/form-data
  397. mime types are supported. If the encountered content encoding can't be
  398. handled then the whole message body will be stored unaltered as "content"
  399. property within the given message object.
  400. <h3>Parameters</h3>
  401. <ul>
  402. <li>
  403. src: Ltn12 source function
  404. </li>
  405. <li>
  406. msg: HTTP message object
  407. </li>
  408. <li>
  409. filecb: File data callback (optional, see mimedecode_message_body())
  410. </li>
  411. </ul>
  412. <h3>Return values:</h3>
  413. <ol>
  414. <li>Value indicating successful operation (not nil means "ok")
  415. <li>String containing the error if unsuccessful
  416. </ol>
  417. <h3>See also:</h3>
  418. <ul>
  419. <li><a href="">
  420. parse_message_header
  421. </a>
  422. </ul>
  423. </dd>
  424. <dt><a name="prepare_content"></a><strong>prepare_content</strong>&nbsp;(mime)</dt>
  425. <dd>
  426. Set the mime type of following content data.
  427. <h3>Parameters</h3>
  428. <ul>
  429. <li>
  430. mime: Mimetype of following content
  431. </li>
  432. </ul>
  433. </dd>
  434. <dt><a name="redirect"></a><strong>redirect</strong>&nbsp;(url)</dt>
  435. <dd>
  436. Redirects the client to a new URL and closes the connection.
  437. <h3>Parameters</h3>
  438. <ul>
  439. <li>
  440. url: Target URL
  441. </li>
  442. </ul>
  443. </dd>
  444. <dt><a name="setfilehandler"></a><strong>setfilehandler</strong>&nbsp;(callback)</dt>
  445. <dd>
  446. Set a handler function for incoming user file uploads.
  447. <h3>Parameters</h3>
  448. <ul>
  449. <li>
  450. callback: Handler function
  451. </li>
  452. </ul>
  453. </dd>
  454. <dt><a name="source"></a><strong>source</strong>&nbsp;()</dt>
  455. <dd>
  456. Get the RAW HTTP input source
  457. <h3>Return value:</h3>
  458. HTTP LTN12 source
  459. </dd>
  460. <dt><a name="splice"></a><strong>splice</strong>&nbsp;(fp, size)</dt>
  461. <dd>
  462. Splice data from a filedescriptor to the client.
  463. <h3>Parameters</h3>
  464. <ul>
  465. <li>
  466. fp: File descriptor
  467. </li>
  468. <li>
  469. size: Bytes to splice (optional)
  470. </li>
  471. </ul>
  472. </dd>
  473. <dt><a name="status"></a><strong>status</strong>&nbsp;(code, message)</dt>
  474. <dd>
  475. Set the HTTP status code and status message.
  476. <h3>Parameters</h3>
  477. <ul>
  478. <li>
  479. code: Status code
  480. </li>
  481. <li>
  482. message: Status message
  483. </li>
  484. </ul>
  485. </dd>
  486. <dt><a name="urldecode"></a><strong>urldecode</strong>&nbsp;(str, no_plus)</dt>
  487. <dd>
  488. Return the URL-decoded equivalent of a string.
  489. <h3>Parameters</h3>
  490. <ul>
  491. <li>
  492. str: URL-encoded string
  493. </li>
  494. <li>
  495. no_plus: Don't decode + to " "
  496. </li>
  497. </ul>
  498. <h3>Return value:</h3>
  499. URL-decoded string
  500. <h3>See also:</h3>
  501. <ul>
  502. <li><a href="#urlencode">
  503. urlencode
  504. </a>
  505. </ul>
  506. </dd>
  507. <dt><a name="urldecode_message_body"></a><strong>urldecode_message_body</strong>&nbsp;(src, msg)</dt>
  508. <dd>
  509. Decode an urlencoded http message body with application/x-www-urlencoded
  510. Content-Type.
  511. Stores all extracted data associated with its parameter name in the params
  512. table within the given message object. Multiple parameter values are stored
  513. as tables, ordinary ones as strings.
  514. <h3>Parameters</h3>
  515. <ul>
  516. <li>
  517. src: Ltn12 source function
  518. </li>
  519. <li>
  520. msg: HTTP message object
  521. </li>
  522. </ul>
  523. <h3>Return values:</h3>
  524. <ol>
  525. <li>Value indicating successful operation (not nil means "ok")
  526. <li>String containing the error if unsuccessful
  527. </ol>
  528. <h3>See also:</h3>
  529. <ul>
  530. <li><a href="">
  531. parse_message_header
  532. </a>
  533. </ul>
  534. </dd>
  535. <dt><a name="urldecode_params"></a><strong>urldecode_params</strong>&nbsp;(url, tbl)</dt>
  536. <dd>
  537. Extract and split urlencoded data pairs, separated bei either "&" or ";"
  538. from given url or string. Returns a table with urldecoded values.
  539. Simple parameters are stored as string values associated with the parameter
  540. name within the table. Parameters with multiple values are stored as array
  541. containing the corresponding values.
  542. <h3>Parameters</h3>
  543. <ul>
  544. <li>
  545. url: The url or string which contains x-www-urlencoded form data
  546. </li>
  547. <li>
  548. tbl: Use the given table for storing values (optional)
  549. </li>
  550. </ul>
  551. <h3>Return value:</h3>
  552. Table containing the urldecoded parameters
  553. <h3>See also:</h3>
  554. <ul>
  555. <li><a href="#urlencode_params">
  556. urlencode_params
  557. </a>
  558. </ul>
  559. </dd>
  560. <dt><a name="urlencode"></a><strong>urlencode</strong>&nbsp;(str)</dt>
  561. <dd>
  562. Return the URL-encoded equivalent of a string.
  563. <h3>Parameters</h3>
  564. <ul>
  565. <li>
  566. str: Source string
  567. </li>
  568. </ul>
  569. <h3>Return value:</h3>
  570. URL-encoded string
  571. <h3>See also:</h3>
  572. <ul>
  573. <li><a href="#urldecode">
  574. urldecode
  575. </a>
  576. </ul>
  577. </dd>
  578. <dt><a name="urlencode_params"></a><strong>urlencode_params</strong>&nbsp;(tbl)</dt>
  579. <dd>
  580. Encode each key-value-pair in given table to x-www-urlencoded format,
  581. separated by "&".
  582. Tables are encoded as parameters with multiple values by repeating the
  583. parameter name with each value.
  584. <h3>Parameters</h3>
  585. <ul>
  586. <li>
  587. tbl: Table with the values
  588. </li>
  589. </ul>
  590. <h3>Return value:</h3>
  591. String containing encoded values
  592. <h3>See also:</h3>
  593. <ul>
  594. <li><a href="#urldecode_params">
  595. urldecode_params
  596. </a>
  597. </ul>
  598. </dd>
  599. <dt><a name="write"></a><strong>write</strong>&nbsp;(content, src_err)</dt>
  600. <dd>
  601. Send a chunk of content data to the client.
  602. This function is as a valid LTN12 sink.
  603. If the content chunk is nil this function will automatically invoke close.
  604. <h3>Parameters</h3>
  605. <ul>
  606. <li>
  607. content: Content chunk
  608. </li>
  609. <li>
  610. src_err: Error object from source (optional)
  611. </li>
  612. </ul>
  613. <h3>See also:</h3>
  614. <ul>
  615. <li><a href="#close">
  616. close
  617. </a>
  618. </ul>
  619. </dd>
  620. <dt><a name="write_json"></a><strong>write_json</strong>&nbsp;(data)</dt>
  621. <dd>
  622. Send the given data as JSON encoded string.
  623. <h3>Parameters</h3>
  624. <ul>
  625. <li>
  626. data: Data to send
  627. </li>
  628. </ul>
  629. </dd>
  630. </dl>
  631. </div> <!-- id="content" -->
  632. </div> <!-- id="main" -->
  633. <div id="about">
  634. <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>
  635. </div> <!-- id="about" -->
  636. </div> <!-- id="container" -->
  637. </body>
  638. </html>