Socket
Socket
Sign inDemoInstall

got

Package Overview
Dependencies
19
Maintainers
2
Versions
175
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 2.3.0 to 2.3.1

38

index.js

@@ -9,3 +9,3 @@ 'use strict';

var duplexify = require('duplexify');
var isReadableStream = require('isstream').isReadable;
var isStream = require('is-stream');
var read = require('read-all-stream');

@@ -17,15 +17,14 @@ var timeout = require('timed-out');

if (typeof opts === 'function') {
// if `cb` has been specified but `opts` has not
cb = opts;
opts = {};
} else if (!opts) {
// opts has not been specified
opts = {};
}
// extract own options
var encoding = opts.encoding;
var body = opts.body;
var proxy;
var redirectCount = 0;
delete opts.encoding;
var body = opts.body;
delete opts.body;

@@ -39,3 +38,2 @@

// if no callback has been provided
var proxy;
if (!cb) {

@@ -50,3 +48,2 @@ proxy = duplexify();

// merge additional headers
opts.headers = assign({

@@ -57,5 +54,3 @@ 'user-agent': 'https://github.com/sindresorhus/got',

var redirectCount = 0;
var get = function (url, opts, cb) {
function get(url, opts, cb) {
var parsedUrl = urlLib.parse(prependHttp(url));

@@ -108,3 +103,5 @@ var fn = parsedUrl.protocol === 'https:' ? https : http;

read(res, encoding, cb, response);
read(res, encoding, function (err, data) {
cb.call(null, err, data, response);
});
}).once('error', cb);

@@ -117,3 +114,8 @@

if (!proxy) {
isReadableStream(body) ? body.pipe(req) : req.end(body);
if (isStream.readable(body)) {
body.pipe(req);
} else {
req.end(body);
}
return;

@@ -127,3 +129,8 @@ }

isReadableStream(body) ? body.pipe(req) : req.end(body);
if (isStream.readable(body)) {
body.pipe(req);
} else {
req.end(body);
}
return;

@@ -138,6 +145,5 @@ }

req.end();
};
}
get(url, opts, cb);
return proxy;

@@ -144,0 +150,0 @@ }

{
"name": "got",
"version": "2.3.0",
"version": "2.3.1",
"description": "Simplified HTTP/HTTPS requests",

@@ -42,7 +42,7 @@ "license": "MIT",

"duplexify": "^3.2.0",
"infinity-agent": "^0.1.0",
"isstream": "^0.1.1",
"infinity-agent": "^1.0.0",
"is-stream": "^1.0.0",
"object-assign": "^2.0.0",
"prepend-http": "^1.0.0",
"read-all-stream": "^0.1.0",
"read-all-stream": "^1.0.0",
"timed-out": "^2.0.0"

@@ -49,0 +49,0 @@ },

@@ -82,3 +82,3 @@ # got [![Build Status](https://travis-ci.org/sindresorhus/got.svg?branch=master)](https://travis-ci.org/sindresorhus/got)

Node HTTP/HTTPS [Agent in 0.10.35](https://github.com/joyent/node/blob/v0.10.35-release/lib/http.js#L1261) by default limits number of open sockets to 5 — which is a too low. By default `got` will use `new Agent({maxSockets: Infinity})` like new [`Agent` in 0.11.14](https://github.com/joyent/node/blob/v0.11.14-release/lib/_http_agent.js#L110).
Node HTTP/HTTPS Agent in [0.10](https://github.com/joyent/node/blob/v0.10.35-release/lib/http.js#L1261) by default limits number of open sockets to 5 — which is too low. If `options.agent` is not defined `got` will use [infinity-agent](https://github.com/floatdrop/infinity-agent) to backport `defaultMaxSockets` from [0.11](https://github.com/joyent/node/blob/v0.11.14-release/lib/_http_agent.js#L110).

@@ -85,0 +85,0 @@ [Why pooling is evil](https://github.com/substack/hyperquest#pooling-is-evil).

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc