Permalink
Browse files

Forward Node.js socket 'drain' and 'timeout' events to the response o…

…bject.

This makes stream.pipe(res) work. Thanks Garret Noling!
  • Loading branch information...
1 parent 286b6a5 commit 3d7bbf68b2c51552e3d1c95c0f42712e9df74319 @FooBarWidget FooBarWidget committed Oct 22, 2013
Showing with 6 additions and 0 deletions.
  1. +6 −0 node_lib/phusion_passenger/httplib_emulation.js
@@ -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();
});

0 comments on commit 3d7bbf6

Please sign in to comment.