Skip to content

Commit

Permalink
fix(launcher): support https for browserURL endpoint (#4268)
Browse files Browse the repository at this point in the history
Certain setups expose remote browser through an HTTPS proxy. This patch
adds support for `https://` urls for `browserURL` option.
  • Loading branch information
sbekrin authored and aslushnikov committed Apr 11, 2019
1 parent 19606a3 commit 08e9a4d
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion lib/Launcher.js
Expand Up @@ -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');
Expand Down Expand Up @@ -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.
Expand Down

0 comments on commit 08e9a4d

Please sign in to comment.