summaryrefslogtreecommitdiff
path: root/lib/_http_server.js
diff options
context:
space:
mode:
authorLuigi Pinca <luigipinca@gmail.com>2017-06-09 17:29:50 +0200
committerAnna Henningsen <anna@addaleax.net>2017-06-12 14:10:13 +0200
commitba449f3bf1f2057773f4759c82df8081f14d09ad (patch)
tree654883a52c01c76a2e88eadcb3a2a7693d1f9d3b /lib/_http_server.js
parent12fd63d6bb38d4fbd41dc4dd8d1b106ee64d1f7c (diff)
downloadandroid-node-v8-ba449f3bf1f2057773f4759c82df8081f14d09ad.tar.gz
android-node-v8-ba449f3bf1f2057773f4759c82df8081f14d09ad.tar.bz2
android-node-v8-ba449f3bf1f2057773f4759c82df8081f14d09ad.zip
http: handle cases where socket.server is null
Fixes a regression that caused an error to be thrown when trying to emit the 'timeout' event on the server referenced by `socket.server`. Fixes: https://github.com/nodejs/node/issues/13435 Refs: https://github.com/nodejs/node/pull/11926 PR-URL: https://github.com/nodejs/node/pull/13578 Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Diffstat (limited to 'lib/_http_server.js')
-rw-r--r--lib/_http_server.js5
1 files changed, 5 insertions, 0 deletions
diff --git a/lib/_http_server.js b/lib/_http_server.js
index 357400e350..6d5dbf4584 100644
--- a/lib/_http_server.js
+++ b/lib/_http_server.js
@@ -294,6 +294,11 @@ function connectionListener(socket) {
httpSocketSetup(socket);
+ // Ensure that the server property of the socket is correctly set.
+ // See https://github.com/nodejs/node/issues/13435
+ if (socket.server === null)
+ socket.server = this;
+
// If the user has added a listener to the server,
// request, or response, then it's their responsibility.
// otherwise, destroy on timeout by default