You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Close down server including any sockets and return all resources to Lua. Note that this include removing the FTP global variable and package references.
Copy file name to clipboardExpand all lines: docs/lua-modules/httpserver.md
+8-11Lines changed: 8 additions & 11 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -38,7 +38,6 @@ Callback function has 2 arguments: `req` (request) and `res` (response). The fir
38
38
-`url`: Requested URL
39
39
-`onheader`: assign a function to this value which will be called as soon as HTTP headers like `content-type` are available.
40
40
This handler function has 3 parameters:
41
-
42
41
- `self`: `req` object
43
42
- `name`: Header name. Will allways be lowercase.
44
43
- `value`: Header value
@@ -51,20 +50,18 @@ Callback function has 2 arguments: `req` (request) and `res` (response). The fir
51
50
The second object holds functions:
52
51
53
52
-`send(self, data, [response_code])`: Function to send data to client.
54
-
55
-
-`self`: `res` object
56
-
-`data`: data to send (may be nil)
57
-
-`response_code`: the HTTP response code like `200`(default) or `404` (for example) *NOTE* if there are several calls with response_code given only the first one will be used. Any further codes given will be ignored.
53
+
- `self`: `res` object
54
+
- `data`: data to send (may be nil)
55
+
- `response_code`: the HTTP response code like `200`(default) or `404` (for example) *NOTE* if there are several calls with response_code given only the first one will be used. Any further codes given will be ignored.
58
56
59
57
-`send_header(self, header_name, header_data)`: Function to send HTTP headers to client. This function will not be available after data has been sent. (It will be nil.)
60
-
61
-
-`self`: `res` object
62
-
-`header_name`: the HTTP header name
63
-
-`header_data`: the HTTP header data
58
+
- `self`: `res` object
59
+
- `header_name`: the HTTP header name
60
+
- `header_data`: the HTTP header data
64
61
65
62
-`finish([data[, response_code]])`: Function to finalize connection, optionally sending data and return code.
66
63
67
-
-`data`: optional data to send on connection finalizing
68
-
-`response_code`: the HTTP response code like `200`(default) or `404` (for example) *NOTE* if there are several calls with response_code given only the first one will be used. Any further codes given will be ignored.
64
+
- `data`: optional data to send on connection finalizing
65
+
- `response_code`: the HTTP response code like `200`(default) or `404` (for example) *NOTE* if there are several calls with response_code given only the first one will be used. Any further codes given will be ignored.
69
66
70
67
Full example can be found in [http-example.lua](../../lua_modules/http/http-example.lua)
0 commit comments