cleanup http module
This commit is contained in:
parent
4fbff3f3ac
commit
5d62624e08
|
@ -6,9 +6,8 @@
|
||||||
------------------------------------------------------------------------------
|
------------------------------------------------------------------------------
|
||||||
require("http").createServer(80, function(req, res)
|
require("http").createServer(80, function(req, res)
|
||||||
-- analyse method and url
|
-- analyse method and url
|
||||||
print("+R", req.method, req.url)
|
print("+R", req.method, req.url, node.heap())
|
||||||
-- setup handler of headers, if any
|
-- setup handler of headers, if any
|
||||||
--[[
|
|
||||||
req.onheader = function(self, name, value)
|
req.onheader = function(self, name, value)
|
||||||
-- print("+H", name, value)
|
-- print("+H", name, value)
|
||||||
-- E.g. look for "content-type" header,
|
-- E.g. look for "content-type" header,
|
||||||
|
@ -34,8 +33,7 @@ require("http").createServer(80, function(req, res)
|
||||||
res:finish()
|
res:finish()
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
]]
|
|
||||||
-- or just do something not waiting till body (if any) comes
|
-- or just do something not waiting till body (if any) comes
|
||||||
--res:finish("Hello, world!")
|
--res:finish("Hello, world!")
|
||||||
res:finish("Salut, monde!")
|
--res:finish("Salut, monde!")
|
||||||
end)
|
end)
|
||||||
|
|
|
@ -87,9 +87,7 @@ do
|
||||||
return res
|
return res
|
||||||
end
|
end
|
||||||
|
|
||||||
tmr.wdclr()
|
------------------------------------------------------------------------------
|
||||||
|
|
||||||
------------------------------------------------------------------------------
|
|
||||||
-- HTTP parser
|
-- HTTP parser
|
||||||
------------------------------------------------------------------------------
|
------------------------------------------------------------------------------
|
||||||
local http_handler = function(handler)
|
local http_handler = function(handler)
|
||||||
|
@ -190,8 +188,6 @@ do
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
tmr.wdclr()
|
|
||||||
|
|
||||||
------------------------------------------------------------------------------
|
------------------------------------------------------------------------------
|
||||||
-- HTTP server
|
-- HTTP server
|
||||||
------------------------------------------------------------------------------
|
------------------------------------------------------------------------------
|
||||||
|
|
Loading…
Reference in New Issue