|
@ -116,8 +116,11 @@ function parserOnHeadersComplete(info) { |
|
|
function parserOnBody(b, start, len) { |
|
|
function parserOnBody(b, start, len) { |
|
|
var parser = this; |
|
|
var parser = this; |
|
|
var slice = b.slice(start, start + len); |
|
|
var slice = b.slice(start, start + len); |
|
|
// body encoding is done in _emitData
|
|
|
if (parser.incoming._paused || parser.incoming._pendings.length) { |
|
|
|
|
|
parser.incoming._pendings.push(slice); |
|
|
|
|
|
} else { |
|
|
parser.incoming._emitData(slice); |
|
|
parser.incoming._emitData(slice); |
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
function parserOnMessageComplete() { |
|
|
function parserOnMessageComplete() { |
|
@ -1263,7 +1266,7 @@ function freeParser(parser, req) { |
|
|
if (req) { |
|
|
if (req) { |
|
|
req.parser = null; |
|
|
req.parser = null; |
|
|
} |
|
|
} |
|
|
}; |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ClientRequest.prototype.onSocket = function(socket) { |
|
|
ClientRequest.prototype.onSocket = function(socket) { |
|
@ -1376,13 +1379,16 @@ ClientRequest.prototype.onSocket = function(socket) { |
|
|
|
|
|
|
|
|
var closeListener = function() { |
|
|
var closeListener = function() { |
|
|
debug('HTTP socket close'); |
|
|
debug('HTTP socket close'); |
|
|
|
|
|
var req = socket._httpMessage; |
|
|
req.emit('close'); |
|
|
req.emit('close'); |
|
|
if (req.res && req.res.readable) { |
|
|
if (req.res && req.res.readable) { |
|
|
// Socket closed before we emitted 'end' below.
|
|
|
// Socket closed before we emitted 'end' below.
|
|
|
req.res.emit('aborted'); |
|
|
req.res.emit('aborted'); |
|
|
|
|
|
var res = req.res; |
|
|
req.res._emitPending(function() { |
|
|
req.res._emitPending(function() { |
|
|
req.res._emitEnd(); |
|
|
res._emitEnd(); |
|
|
req.res.emit('close'); |
|
|
res.emit('close'); |
|
|
|
|
|
res = null; |
|
|
}); |
|
|
}); |
|
|
} else if (!req.res && !req._hadError) { |
|
|
} else if (!req.res && !req._hadError) { |
|
|
// This socket error fired before we started to
|
|
|
// This socket error fired before we started to
|
|
@ -1532,10 +1538,8 @@ ClientRequest.prototype.setSocketKeepAlive = function() { |
|
|
this._deferToConnect('setKeepAlive', arguments); |
|
|
this._deferToConnect('setKeepAlive', arguments); |
|
|
}; |
|
|
}; |
|
|
|
|
|
|
|
|
ClientRequest.prototype.clearTimeout = function() { |
|
|
ClientRequest.prototype.clearTimeout = function(cb) { |
|
|
var args = Array.prototype.slice.call(arguments, 0); |
|
|
this.setTimeout(0, cb); |
|
|
args.unshift(0); |
|
|
|
|
|
this._deferToConnect('setTimeout', args); |
|
|
|
|
|
}; |
|
|
}; |
|
|
|
|
|
|
|
|
exports.request = function(options, cb) { |
|
|
exports.request = function(options, cb) { |
|
|