Skip to content

Commit

Permalink
Forward Node.js socket 'drain' and 'timeout' events to the response o…
Browse files Browse the repository at this point in the history
…bject.

This makes stream.pipe(res) work. Thanks Garret Noling!
  • Loading branch information
FooBarWidget committed Oct 22, 2013
1 parent 286b6a5 commit 3d7bbf6
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions node_lib/phusion_passenger/httplib_emulation.js
Expand Up @@ -125,6 +125,12 @@ function createServerResponse(req) {
var res = new http.ServerResponse(req);
res.assignSocket(req.socket);
res.shouldKeepAlive = false;
req.socket.on('drain', function() {
res.emit('drain');
});
req.socket.on('timeout', function() {
res.emit('timeout');
});
res.once('finish', function() {
req.socket.destroySoon();
});
Expand Down

0 comments on commit 3d7bbf6

Please sign in to comment.