1
0
mirror of https://github.com/golang/go synced 2024-11-18 16:24:42 -07:00

cmd/present: support being reverse proxied from https

Fixes golang/go#21921

Change-Id: Idc6ff2773dcef7210ce4d0eecb7affb357a213b5
GitHub-Last-Rev: 50b959e9b6f2f1513235c5ca0124d80b487c5296
GitHub-Pull-Request: golang/tools#26
Reviewed-on: https://go-review.googlesource.com/96295
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
This commit is contained in:
peter zhang 2018-02-26 18:23:26 +00:00 committed by Brad Fitzpatrick
parent 2ae76fd156
commit 10db2d12cf
2 changed files with 12 additions and 2 deletions

View File

@ -118,7 +118,12 @@ function SocketTransport() {
var id = 0; var id = 0;
var outputs = {}; var outputs = {};
var started = {}; var started = {};
var websocket = new WebSocket('ws://' + window.location.host + '/socket'); var websocket;
if (window.location.protocol == "http:") {
websocket = new WebSocket('ws://' + window.location.host + '/socket');
} else if (window.location.protocol == "https:") {
websocket = new WebSocket('wss://' + window.location.host + '/socket');
}
websocket.onclose = function() { websocket.onclose = function() {
console.log('websocket connection closed'); console.log('websocket connection closed');

View File

@ -2314,7 +2314,12 @@ function SocketTransport() {
var id = 0; var id = 0;
var outputs = {}; var outputs = {};
var started = {}; var started = {};
var websocket = new WebSocket('ws://' + window.location.host + '/socket'); var websocket;
if (window.location.protocol == "http:") {
websocket = new WebSocket('ws://' + window.location.host + '/socket');
} else if (window.location.protocol == "https:") {
websocket = new WebSocket('wss://' + window.location.host + '/socket');
}
websocket.onclose = function() { websocket.onclose = function() {
console.log('websocket connection closed'); console.log('websocket connection closed');