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