summaryrefslogtreecommitdiff
path: root/lib/_http_agent.js
diff options
context:
space:
mode:
authorAnna Henningsen <anna@addaleax.net>2017-05-31 23:15:41 +0200
committerAnna Henningsen <anna@addaleax.net>2017-06-03 22:36:51 +0200
commit3e02636bcbf59517e25ad5dd2ebb954d5de95b81 (patch)
tree5d9a593db9c4cc64f67c510d29e6c99aaafd5712 /lib/_http_agent.js
parent9b9a25c5eb5114fb834ec83e833ce991690109fd (diff)
downloadnode-new-3e02636bcbf59517e25ad5dd2ebb954d5de95b81.tar.gz
async_hooks,http: fix socket reuse with Agent
Under very specific circumstances the `http` implementation could be brought to crash, because the Agent did not re-assign the async id field properly after setting up a socket for reuse. Fixes: https://github.com/nodejs/node/issues/13325 PR-URL: https://github.com/nodejs/node/pull/13348 Reviewed-By: Refael Ackermann <refack@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Andreas Madsen <amwebdk@gmail.com>
Diffstat (limited to 'lib/_http_agent.js')
-rw-r--r--lib/_http_agent.js1
1 files changed, 1 insertions, 0 deletions
diff --git a/lib/_http_agent.js b/lib/_http_agent.js
index d791a961c7..60fff343dc 100644
--- a/lib/_http_agent.js
+++ b/lib/_http_agent.js
@@ -168,6 +168,7 @@ Agent.prototype.addRequest = function addRequest(req, options, port/*legacy*/,
var socket = this.freeSockets[name].shift();
// Assign the handle a new asyncId and run any init() hooks.
socket._handle.asyncReset();
+ socket[async_id_symbol] = socket._handle.getAsyncId();
debug('have free socket');
// don't leak