Skip to content

Commit

Permalink
feat: remove proxy support code
Browse files Browse the repository at this point in the history
make-fetch-happen already has proxy support
  • Loading branch information
imatlopez committed Sep 13, 2020
1 parent 3f0574f commit bda6424
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 106 deletions.
18 changes: 4 additions & 14 deletions lib/install.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ const semver = require('semver')
const fetch = require('make-fetch-happen')
const processRelease = require('./process-release')
const win = process.platform === 'win32'
const getProxyFromURI = require('./proxy')
const streamPipeline = require('util').promisify(stream.pipeline)

/**
Expand Down Expand Up @@ -341,27 +340,18 @@ async function download (gyp, env, url) {

const requestOpts = {
headers: {
'User-Agent': 'node-gyp v' + gyp.version + ' (node ' + process.version + ')',
'User-Agent': `node-gyp v${gyp.version} (node ${process.version})`,
Connection: 'keep-alive'
}
},
proxy: gyp.opts.proxy,
noProxy: gyp.opts.noproxy
}

const cafile = gyp.opts.cafile
if (cafile) {
requestOpts.ca = await readCAFile(cafile)
}

// basic support for a proxy server
const proxyUrl = getProxyFromURI(gyp, env, url)
if (proxyUrl) {
if (/^https?:\/\//i.test(proxyUrl)) {
log.verbose('download', 'using proxy url: "%s"', proxyUrl)
requestOpts.proxy = proxyUrl
} else {
log.warn('download', 'ignoring invalid "proxy" config setting: "%s"', proxyUrl)
}
}

const res = await fetch(url, requestOpts)
log.http(res.status, res.url)

Expand Down
92 changes: 0 additions & 92 deletions lib/proxy.js

This file was deleted.

0 comments on commit bda6424

Please sign in to comment.