Sockets should never be attached to a ClientRequest before nextTick().
This way the API for interacting directly with the socket object is consistent before and after the Agent pool is exhausted. Fixes #1601.
This commit is contained in:
parent
1a0edbca86
commit
7c87e092fb
@ -1070,9 +1070,9 @@ ClientRequest.prototype.abort = function() {
|
||||
};
|
||||
|
||||
ClientRequest.prototype.onSocket = function(socket) {
|
||||
var parser = parsers.alloc();
|
||||
var req = this;
|
||||
|
||||
process.nextTick(function () {
|
||||
var parser = parsers.alloc();
|
||||
req.socket = socket;
|
||||
req.connection = socket;
|
||||
parser.reinitialize('response');
|
||||
@ -1209,9 +1209,9 @@ ClientRequest.prototype.onSocket = function(socket) {
|
||||
|
||||
return isHeadResponse;
|
||||
};
|
||||
process.nextTick(function() {
|
||||
req.emit('socket', socket);
|
||||
});
|
||||
|
||||
};
|
||||
ClientRequest.prototype._deferToConnect = function(method, arguments, cb) {
|
||||
// This function is for calls that need to happen once the socket is
|
||||
|
Loading…
x
Reference in New Issue
Block a user