Comparing version 2.75.0 to 2.76.0
## Change Log | ||
### v2.76.0 (2016/10/25) | ||
- [#2424](https://github.com/request/request/pull/2424) Handle buffers directly instead of using "bl" (@zertosh) | ||
- [#2415](https://github.com/request/request/pull/2415) Re-enable timeout tests on Travis + other fixes (@mscdex) | ||
- [#2431](https://github.com/request/request/pull/2431) Improve timeouts accuracy and node v6.8.0+ compatibility (@mscdex, @greenkeeperio-bot) | ||
- [#2428](https://github.com/request/request/pull/2428) Update qs to version 6.3.0 🚀 (@greenkeeperio-bot) | ||
- [#2420](https://github.com/request/request/pull/2420) change .on to .once, remove possible memory leaks (@duereg) | ||
- [#2426](https://github.com/request/request/pull/2426) Remove "isFunction" helper in favor of "typeof" check (@zertosh) | ||
- [#2425](https://github.com/request/request/pull/2425) Simplify "defer" helper creation (@zertosh) | ||
- [#2402](https://github.com/request/request/pull/2402) form-data@2.1.1 breaks build 🚨 (@greenkeeperio-bot) | ||
- [#2393](https://github.com/request/request/pull/2393) Update form-data to version 2.1.0 🚀 (@greenkeeperio-bot) | ||
### v2.75.0 (2016/09/17) | ||
@@ -503,4 +514,2 @@ - [#2381](https://github.com/request/request/pull/2381) Drop support for Node 0.10 (@simov) | ||
- [#605](https://github.com/request/request/pull/605) Only include ":" + pass in Basic Auth if it's defined (fixes #602) (@bendrucker) | ||
### v2.25.0 (2013/07/23) | ||
- [#596](https://github.com/request/request/pull/596) Global agent is being used when pool is specified (@Cauldrath) | ||
@@ -578,3 +587,3 @@ - [#594](https://github.com/request/request/pull/594) Emit complete event when there is no callback (@RomainLK) | ||
- [#207](https://github.com/request/request/pull/207) Fix #206 Change HTTP/HTTPS agent when redirecting between protocols (@isaacs) | ||
- [#214](https://github.com/request/request/pull/214) documenting additional behavior of json option (@jphaas) | ||
- [#214](https://github.com/request/request/pull/214) documenting additional behavior of json option (@jphaas, @vpulim) | ||
- [#272](https://github.com/request/request/pull/272) Boundary begins with CRLF? (@elspoono, @timshadel, @naholyr, @nanodocumet, @TehShrike) | ||
@@ -597,6 +606,6 @@ - [#284](https://github.com/request/request/pull/284) Remove stray `console.log()` call in multipart generator. (@bcherry) | ||
- [#240](https://github.com/request/request/pull/240) don't error when null is passed for options (@polotek) | ||
- [#211](https://github.com/request/request/pull/211) Replace all occurrences of special chars in RFC3986 (@chriso) | ||
- [#211](https://github.com/request/request/pull/211) Replace all occurrences of special chars in RFC3986 (@chriso, @vpulim) | ||
- [#224](https://github.com/request/request/pull/224) Multipart content-type change (@janjongboom) | ||
- [#217](https://github.com/request/request/pull/217) need to use Authorization (titlecase) header with Tumblr OAuth (@visnup) | ||
- [#203](https://github.com/request/request/pull/203) Fix cookie and redirect bugs and add auth support for HTTPS tunnel (@milewise) | ||
- [#203](https://github.com/request/request/pull/203) Fix cookie and redirect bugs and add auth support for HTTPS tunnel (@vpulim) | ||
- [#199](https://github.com/request/request/pull/199) Tunnel (@isaacs) | ||
@@ -603,0 +612,0 @@ - [#198](https://github.com/request/request/pull/198) Bugfix on forever usage of util.inherits (@isaacs) |
@@ -21,4 +21,3 @@ // Copyright 2010-2012 Mikeal Rogers | ||
var isFunction = helpers.isFunction | ||
, paramsHaveRequestBody = helpers.paramsHaveRequestBody | ||
var paramsHaveRequestBody = helpers.paramsHaveRequestBody | ||
@@ -99,3 +98,3 @@ | ||
if (isFunction(requester)) { | ||
if (typeof requester === 'function') { | ||
method = requester | ||
@@ -102,0 +101,0 @@ } |
@@ -6,14 +6,6 @@ 'use strict' | ||
function deferMethod() { | ||
if (typeof setImmediate === 'undefined') { | ||
return process.nextTick | ||
} | ||
var defer = typeof setImmediate === 'undefined' | ||
? process.nextTick | ||
: setImmediate | ||
return setImmediate | ||
} | ||
function isFunction(value) { | ||
return typeof value === 'function' | ||
} | ||
function paramsHaveRequestBody(params) { | ||
@@ -67,3 +59,2 @@ return ( | ||
exports.isFunction = isFunction | ||
exports.paramsHaveRequestBody = paramsHaveRequestBody | ||
@@ -76,2 +67,2 @@ exports.safeStringify = safeStringify | ||
exports.version = version | ||
exports.defer = deferMethod() | ||
exports.defer = defer |
@@ -10,3 +10,3 @@ { | ||
], | ||
"version": "2.75.0", | ||
"version": "2.76.0", | ||
"author": "Mikeal Rogers <mikeal.rogers@gmail.com>", | ||
@@ -28,3 +28,2 @@ "repository": { | ||
"aws4": "^1.2.1", | ||
"bl": "~1.1.2", | ||
"caseless": "~0.11.0", | ||
@@ -34,3 +33,3 @@ "combined-stream": "~1.0.5", | ||
"forever-agent": "~0.6.1", | ||
"form-data": "~2.0.0", | ||
"form-data": "~2.1.1", | ||
"har-validator": "~2.0.6", | ||
@@ -45,3 +44,3 @@ "hawk": "~3.1.3", | ||
"oauth-sign": "~0.8.1", | ||
"qs": "~6.2.0", | ||
"qs": "~6.3.0", | ||
"stringstream": "~0.0.4", | ||
@@ -48,0 +47,0 @@ "tough-cookie": "~2.3.0", |
108
request.js
@@ -9,3 +9,2 @@ 'use strict' | ||
, zlib = require('zlib') | ||
, bl = require('bl') | ||
, hawk = require('hawk') | ||
@@ -740,2 +739,7 @@ , aws2 = require('aws-sign2') | ||
// node v6.8.0 now supports a `timeout` value in `http.request()`, but we | ||
// should delete it for now since we handle timeouts manually for better | ||
// consistency with node versions before v6.8.0 | ||
delete reqOptions.timeout | ||
try { | ||
@@ -752,34 +756,8 @@ self.req = self.httpModule.request(reqOptions) | ||
var timeout | ||
if (self.timeout && !self.timeoutTimer) { | ||
var timeout = self.timeout < 0 ? 0 : self.timeout | ||
// Set a timeout in memory - this block will throw if the server takes more | ||
// than `timeout` to write the HTTP status and headers (corresponding to | ||
// the on('response') event on the client). NB: this measures wall-clock | ||
// time, not the time between bytes sent by the server. | ||
self.timeoutTimer = setTimeout(function () { | ||
var connectTimeout = self.req.socket && self.req.socket.readable === false | ||
self.abort() | ||
var e = new Error('ETIMEDOUT') | ||
e.code = 'ETIMEDOUT' | ||
e.connect = connectTimeout | ||
self.emit('error', e) | ||
}, timeout) | ||
if (self.req.setTimeout) { // only works on node 0.6+ | ||
// Set an additional timeout on the socket, via the `setsockopt` syscall. | ||
// This timeout sets the amount of time to wait *between* bytes sent | ||
// from the server, and may or may not correspond to the wall-clock time | ||
// elapsed from the start of the request. | ||
// | ||
// In particular, it's useful for erroring if the server fails to send | ||
// data halfway through streaming a response. | ||
self.req.setTimeout(timeout, function () { | ||
if (self.req) { | ||
self.req.abort() | ||
var e = new Error('ESOCKETTIMEDOUT') | ||
e.code = 'ESOCKETTIMEDOUT' | ||
e.connect = false | ||
self.emit('error', e) | ||
} | ||
}) | ||
if (self.timeout < 0) { | ||
timeout = 0 | ||
} else if (typeof self.timeout === 'number' && isFinite(self.timeout)) { | ||
timeout = self.timeout | ||
} | ||
@@ -794,2 +772,35 @@ } | ||
self.req.on('socket', function(socket) { | ||
if (timeout !== undefined) { | ||
socket.once('connect', function() { | ||
clearTimeout(self.timeoutTimer) | ||
self.timeoutTimer = null | ||
// Set an additional timeout on the socket, via the `setsockopt` syscall. | ||
// This timeout sets the amount of time to wait *between* bytes sent | ||
// from the server once connected. | ||
// | ||
// In particular, it's useful for erroring if the server fails to send | ||
// data halfway through streaming a response. | ||
self.req.setTimeout(timeout, function () { | ||
if (self.req) { | ||
self.abort() | ||
var e = new Error('ESOCKETTIMEDOUT') | ||
e.code = 'ESOCKETTIMEDOUT' | ||
e.connect = false | ||
self.emit('error', e) | ||
} | ||
}) | ||
}) | ||
// Set a timeout in memory - this block will throw if the server takes more | ||
// than `timeout` to write the HTTP status and headers (corresponding to | ||
// the on('response') event on the client). NB: this measures wall-clock | ||
// time, not the time between bytes sent by the server. | ||
self.timeoutTimer = setTimeout(function () { | ||
self.abort() | ||
var e = new Error('ETIMEDOUT') | ||
e.code = 'ETIMEDOUT' | ||
e.connect = true | ||
self.emit('error', e) | ||
}, timeout) | ||
} | ||
self.emit('socket', socket) | ||
@@ -900,3 +911,3 @@ }) | ||
response.on('end', function () { | ||
response.once('end', function () { | ||
self._ended = true | ||
@@ -973,3 +984,3 @@ }) | ||
}) | ||
responseContent.on('end', function (chunk) { | ||
responseContent.once('end', function (chunk) { | ||
self.emit('end', chunk) | ||
@@ -1002,10 +1013,12 @@ }) | ||
debug('reading response\'s body') | ||
var buffer = bl() | ||
var buffers = [] | ||
, bufferLength = 0 | ||
, strings = [] | ||
self.on('data', function (chunk) { | ||
if (Buffer.isBuffer(chunk)) { | ||
buffer.append(chunk) | ||
} else { | ||
if (!Buffer.isBuffer(chunk)) { | ||
strings.push(chunk) | ||
} else if (chunk.length) { | ||
bufferLength += chunk.length | ||
buffers.push(chunk) | ||
} | ||
@@ -1019,18 +1032,17 @@ }) | ||
// This can lead to leaky behavior if the user retains a reference to the request object. | ||
buffer.destroy() | ||
buffers = [] | ||
bufferLength = 0 | ||
return | ||
} | ||
if (buffer.length) { | ||
debug('has body', self.uri.href, buffer.length) | ||
if (self.encoding === null) { | ||
// response.body = buffer | ||
// can't move to this until https://github.com/rvagg/bl/issues/13 | ||
response.body = buffer.slice() | ||
} else { | ||
response.body = buffer.toString(self.encoding) | ||
if (bufferLength) { | ||
debug('has body', self.uri.href, bufferLength) | ||
response.body = Buffer.concat(buffers, bufferLength) | ||
if (self.encoding !== null) { | ||
response.body = response.body.toString(self.encoding) | ||
} | ||
// `buffer` is defined in the parent scope and used in a closure it exists for the life of the Request. | ||
// This can lead to leaky behavior if the user retains a reference to the request object. | ||
buffer.destroy() | ||
buffers = [] | ||
bufferLength = 0 | ||
} else if (strings.length) { | ||
@@ -1037,0 +1049,0 @@ // The UTF8 BOM [0xEF,0xBB,0xBF] is converted to [0xFE,0xFF] in the JS UTC16/UCS2 representation. |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
196706
20
2384
+ Addedform-data@2.1.4(transitive)
+ Addedqs@6.3.3(transitive)
- Removedbl@~1.1.2
- Removedbl@1.1.2(transitive)
- Removedcore-util-is@1.0.3(transitive)
- Removedform-data@2.0.0(transitive)
- Removedinherits@2.0.4(transitive)
- Removedisarray@1.0.0(transitive)
- Removedprocess-nextick-args@1.0.7(transitive)
- Removedqs@6.2.4(transitive)
- Removedreadable-stream@2.0.6(transitive)
- Removedstring_decoder@0.10.31(transitive)
- Removedutil-deprecate@1.0.2(transitive)
Updatedform-data@~2.1.1
Updatedqs@~6.3.0