mirror of
https://github.com/puppeteer/puppeteer
synced 2024-06-14 14:02:48 +00:00
fix(launcher): support https for browserURL endpoint (#4268)
Certain setups expose remote browser through an HTTPS proxy. This patch adds support for `https://` urls for `browserURL` option.
This commit is contained in:
parent
19606a3b79
commit
08e9a4ddaa
@ -16,6 +16,7 @@
|
||||
const os = require('os');
|
||||
const path = require('path');
|
||||
const http = require('http');
|
||||
const https = require('https');
|
||||
const URL = require('url');
|
||||
const removeFolder = require('rimraf');
|
||||
const childProcess = require('child_process');
|
||||
@ -382,8 +383,9 @@ function getWSEndpoint(browserURL) {
|
||||
const promise = new Promise((res, rej) => { resolve = res; reject = rej; });
|
||||
|
||||
const endpointURL = URL.resolve(browserURL, '/json/version');
|
||||
const protocol = endpointURL.startsWith('https') ? https : http;
|
||||
const requestOptions = Object.assign(URL.parse(endpointURL), { method: 'GET' });
|
||||
const request = http.request(requestOptions, res => {
|
||||
const request = protocol.request(requestOptions, res => {
|
||||
let data = '';
|
||||
if (res.statusCode !== 200) {
|
||||
// Consume response data to free up memory.
|
||||
|
Loading…
Reference in New Issue
Block a user