Lua API: New API: set_error404_cb
Signed-off-by: Jianhui Zhao <jianhuizhao329@gmail.com>
This commit is contained in:
1 parent
dcb397a62c
commit
c6441851f6
4 files changed
+72
-28
No files matched your search
@@ -34,6 +34,16 @@ local srv = uh.new(port)
|
||||
|
||||
print("Listen on:", port)
|
||||
|
||||
srv:set_error404_cb(function(cl, opt)
|
||||
uh.send_header(cl, 200, "OK", -1)
|
||||
uh.append_header(cl, "Myheader", "Hello")
|
||||
uh.header_end(cl)
|
||||
|
||||
uh.chunk_send(cl, "<h1>Libuhttpd-Lua: Not found</h1>")
|
||||
|
||||
uh.request_done(cl)
|
||||
end)
|
||||
|
||||
srv:add_action("/lua", function(cl, opt)
|
||||
uh.send_header(cl, 200, "OK", -1)
|
||||
uh.append_header(cl, "Myheader", "Hello")
|
||||
|
||||
Reference in new issue
Block a user