mirror of
https://github.com/golang/go
synced 2024-11-18 08:44:43 -07:00
cmd/present: fix origin mismatch for websocket when using HTTPS
Fixes golang/go#31328 Change-Id: Ib190f42970d5b203e3f1fbf997aa896cf624bf91 Reviewed-on: https://go-review.googlesource.com/c/tools/+/171118 Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org> Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
This commit is contained in:
parent
539cdc44f8
commit
18e3458ac9
@ -77,6 +77,11 @@ func main() {
|
||||
|
||||
origin := &url.URL{Scheme: "http"}
|
||||
if *originHost != "" {
|
||||
if strings.HasPrefix(*originHost, "https://") {
|
||||
*originHost = strings.TrimPrefix(*originHost, "https://")
|
||||
origin.Scheme = "https"
|
||||
}
|
||||
*originHost = strings.TrimPrefix(*originHost, "http://")
|
||||
origin.Host = net.JoinHostPort(*originHost, port)
|
||||
} else if ln.Addr().(*net.TCPAddr).IP.IsUnspecified() {
|
||||
name, _ := os.Hostname()
|
||||
|
Loading…
Reference in New Issue
Block a user