@puppeteer/browsers
Advanced tools
Comparing version 1.4.4 to 1.4.5
@@ -46,3 +46,6 @@ "use strict"; | ||
const url_1 = require("url"); | ||
const proxy_agent_1 = require("proxy-agent"); | ||
const http_proxy_agent_1 = require("http-proxy-agent"); | ||
const https_proxy_agent_1 = require("https-proxy-agent"); | ||
const proxy_from_env_1 = require("proxy-from-env"); | ||
const socks_proxy_agent_1 = require("socks-proxy-agent"); | ||
function headHttpRequest(url) { | ||
@@ -60,2 +63,16 @@ return new Promise(resolve => { | ||
function httpRequest(url, method, response, keepAlive = true) { | ||
const proxy = (0, proxy_from_env_1.getProxyForUrl)(url.toString()); | ||
let agent; | ||
if (proxy) { | ||
const proxyUrl = new url_1.URL(proxy); | ||
if (proxyUrl.protocol === 'http:') { | ||
agent = new http_proxy_agent_1.HttpProxyAgent(proxyUrl); | ||
} | ||
else if (proxyUrl.protocol === 'https:') { | ||
agent = new https_proxy_agent_1.HttpsProxyAgent(proxyUrl); | ||
} | ||
else if (proxyUrl.protocol.startsWith('socks')) { | ||
agent = new socks_proxy_agent_1.SocksProxyAgent(proxyUrl); | ||
} | ||
} | ||
const options = { | ||
@@ -69,3 +86,3 @@ protocol: url.protocol, | ||
auth: (0, url_1.urlToHttpOptions)(url).auth, | ||
agent: new proxy_agent_1.ProxyAgent(), | ||
agent, | ||
}; | ||
@@ -72,0 +89,0 @@ const requestCallback = (res) => { |
@@ -20,3 +20,6 @@ /** | ||
import { URL, urlToHttpOptions } from 'url'; | ||
import { ProxyAgent } from 'proxy-agent'; | ||
import { HttpProxyAgent } from 'http-proxy-agent'; | ||
import { HttpsProxyAgent } from 'https-proxy-agent'; | ||
import { getProxyForUrl } from 'proxy-from-env'; | ||
import { SocksProxyAgent } from 'socks-proxy-agent'; | ||
export function headHttpRequest(url) { | ||
@@ -33,2 +36,16 @@ return new Promise(resolve => { | ||
export function httpRequest(url, method, response, keepAlive = true) { | ||
const proxy = getProxyForUrl(url.toString()); | ||
let agent; | ||
if (proxy) { | ||
const proxyUrl = new URL(proxy); | ||
if (proxyUrl.protocol === 'http:') { | ||
agent = new HttpProxyAgent(proxyUrl); | ||
} | ||
else if (proxyUrl.protocol === 'https:') { | ||
agent = new HttpsProxyAgent(proxyUrl); | ||
} | ||
else if (proxyUrl.protocol.startsWith('socks')) { | ||
agent = new SocksProxyAgent(proxyUrl); | ||
} | ||
} | ||
const options = { | ||
@@ -42,3 +59,3 @@ protocol: url.protocol, | ||
auth: urlToHttpOptions(url).auth, | ||
agent: new ProxyAgent(), | ||
agent, | ||
}; | ||
@@ -45,0 +62,0 @@ const requestCallback = (res) => { |
{ | ||
"name": "@puppeteer/browsers", | ||
"version": "1.4.4", | ||
"version": "1.4.5", | ||
"description": "Download and launch browsers", | ||
@@ -103,4 +103,7 @@ "scripts": { | ||
"extract-zip": "2.0.1", | ||
"http-proxy-agent": "7.0.0", | ||
"https-proxy-agent": "7.0.1", | ||
"progress": "2.0.3", | ||
"proxy-agent": "6.2.1", | ||
"proxy-from-env": "1.1.0", | ||
"socks-proxy-agent": "8.0.1", | ||
"tar-fs": "3.0.4", | ||
@@ -112,2 +115,3 @@ "unbzip2-stream": "1.4.3", | ||
"@types/node": "^16.11.7", | ||
"@types/proxy-from-env": "1.0.1", | ||
"@types/yargs": "17.0.22" | ||
@@ -114,0 +118,0 @@ }, |
@@ -22,3 +22,6 @@ /** | ||
import {ProxyAgent} from 'proxy-agent'; | ||
import {HttpProxyAgent} from 'http-proxy-agent'; | ||
import {HttpsProxyAgent} from 'https-proxy-agent'; | ||
import {getProxyForUrl} from 'proxy-from-env'; | ||
import {SocksProxyAgent} from 'socks-proxy-agent'; | ||
@@ -47,2 +50,16 @@ export function headHttpRequest(url: URL): Promise<boolean> { | ||
): http.ClientRequest { | ||
const proxy = getProxyForUrl(url.toString()); | ||
let agent: http.Agent | undefined; | ||
if (proxy) { | ||
const proxyUrl = new URL(proxy); | ||
if (proxyUrl.protocol === 'http:') { | ||
agent = new HttpProxyAgent(proxyUrl); | ||
} else if (proxyUrl.protocol === 'https:') { | ||
agent = new HttpsProxyAgent(proxyUrl); | ||
} else if (proxyUrl.protocol.startsWith('socks')) { | ||
agent = new SocksProxyAgent(proxyUrl); | ||
} | ||
} | ||
const options: http.RequestOptions = { | ||
@@ -56,3 +73,3 @@ protocol: url.protocol, | ||
auth: urlToHttpOptions(url).auth, | ||
agent: new ProxyAgent(), | ||
agent, | ||
}; | ||
@@ -59,0 +76,0 @@ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
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
Network access
Supply chain riskThis module accesses the network.
Found 2 instances 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
416952
7517
11
3
12
+ Addedhttp-proxy-agent@7.0.0
+ Addedhttps-proxy-agent@7.0.1
+ Addedproxy-from-env@1.1.0
+ Addedsocks-proxy-agent@8.0.1
+ Addedhttp-proxy-agent@7.0.0(transitive)
+ Addedhttps-proxy-agent@7.0.1(transitive)
+ Addedsocks-proxy-agent@8.0.1(transitive)
- Removedproxy-agent@6.2.1
- Removedacorn@8.14.0(transitive)
- Removedacorn-walk@8.3.4(transitive)
- Removedast-types@0.13.4(transitive)
- Removedbasic-ftp@5.0.5(transitive)
- Removeddata-uri-to-buffer@6.0.2(transitive)
- Removeddeep-is@0.1.4(transitive)
- Removeddegenerator@4.0.4(transitive)
- Removedescodegen@1.14.3(transitive)
- Removedesprima@4.0.1(transitive)
- Removedestraverse@4.3.0(transitive)
- Removedesutils@2.0.3(transitive)
- Removedfast-levenshtein@2.0.6(transitive)
- Removedfs-extra@11.2.0(transitive)
- Removedget-uri@6.0.3(transitive)
- Removedgraceful-fs@4.2.11(transitive)
- Removedhttp-proxy-agent@7.0.2(transitive)
- Removedhttps-proxy-agent@7.0.5(transitive)
- Removedip@1.1.9(transitive)
- Removedjsonfile@6.1.0(transitive)
- Removedlevn@0.3.0(transitive)
- Removedlru-cache@7.18.3(transitive)
- Removednetmask@2.0.2(transitive)
- Removedoptionator@0.8.3(transitive)
- Removedpac-proxy-agent@6.0.4(transitive)
- Removedpac-resolver@6.0.2(transitive)
- Removedprelude-ls@1.1.2(transitive)
- Removedproxy-agent@6.2.1(transitive)
- Removedsocks-proxy-agent@8.0.4(transitive)
- Removedsource-map@0.6.1(transitive)
- Removedtslib@2.8.1(transitive)
- Removedtype-check@0.3.2(transitive)
- Removeduniversalify@2.0.1(transitive)
- Removedvm2@3.9.19(transitive)
- Removedword-wrap@1.2.5(transitive)