documentation: regenerate documents from current code base
[project/luci.git] / documentation / api / modules / luci.http.html
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
10 <body>
11 <div id="container">
12
13 <div id="product">
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" -->
18
19 <div id="main">
20
21 <div id="navigation">
22
23
24 <h1>LuaDoc</h1>
25 <ul>
26         
27         <li><a href="../index.html">Index</a></li>
28         
29 </ul>
30
31
32 <!-- Module list -->
33
34 <h1>Modules</h1>
35 <ul>
36
37         <li>
38                 <a href="../modules/luci.dispatcher.html">luci.dispatcher</a>
39         </li>
40
41         <li><strong>luci.http</strong></li>
42         
43         <li>
44                 <a href="../modules/luci.http.conditionals.html">luci.http.conditionals</a>
45         </li>
46
47         <li>
48                 <a href="../modules/luci.http.date.html">luci.http.date</a>
49         </li>
50
51         <li>
52                 <a href="../modules/luci.http.mime.html">luci.http.mime</a>
53         </li>
54
55         <li>
56                 <a href="../modules/luci.i18n.html">luci.i18n</a>
57         </li>
58
59         <li>
60                 <a href="../modules/luci.ip.html">luci.ip</a>
61         </li>
62
63         <li>
64                 <a href="../modules/luci.ip.cidr.html">luci.ip.cidr</a>
65         </li>
66
67         <li>
68                 <a href="../modules/luci.json.html">luci.json</a>
69         </li>
70
71         <li>
72                 <a href="../modules/luci.jsonc.html">luci.jsonc</a>
73         </li>
74
75         <li>
76                 <a href="../modules/luci.jsonc.parser.html">luci.jsonc.parser</a>
77         </li>
78
79         <li>
80                 <a href="../modules/luci.model.ipkg.html">luci.model.ipkg</a>
81         </li>
82
83         <li>
84                 <a href="../modules/luci.model.uci.html">luci.model.uci</a>
85         </li>
86
87         <li>
88                 <a href="../modules/luci.rpcc.html">luci.rpcc</a>
89         </li>
90
91         <li>
92                 <a href="../modules/luci.rpcc.ruci.html">luci.rpcc.ruci</a>
93         </li>
94
95         <li>
96                 <a href="../modules/luci.sys.html">luci.sys</a>
97         </li>
98
99         <li>
100                 <a href="../modules/luci.sys.init.html">luci.sys.init</a>
101         </li>
102
103         <li>
104                 <a href="../modules/luci.sys.iptparser.html">luci.sys.iptparser</a>
105         </li>
106
107         <li>
108                 <a href="../modules/luci.sys.net.html">luci.sys.net</a>
109         </li>
110
111         <li>
112                 <a href="../modules/luci.sys.process.html">luci.sys.process</a>
113         </li>
114
115         <li>
116                 <a href="../modules/luci.sys.user.html">luci.sys.user</a>
117         </li>
118
119         <li>
120                 <a href="../modules/luci.sys.wifi.html">luci.sys.wifi</a>
121         </li>
122
123         <li>
124                 <a href="../modules/luci.util.html">luci.util</a>
125         </li>
126
127         <li>
128                 <a href="../modules/nixio.html">nixio</a>
129         </li>
130
131         <li>
132                 <a href="../modules/nixio.CHANGELOG.html">nixio.CHANGELOG</a>
133         </li>
134
135         <li>
136                 <a href="../modules/nixio.CryptoHash.html">nixio.CryptoHash</a>
137         </li>
138
139         <li>
140                 <a href="../modules/nixio.File.html">nixio.File</a>
141         </li>
142
143         <li>
144                 <a href="../modules/nixio.README.html">nixio.README</a>
145         </li>
146
147         <li>
148                 <a href="../modules/nixio.Socket.html">nixio.Socket</a>
149         </li>
150
151         <li>
152                 <a href="../modules/nixio.TLSContext.html">nixio.TLSContext</a>
153         </li>
154
155         <li>
156                 <a href="../modules/nixio.TLSSocket.html">nixio.TLSSocket</a>
157         </li>
158
159         <li>
160                 <a href="../modules/nixio.UnifiedIO.html">nixio.UnifiedIO</a>
161         </li>
162
163         <li>
164                 <a href="../modules/nixio.bin.html">nixio.bin</a>
165         </li>
166
167         <li>
168                 <a href="../modules/nixio.bit.html">nixio.bit</a>
169         </li>
170
171         <li>
172                 <a href="../modules/nixio.crypto.html">nixio.crypto</a>
173         </li>
174
175         <li>
176                 <a href="../modules/nixio.fs.html">nixio.fs</a>
177         </li>
178
179 </ul>
180
181
182
183 <!-- File list -->
184
185
186
187
188
189
190
191 </div><!-- id="navigation" -->
192
193 <div id="content">
194
195 <h1>Class <code>luci.http</code></h1>
196
197 <p></p>
198
199
200
201
202
203
204
205 <h2>Functions</h2>
206 <table class="function_list">
207
208         <tr>
209         <td class="name" nowrap><a href="#build_querystring">build_querystring</a>&nbsp;(table)</td>
210         <td class="summary">
211  
212 Create a querystring out of a table of key - value pairs.</td>
213         </tr>
214
215         <tr>
216         <td class="name" nowrap><a href="#close">close</a>&nbsp;()</td>
217         <td class="summary">
218  
219 Close the HTTP-Connection.</td>
220         </tr>
221
222         <tr>
223         <td class="name" nowrap><a href="#content">content</a>&nbsp;()</td>
224         <td class="summary">
225  
226 Return the request content if the request was of unknown type.</td>
227         </tr>
228
229         <tr>
230         <td class="name" nowrap><a href="#formvalue">formvalue</a>&nbsp;(name, noparse)</td>
231         <td class="summary">
232  
233 Get a certain HTTP input value or a table of all input values.</td>
234         </tr>
235
236         <tr>
237         <td class="name" nowrap><a href="#formvaluetable">formvaluetable</a>&nbsp;(prefix)</td>
238         <td class="summary">
239  
240 Get a table of all HTTP input values with a certain prefix.</td>
241         </tr>
242
243         <tr>
244         <td class="name" nowrap><a href="#getcookie">getcookie</a>&nbsp;(name)</td>
245         <td class="summary">
246  
247 Get the value of a certain HTTP-Cookie.</td>
248         </tr>
249
250         <tr>
251         <td class="name" nowrap><a href="#getenv">getenv</a>&nbsp;(name)</td>
252         <td class="summary">
253  
254 Get the value of a certain HTTP environment variable 
255 or the environment table itself.</td>
256         </tr>
257
258         <tr>
259         <td class="name" nowrap><a href="#header">header</a>&nbsp;(key, value)</td>
260         <td class="summary">
261  
262 Send a HTTP-Header.</td>
263         </tr>
264
265         <tr>
266         <td class="name" nowrap><a href="#mimedecode_message_body">mimedecode_message_body</a>&nbsp;(src, msg, filecb)</td>
267         <td class="summary">
268  
269 Decode a mime encoded http message body with multipart/form-data Content-Type.</td>
270         </tr>
271
272         <tr>
273         <td class="name" nowrap><a href="#parse_message_body">parse_message_body</a>&nbsp;(src, msg, filecb)</td>
274         <td class="summary">
275  
276 Try to extract and decode a http message body from the given ltn12 source.</td>
277         </tr>
278
279         <tr>
280         <td class="name" nowrap><a href="#prepare_content">prepare_content</a>&nbsp;(mime)</td>
281         <td class="summary">
282  
283 Set the mime type of following content data.</td>
284         </tr>
285
286         <tr>
287         <td class="name" nowrap><a href="#redirect">redirect</a>&nbsp;(url)</td>
288         <td class="summary">
289  
290 Redirects the client to a new URL and closes the connection.</td>
291         </tr>
292
293         <tr>
294         <td class="name" nowrap><a href="#setfilehandler">setfilehandler</a>&nbsp;(callback)</td>
295         <td class="summary">
296  
297 Set a handler function for incoming user file uploads.</td>
298         </tr>
299
300         <tr>
301         <td class="name" nowrap><a href="#source">source</a>&nbsp;()</td>
302         <td class="summary">
303  
304 Get the RAW HTTP input source 
305  </td>
306         </tr>
307
308         <tr>
309         <td class="name" nowrap><a href="#splice">splice</a>&nbsp;(fp, size)</td>
310         <td class="summary">
311  
312 Splice data from a filedescriptor to the client.</td>
313         </tr>
314
315         <tr>
316         <td class="name" nowrap><a href="#status">status</a>&nbsp;(code, message)</td>
317         <td class="summary">
318  
319 Set the HTTP status code and status message.</td>
320         </tr>
321
322         <tr>
323         <td class="name" nowrap><a href="#urldecode">urldecode</a>&nbsp;(str, no_plus)</td>
324         <td class="summary">
325  
326 Return the URL-decoded equivalent of a string.</td>
327         </tr>
328
329         <tr>
330         <td class="name" nowrap><a href="#urldecode_message_body">urldecode_message_body</a>&nbsp;(src, msg)</td>
331         <td class="summary">
332  
333 Decode an urlencoded http message body with application/x-www-urlencoded 
334 Content-Type.</td>
335         </tr>
336
337         <tr>
338         <td class="name" nowrap><a href="#urldecode_params">urldecode_params</a>&nbsp;(url, tbl)</td>
339         <td class="summary">
340  
341 Extract and split urlencoded data pairs, separated bei either "&" or ";" 
342 from given url or string.</td>
343         </tr>
344
345         <tr>
346         <td class="name" nowrap><a href="#urlencode">urlencode</a>&nbsp;(str)</td>
347         <td class="summary">
348  
349 Return the URL-encoded equivalent of a string.</td>
350         </tr>
351
352         <tr>
353         <td class="name" nowrap><a href="#urlencode_params">urlencode_params</a>&nbsp;(tbl)</td>
354         <td class="summary">
355  
356 Encode each key-value-pair in given table to x-www-urlencoded format, 
357 separated by "&".</td>
358         </tr>
359
360         <tr>
361         <td class="name" nowrap><a href="#write">write</a>&nbsp;(content, src_err)</td>
362         <td class="summary">
363  
364 Send a chunk of content data to the client.</td>
365         </tr>
366
367         <tr>
368         <td class="name" nowrap><a href="#write_json">write_json</a>&nbsp;(data)</td>
369         <td class="summary">
370  
371 Send the given data as JSON encoded string.</td>
372         </tr>
373
374 </table>
375
376
377
378
379
380
381 <br/>
382 <br/>
383
384
385 <h2><a name="functions"></a>Functions</h2>
386 <dl class="function">
387
388
389
390 <dt><a name="build_querystring"></a><strong>build_querystring</strong>&nbsp;(table)</dt>
391 <dd>
392
393  
394 Create a querystring out of a table of key - value pairs. 
395
396
397
398 <h3>Parameters</h3>
399 <ul>
400         
401         <li>
402           table: Query string source table
403         </li>
404         
405 </ul>
406
407
408
409
410
411
412 <h3>Return value:</h3>
413 Encoded HTTP query string
414
415
416
417 </dd>
418
419
420
421
422 <dt><a name="close"></a><strong>close</strong>&nbsp;()</dt>
423 <dd>
424
425  
426 Close the HTTP-Connection. 
427
428
429
430
431
432
433
434
435
436
437 </dd>
438
439
440
441
442 <dt><a name="content"></a><strong>content</strong>&nbsp;()</dt>
443 <dd>
444
445  
446 Return the request content if the request was of unknown type. 
447
448
449
450
451
452
453
454
455 <h3>Return values:</h3>
456 <ol>
457         
458         <li>HTTP request body
459         
460         <li>HTTP request body length
461         
462 </ol>
463
464
465
466 </dd>
467
468
469
470
471 <dt><a name="formvalue"></a><strong>formvalue</strong>&nbsp;(name, noparse)</dt>
472 <dd>
473
474  
475 Get a certain HTTP input value or a table of all input values. 
476
477
478
479 <h3>Parameters</h3>
480 <ul>
481         
482         <li>
483           name: Name of the GET or POST variable to fetch
484         </li>
485         
486         <li>
487           noparse: Don't parse POST data before getting the value
488         </li>
489         
490 </ul>
491
492
493
494
495
496
497 <h3>Return value:</h3>
498 HTTP input value or table of all input value
499
500
501
502 </dd>
503
504
505
506
507 <dt><a name="formvaluetable"></a><strong>formvaluetable</strong>&nbsp;(prefix)</dt>
508 <dd>
509
510  
511 Get a table of all HTTP input values with a certain prefix. 
512
513
514
515 <h3>Parameters</h3>
516 <ul>
517         
518         <li>
519           prefix: Prefix
520         </li>
521         
522 </ul>
523
524
525
526
527
528
529 <h3>Return value:</h3>
530 Table of all HTTP input values with given prefix
531
532
533
534 </dd>
535
536
537
538
539 <dt><a name="getcookie"></a><strong>getcookie</strong>&nbsp;(name)</dt>
540 <dd>
541
542  
543 Get the value of a certain HTTP-Cookie. 
544
545
546
547 <h3>Parameters</h3>
548 <ul>
549         
550         <li>
551           name: Cookie Name
552         </li>
553         
554 </ul>
555
556
557
558
559
560
561 <h3>Return value:</h3>
562 String containing cookie data
563
564
565
566 </dd>
567
568
569
570
571 <dt><a name="getenv"></a><strong>getenv</strong>&nbsp;(name)</dt>
572 <dd>
573
574  
575 Get the value of a certain HTTP environment variable 
576 or the environment table itself. 
577
578
579
580 <h3>Parameters</h3>
581 <ul>
582         
583         <li>
584           name: Environment variable
585         </li>
586         
587 </ul>
588
589
590
591
592
593
594 <h3>Return value:</h3>
595 HTTP environment value or environment table
596
597
598
599 </dd>
600
601
602
603
604 <dt><a name="header"></a><strong>header</strong>&nbsp;(key, value)</dt>
605 <dd>
606
607  
608 Send a HTTP-Header. 
609
610
611
612 <h3>Parameters</h3>
613 <ul>
614         
615         <li>
616           key: Header key
617         </li>
618         
619         <li>
620           value: Header value
621         </li>
622         
623 </ul>
624
625
626
627
628
629
630
631
632 </dd>
633
634
635
636
637 <dt><a name="mimedecode_message_body"></a><strong>mimedecode_message_body</strong>&nbsp;(src, msg, filecb)</dt>
638 <dd>
639
640  
641 Decode a mime encoded http message body with multipart/form-data Content-Type. 
642  
643 Stores all extracted data associated with its parameter name 
644 in the params table within the given message object. Multiple parameter 
645 values are stored as tables, ordinary ones as strings. 
646  
647 If an optional file callback function is given then it is feeded with the 
648 file contents chunk by chunk and only the extracted file name is stored 
649 within the params table. The callback function will be called subsequently 
650 with three arguments: 
651  o Table containing decoded (name, file) and raw (headers) mime header data 
652  o String value containing a chunk of the file data 
653  o Boolean which indicates wheather the current chunk is the last one (eof) 
654
655
656
657 <h3>Parameters</h3>
658 <ul>
659         
660         <li>
661           src: Ltn12 source function
662         </li>
663         
664         <li>
665           msg: HTTP message object
666         </li>
667         
668         <li>
669           filecb: File callback function (optional)
670         </li>
671         
672 </ul>
673
674
675
676
677
678
679 <h3>Return values:</h3>
680 <ol>
681         
682         <li>Value indicating successful operation (not nil means "ok")
683         
684         <li>String containing the error if unsuccessful
685         
686 </ol>
687
688
689
690 <h3>See also:</h3>
691 <ul>
692         
693         <li><a href="">
694                 parse_message_header
695         </a>
696         
697 </ul>
698
699 </dd>
700
701
702
703
704 <dt><a name="parse_message_body"></a><strong>parse_message_body</strong>&nbsp;(src, msg, filecb)</dt>
705 <dd>
706
707  
708 Try to extract and decode a http message body from the given ltn12 source. 
709 This function will examine the Content-Type within the given message object 
710 to select the appropriate content decoder. 
711  
712 Currently the application/x-www-urlencoded and application/form-data 
713 mime types are supported. If the encountered content encoding can't be 
714 handled then the whole message body will be stored unaltered as "content" 
715 property within the given message object. 
716
717
718
719 <h3>Parameters</h3>
720 <ul>
721         
722         <li>
723           src: Ltn12 source function
724         </li>
725         
726         <li>
727           msg: HTTP message object
728         </li>
729         
730         <li>
731           filecb: File data callback (optional, see mimedecode_message_body())
732         </li>
733         
734 </ul>
735
736
737
738
739
740
741 <h3>Return values:</h3>
742 <ol>
743         
744         <li>Value indicating successful operation (not nil means "ok")
745         
746         <li>String containing the error if unsuccessful
747         
748 </ol>
749
750
751
752 <h3>See also:</h3>
753 <ul>
754         
755         <li><a href="">
756                 parse_message_header
757         </a>
758         
759 </ul>
760
761 </dd>
762
763
764
765
766 <dt><a name="prepare_content"></a><strong>prepare_content</strong>&nbsp;(mime)</dt>
767 <dd>
768
769  
770 Set the mime type of following content data. 
771
772
773
774 <h3>Parameters</h3>
775 <ul>
776         
777         <li>
778           mime: Mimetype of following content
779         </li>
780         
781 </ul>
782
783
784
785
786
787
788
789
790 </dd>
791
792
793
794
795 <dt><a name="redirect"></a><strong>redirect</strong>&nbsp;(url)</dt>
796 <dd>
797
798  
799 Redirects the client to a new URL and closes the connection. 
800
801
802
803 <h3>Parameters</h3>
804 <ul>
805         
806         <li>
807           url: Target URL
808         </li>
809         
810 </ul>
811
812
813
814
815
816
817
818
819 </dd>
820
821
822
823
824 <dt><a name="setfilehandler"></a><strong>setfilehandler</strong>&nbsp;(callback)</dt>
825 <dd>
826
827  
828 Set a handler function for incoming user file uploads. 
829
830
831
832 <h3>Parameters</h3>
833 <ul>
834         
835         <li>
836           callback: Handler function
837         </li>
838         
839 </ul>
840
841
842
843
844
845
846
847
848 </dd>
849
850
851
852
853 <dt><a name="source"></a><strong>source</strong>&nbsp;()</dt>
854 <dd>
855
856  
857 Get the RAW HTTP input source 
858
859
860
861
862
863
864
865
866 <h3>Return value:</h3>
867 HTTP LTN12 source
868
869
870
871 </dd>
872
873
874
875
876 <dt><a name="splice"></a><strong>splice</strong>&nbsp;(fp, size)</dt>
877 <dd>
878
879  
880 Splice data from a filedescriptor to the client. 
881
882
883
884 <h3>Parameters</h3>
885 <ul>
886         
887         <li>
888           fp: File descriptor
889         </li>
890         
891         <li>
892           size: Bytes to splice (optional)
893         </li>
894         
895 </ul>
896
897
898
899
900
901
902
903
904 </dd>
905
906
907
908
909 <dt><a name="status"></a><strong>status</strong>&nbsp;(code, message)</dt>
910 <dd>
911
912  
913 Set the HTTP status code and status message. 
914
915
916
917 <h3>Parameters</h3>
918 <ul>
919         
920         <li>
921           code: Status code
922         </li>
923         
924         <li>
925           message: Status message
926         </li>
927         
928 </ul>
929
930
931
932
933
934
935
936
937 </dd>
938
939
940
941
942 <dt><a name="urldecode"></a><strong>urldecode</strong>&nbsp;(str, no_plus)</dt>
943 <dd>
944
945  
946 Return the URL-decoded equivalent of a string. 
947
948
949
950 <h3>Parameters</h3>
951 <ul>
952         
953         <li>
954           str: URL-encoded string
955         </li>
956         
957         <li>
958           no_plus: Don't decode + to " "
959         </li>
960         
961 </ul>
962
963
964
965
966
967
968 <h3>Return value:</h3>
969 URL-decoded string
970
971
972
973 <h3>See also:</h3>
974 <ul>
975         
976         <li><a href="#urlencode">
977                 urlencode
978         </a>
979         
980 </ul>
981
982 </dd>
983
984
985
986
987 <dt><a name="urldecode_message_body"></a><strong>urldecode_message_body</strong>&nbsp;(src, msg)</dt>
988 <dd>
989
990  
991 Decode an urlencoded http message body with application/x-www-urlencoded 
992 Content-Type. 
993  
994 Stores all extracted data associated with its parameter name in the params 
995 table within the given message object. Multiple parameter values are stored 
996 as tables, ordinary ones as strings. 
997
998
999
1000 <h3>Parameters</h3>
1001 <ul>
1002         
1003         <li>
1004           src: Ltn12 source function
1005         </li>
1006         
1007         <li>
1008           msg: HTTP message object
1009         </li>
1010         
1011 </ul>
1012
1013
1014
1015
1016
1017
1018 <h3>Return values:</h3>
1019 <ol>
1020         
1021         <li>Value indicating successful operation (not nil means "ok")
1022         
1023         <li>String containing the error if unsuccessful
1024         
1025 </ol>
1026
1027
1028
1029 <h3>See also:</h3>
1030 <ul>
1031         
1032         <li><a href="">
1033                 parse_message_header
1034         </a>
1035         
1036 </ul>
1037
1038 </dd>
1039
1040
1041
1042
1043 <dt><a name="urldecode_params"></a><strong>urldecode_params</strong>&nbsp;(url, tbl)</dt>
1044 <dd>
1045
1046  
1047 Extract and split urlencoded data pairs, separated bei either "&" or ";" 
1048 from given url or string. Returns a table with urldecoded values. 
1049  
1050 Simple parameters are stored as string values associated with the parameter 
1051 name within the table. Parameters with multiple values are stored as array 
1052 containing the corresponding values. 
1053
1054
1055
1056 <h3>Parameters</h3>
1057 <ul>
1058         
1059         <li>
1060           url: The url or string which contains x-www-urlencoded form data
1061         </li>
1062         
1063         <li>
1064           tbl: Use the given table for storing values (optional)
1065         </li>
1066         
1067 </ul>
1068
1069
1070
1071
1072
1073
1074 <h3>Return value:</h3>
1075 Table containing the urldecoded parameters
1076
1077
1078
1079 <h3>See also:</h3>
1080 <ul>
1081         
1082         <li><a href="#urlencode_params">
1083                 urlencode_params
1084         </a>
1085         
1086 </ul>
1087
1088 </dd>
1089
1090
1091
1092
1093 <dt><a name="urlencode"></a><strong>urlencode</strong>&nbsp;(str)</dt>
1094 <dd>
1095
1096  
1097 Return the URL-encoded equivalent of a string. 
1098
1099
1100
1101 <h3>Parameters</h3>
1102 <ul>
1103         
1104         <li>
1105           str: Source string
1106         </li>
1107         
1108 </ul>
1109
1110
1111
1112
1113
1114
1115 <h3>Return value:</h3>
1116 URL-encoded string
1117
1118
1119
1120 <h3>See also:</h3>
1121 <ul>
1122         
1123         <li><a href="#urldecode">
1124                 urldecode
1125         </a>
1126         
1127 </ul>
1128
1129 </dd>
1130
1131
1132
1133
1134 <dt><a name="urlencode_params"></a><strong>urlencode_params</strong>&nbsp;(tbl)</dt>
1135 <dd>
1136
1137  
1138 Encode each key-value-pair in given table to x-www-urlencoded format, 
1139 separated by "&". 
1140  
1141 Tables are encoded as parameters with multiple values by repeating the 
1142 parameter name with each value. 
1143
1144
1145
1146 <h3>Parameters</h3>
1147 <ul>
1148         
1149         <li>
1150           tbl: Table with the values
1151         </li>
1152         
1153 </ul>
1154
1155
1156
1157
1158
1159
1160 <h3>Return value:</h3>
1161 String containing encoded values
1162
1163
1164
1165 <h3>See also:</h3>
1166 <ul>
1167         
1168         <li><a href="#urldecode_params">
1169                 urldecode_params
1170         </a>
1171         
1172 </ul>
1173
1174 </dd>
1175
1176
1177
1178
1179 <dt><a name="write"></a><strong>write</strong>&nbsp;(content, src_err)</dt>
1180 <dd>
1181
1182  
1183 Send a chunk of content data to the client. 
1184  
1185 This function is as a valid LTN12 sink. 
1186 If the content chunk is nil this function will automatically invoke close. 
1187
1188
1189
1190 <h3>Parameters</h3>
1191 <ul>
1192         
1193         <li>
1194           content: Content chunk
1195         </li>
1196         
1197         <li>
1198           src_err: Error object from source (optional)
1199         </li>
1200         
1201 </ul>
1202
1203
1204
1205
1206
1207
1208
1209
1210 <h3>See also:</h3>
1211 <ul>
1212         
1213         <li><a href="#close">
1214                 close
1215         </a>
1216         
1217 </ul>
1218
1219 </dd>
1220
1221
1222
1223
1224 <dt><a name="write_json"></a><strong>write_json</strong>&nbsp;(data)</dt>
1225 <dd>
1226
1227  
1228 Send the given data as JSON encoded string. 
1229
1230
1231
1232 <h3>Parameters</h3>
1233 <ul>
1234         
1235         <li>
1236           data: Data to send
1237         </li>
1238         
1239 </ul>
1240
1241
1242
1243
1244
1245
1246
1247
1248 </dd>
1249
1250
1251 </dl>
1252
1253
1254
1255
1256
1257 </div> <!-- id="content" -->
1258
1259 </div> <!-- id="main" -->
1260
1261 <div id="about">
1262         <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>
1263 </div> <!-- id="about" -->
1264
1265 </div> <!-- id="container" -->
1266 </body>
1267 </html>