luci-base: implement luci.model.uci.get_state()
[project/luci.git] / modules / luci-base / luasrc / http.luadoc
1 ---[[
2 LuCI Web Framework high-level HTTP functions.
3 ]]
4 module "luci.http"
5
6 ---[[
7 Close the HTTP-Connection.
8
9
10 @class function
11 @name close
12 ]]
13
14 ---[[
15 Return the request content if the request was of unknown type.
16
17 @class function
18 @name content
19 @return HTTP request body
20 @return HTTP request body length
21 ]]
22
23 ---[[
24 Get a certain HTTP input value or a table of all input values.
25
26 @class function
27 @name formvalue
28 @param name             Name of the GET or POST variable to fetch
29 @param noparse  Don't parse POST data before getting the value
30 @return                 HTTP input value or table of all input value
31 ]]
32
33 ---[[
34 Get a table of all HTTP input values with a certain prefix.
35
36 @class function
37 @name formvaluetable
38 @param prefix   Prefix
39 @return                 Table of all HTTP input values with given prefix
40 ]]
41
42 ---[[
43 Get the value of a certain HTTP-Cookie.
44
45 @class function
46 @name getcookie
47 @param name             Cookie Name
48 @return                 String containing cookie data
49 ]]
50
51 ---[[
52 Get the value of a certain HTTP environment variable
53
54 or the environment table itself.
55 @class function
56 @name getenv
57 @param name             Environment variable
58 @return                 HTTP environment value or environment table
59 ]]
60
61 ---[[
62 Set a handler function for incoming user file uploads.
63
64 @class function
65 @name setfilehandler
66 @param callback Handler function
67 ]]
68
69 ---[[
70 Send a HTTP-Header.
71
72 @class function
73 @name header
74 @param key      Header key
75 @param value Header value
76 ]]
77
78 ---[[
79 Set the mime type of following content data.
80
81 @class function
82 @name prepare_content
83 @param mime     Mimetype of following content
84 ]]
85
86 ---[[
87 Get the RAW HTTP input source
88
89 @class function
90 @name source
91 @return HTTP LTN12 source
92 ]]
93
94 ---[[
95 Set the HTTP status code and status message.
96
97 @class function
98 @name status
99 @param code             Status code
100 @param message  Status message
101 ]]
102
103 ---[[
104 Send a chunk of content data to the client.
105
106 This function is as a valid LTN12 sink.
107 If the content chunk is nil this function will automatically invoke close.
108 @class function
109 @name write
110 @param content  Content chunk
111 @param src_err  Error object from source (optional)
112 @see close
113 ]]
114
115 ---[[
116 Splice data from a filedescriptor to the client.
117
118 @class function
119 @name splice
120 @param fp       File descriptor
121 @param size     Bytes to splice (optional)
122 ]]
123
124 ---[[
125 Redirects the client to a new URL and closes the connection.
126
127 @class function
128 @name redirect
129 @param url      Target URL
130 ]]
131
132 ---[[
133 Create a querystring out of a table of key - value pairs.
134
135 @class function
136 @name build_querystring
137 @param table            Query string source table
138 @return                 Encoded HTTP query string
139 ]]
140
141 ---[[
142 Return the URL-decoded equivalent of a string.
143
144 @param str              URL-encoded string
145 @param no_plus  Don't decode + to " "
146 @return                 URL-decoded string
147 @see urlencode
148 ]]
149
150 ---[[
151 Return the URL-encoded equivalent of a string.
152
153 @param str              Source string
154 @return                 URL-encoded string
155 @see urldecode
156 ]]
157
158 ---[[
159 Send the given data as JSON encoded string.
160
161 @class function
162 @name write_json
163 @param data             Data to send
164 ]]
165