Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

make-fetch-happen

Package Overview
Dependencies
Maintainers
1
Versions
109
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

make-fetch-happen - npm Package Compare versions

Comparing version 2.2.6 to 2.3.0

35

agent.js

@@ -21,2 +21,4 @@ 'use strict'

: '>no-proxy<',
`local-address:${opts.localAddress || '>no-local-address<'}`,
`strict-ssl:${isHttps ? !!opts.strictSSL : '>no-strict-ssl<'}`,
`ca:${(isHttps && opts.ca) || '>no-ca<'}`,

@@ -50,5 +52,8 @@ `cert:${(isHttps && opts.cert) || '>no-cert<'}`,

cert: opts.cert,
key: opts.key
key: opts.key,
localAddress: opts.localAddress,
rejectUnauthorized: opts.strictSSL
}) : new HttpAgent({
maxSockets: opts.maxSockets || 15
maxSockets: opts.maxSockets || 15,
localAddress: opts.localAddress
})

@@ -59,5 +64,18 @@ AGENT_CACHE.set(key, agent)

function checkNoProxy (uri) {
// TODO
return false
function checkNoProxy (uri, opts) {
const host = url.parse(uri).hostname.split('.').reverse()
let noproxy = (opts.noProxy || getProcessEnv('no_proxy'))
if (typeof noproxy === 'string') {
noproxy = noproxy.split(/\s*,\s*/g)
}
return noproxy && noproxy.some(no => {
const noParts = no.split('.').filter(x => x).reverse()
if (!noParts.length) { return false }
for (let i = 0; i < noParts.length; i++) {
if (host[i] !== noParts[i]) {
return false
}
}
return true
})
}

@@ -98,6 +116,7 @@

)
if (!proxy) { return null }
const parsedProxy = (typeof proxy === 'string') ? url.parse(proxy) : proxy
return !checkNoProxy(uri) && parsedProxy
return !checkNoProxy(uri, opts) && parsedProxy
}

@@ -117,3 +136,5 @@

key: opts.key,
maxSockets: opts.maxSockets || 15
localAddress: opts.localAddress,
maxSockets: opts.maxSockets || 15,
rejectUnauthorized: opts.strictSSL
}

@@ -120,0 +141,0 @@

@@ -5,2 +5,13 @@ # Change Log

<a name="2.3.0"></a>
# [2.3.0](https://github.com/zkat/make-fetch-happen/compare/v2.2.6...v2.3.0) (2017-04-27)
### Features
* **agent:** added opts.strictSSL and opts.localAddress ([c35015a](https://github.com/zkat/make-fetch-happen/commit/c35015a))
* **proxy:** Added opts.noProxy and NO_PROXY support ([f45c915](https://github.com/zkat/make-fetch-happen/commit/f45c915))
<a name="2.2.6"></a>

@@ -7,0 +18,0 @@ ## [2.2.6](https://github.com/zkat/make-fetch-happen/compare/v2.2.5...v2.2.6) (2017-04-26)

2

package.json
{
"name": "make-fetch-happen",
"version": "2.2.6",
"version": "2.3.0",
"description": "Opinionated, caching, retrying fetch client",

@@ -5,0 +5,0 @@ "main": "index.js",

@@ -26,2 +26,3 @@ # make-fetch-happen [![npm version](https://img.shields.io/npm/v/make-fetch-happen.svg)](https://npm.im/make-fetch-happen) [![license](https://img.shields.io/npm/l/make-fetch-happen.svg)](https://npm.im/make-fetch-happen) [![Travis](https://img.shields.io/travis/zkat/make-fetch-happen.svg)](https://travis-ci.org/zkat/make-fetch-happen) [![AppVeyor](https://ci.appveyor.com/api/projects/status/github/zkat/make-fetch-happen?svg=true)](https://ci.appveyor.com/project/zkat/make-fetch-happen) [![Coverage Status](https://coveralls.io/repos/github/zkat/make-fetch-happen/badge.svg?branch=latest)](https://coveralls.io/github/zkat/make-fetch-happen?branch=latest)

* [`opts.proxy`](#opts-proxy)
* [`opts.noProxy`](#opts-no-proxy)
* [`opts.ca, opts.cert, opts.key`](#https-opts)

@@ -141,3 +142,5 @@ * [`opts.maxSockets`](#opts-max-sockets)

* [`opts.proxy`](#opts-proxy) - Proxy agent
* [`opts.ca, opts.cert, opts.key`](#https-opts)
* [`opts.noProxy`](#opts-no-proxy) - Domain segments to disable proxying for.
* [`opts.ca, opts.cert, opts.key, opts.strictSSL`](#https-opts)
* [`opts.localAddress`](#opts-local-address)
* [`opts.maxSockets`](#opts-max-sockets)

@@ -290,9 +293,21 @@ * [`opts.retry`](#opts-retry) - Request retry settings

#### <a name="https-opts"></a> `> opts.ca, opts.cert, opts.key`
#### <a name="opts-no-proxy"></a> `> opts.noProxy`
If present, should be a comma-separated string or an array of domain extensions
that a proxy should _not_ be used for.
This option may also be provided through `process.env.NO_PROXY`.
#### <a name="https-opts"></a> `> opts.ca, opts.cert, opts.key, opts.strictSSL`
These values are passed in directly to the HTTPS agent and will be used for both
proxied and unproxied outgoing HTTPS requests. They correspond to the same
options the `https` module accepts, which will be themselves passed to
`tls.connect()`.
proxied and unproxied outgoing HTTPS requests. They mostly correspond to the
same options the `https` module accepts, which will be themselves passed to
`tls.connect()`. `opts.strictSSL` corresponds to `rejectUnauthorized`.
#### <a name="opts-local-address"></a> `> opts.localAddress`
Passed directly to `http` and `https` request calls. Determines the local
address to bind to.
#### <a name="opts-max-sockets"></a> `> opts.maxSockets`

@@ -299,0 +314,0 @@

SocketSocket SOC 2 Logo

Product

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

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc