Thank you for the report.

According to node's documentation the event will be 'close' or 'finish'.
The master branch should use 'close' currently. We need a patch [1] here
to re-emit the finish event. I patched our next generation branch
'luvi-up' [2] to include your test case.

I may be able to get a patch into master by tomorrow, but a pull request
would really help.

Regards, Ryan

1.https://github.com/luvit/luvit/blob/master/lib/luvit/http.lua#L546-548
2.https://github.com/luvit/luvit/pull/644

On Sat, Feb 28, 2015, at 03:15 PM, Pablo Botelho wrote:
> I'm building a simple logger and ran into this:
>
> local http = require("http")
>
> http.createServer(function (req, res) local body = "Hello world\n"
>
> res:on("error", function(err) msg = tostring(err) print("Error while
> sending a response: " .. msg) end)
>
> res:on("end", function() -- log request / response info
> print("end") end)
>
> res:writeHead(200, { ["Content-Type"] = "text/plain",
> ["Content-Length"] = #body }) res:finish(body) end):listen(8080)
>
> but the callback to res:on('end') never gets executed
>
> Is there a way to achieve that?
>
> cheers!
>


> --
>
You received this message because you are subscribed to the Google
Groups "luvit" group.
>
To unsubscribe from this group and stop receiving emails from it, send
an email to [email protected].
>
For more options, visit https://groups.google.com/d/optout.

-- 
You received this message because you are subscribed to the Google Groups 
"luvit" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to