Skip to content

Commit

Permalink
Fix host if we already had the port
Browse files Browse the repository at this point in the history
  • Loading branch information
ErikPelli committed Dec 27, 2024
1 parent 0d842e7 commit 606639f
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions websocket.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,9 @@ func (proxy *ProxyHttpServer) serveWebsocketTLS(
host, port, err := net.SplitHostPort(req.URL.Host)

Check failure on line 38 in websocket.go

View workflow job for this annotation

GitHub Actions / Build And Test Go code

ineffectual assignment to host (ineffassign)
if err != nil || port == "" {
host = net.JoinHostPort(req.URL.Host, "443")
} else {
// We already had a port, just use it
host = req.URL.Host
}
targetURL := url.URL{Scheme: "wss", Host: host, Path: req.URL.Path}

Expand Down Expand Up @@ -70,6 +73,9 @@ func (proxy *ProxyHttpServer) serveWebsocketHttpOverTLS(
host, port, err := net.SplitHostPort(req.URL.Host)

Check failure on line 73 in websocket.go

View workflow job for this annotation

GitHub Actions / Build And Test Go code

ineffectual assignment to host (ineffassign)
if err != nil || port == "" {
host = net.JoinHostPort(req.URL.Host, "80")
} else {
// We already had a port, just use it
host = req.URL.Host
}
targetURL := url.URL{Scheme: "ws", Host: host, Path: req.URL.Path}

Expand Down

0 comments on commit 606639f

Please sign in to comment.