mjackson/bufferedstream

'end' is never emitted when piping an empty stream to the http response stream

Closed this issue · 1 comments

when piping an empty bufferedstream to the http response stream the 'end' event is never emitted and the request hangs until the socket timeout occurs. piping it to a file stream however does work.

it looks like the empty bufferedstream gets paused through the 'pipe' logic and this prevents the 'end' event being emitted. this seems to be a regression of issue #5.

test case:

var http = require('http'),
  BufferedStream = require('bufferedstream');

http.createServer(function (req, res) {
  var stream = new BufferedStream();
  stream.end('');
  stream.pipe(res);
  // 'end' is never emitted, request hangs...
}).listen(8080, '127.0.0.1');

the issue was reproducible with node v0.10.8.

after upgrading to node v0.10.22 it's not reproducible anymore.

consider it fixed