The following code does not close the response, as it should for a chunked 
response.

local http = require('http')
local fs = require('fs')

local server = http.createServer(function (req, res)
  local f = fs.createReadStream('somefile.txt')
  -- f:on('end', function()res:finish()end)
  res:setHeader("Content-Type", "application/octet-stream")
  f:pipe(res)
end):listen(1337, function()
  print('Server running on 1337')
end)

The equivalent code works in nodejs.

To test I used:
wget -o /dev/null http://localhost:1337

The response object is emitting events "finish", "unpipe" and "end" after 
the readstream's "end" event.
But the http "transaction" is not terminated.

I'd give this a go but I thought I'd better ask if this is a known problem?
if not, do you have a suggestion as to where it might be?


Workaround is uncomment the line with "f:on('end'..."

-- 
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