Skip to content
This repository has been archived by the owner on Oct 2, 2021. It is now read-only.

Support https protocol using any certificate #151

Merged
merged 1 commit into from
Jan 10, 2017
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import * as path from 'path';
import * as glob from 'glob';
import {Handles} from 'vscode-debugadapter';
import * as http from 'http';
import * as https from 'https';

import * as logger from './logger';

Expand Down Expand Up @@ -205,7 +206,11 @@ export function errP(msg: string|Error): Promise<never> {
*/
export function getURL(aUrl: string): Promise<string> {
return new Promise((resolve, reject) => {
http.get(aUrl, response => {
const parsedUrl = url.parse(aUrl);
const get = parsedUrl.protocol === 'https:' ? https.get : http.get;
const options = Object.assign({ rejectUnauthorized: false }, parsedUrl) as https.RequestOptions;

get(options, response => {
let responseData = '';
response.on('data', chunk => responseData += chunk);
response.on('end', () => {
Expand Down