From 8557cb366092ea1bbc88386bdd79b9dad5867f19 Mon Sep 17 00:00:00 2001 From: Max Romanov Date: Mon, 1 Apr 2019 16:40:40 +0300 Subject: Introducing close event to notify about server stop. This closes #236 on GitHub. Thanks to 0xcdcdcdcd. --- src/nodejs/unit-http/http_server.js | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'src/nodejs/unit-http/http_server.js') diff --git a/src/nodejs/unit-http/http_server.js b/src/nodejs/unit-http/http_server.js index 057a1f26..0ac5d649 100755 --- a/src/nodejs/unit-http/http_server.js +++ b/src/nodejs/unit-http/http_server.js @@ -387,6 +387,10 @@ Server.prototype.emit_events = function (server, req, res) { }); }; +Server.prototype.emit_close = function () { + this.emit('close'); +}; + function connectionListener(socket) { } -- cgit From 7b839bf5da772d4bf61a3be95fbdbb6d4591ba63 Mon Sep 17 00:00:00 2001 From: Valentin Bartenev Date: Wed, 3 Apr 2019 18:40:47 +0300 Subject: Backed out changeset f74d4dd9c3db. This closes #240 issue on GitHub. --- src/nodejs/unit-http/http_server.js | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'src/nodejs/unit-http/http_server.js') diff --git a/src/nodejs/unit-http/http_server.js b/src/nodejs/unit-http/http_server.js index 0ac5d649..ae8e204a 100755 --- a/src/nodejs/unit-http/http_server.js +++ b/src/nodejs/unit-http/http_server.js @@ -197,6 +197,14 @@ function writeHead(statusCode, reason, obj) { } }; +/* + * Some Node.js packages are known to be using this undocumented function, + * notably "compression" middleware. + */ +ServerResponse.prototype._implicitHeader = function _implicitHeader() { + this.writeHead(this.statusCode); +}; + ServerResponse.prototype._writeBody = function(chunk, encoding, callback) { var contentLength = 0; -- cgit