Skip to content

Commit

Permalink
Merge pull request #638 from ChIoT-Tech/master
Browse files Browse the repository at this point in the history
Resolve issue introduced in PR #624 (Websocket authentication)  as per comment from @Tieske (previous version worked for the first, but not subsequent, connections)
  • Loading branch information
MattBrittan committed Mar 13, 2023
2 parents c1df6d0 + e3d0846 commit 5e01522
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions netconn.go
Expand Up @@ -40,13 +40,13 @@ import (
func openConnection(uri *url.URL, tlsc *tls.Config, timeout time.Duration, headers http.Header, websocketOptions *WebsocketOptions, dialer *net.Dialer) (net.Conn, error) {
switch uri.Scheme {
case "ws":
dialURI := uri // #623 - Gorilla Websockets does not accept URL's where uri.User != nil
uri.User = nil
dialURI := *uri // #623 - Gorilla Websockets does not accept URL's where uri.User != nil
dialURI.User = nil
conn, err := NewWebsocket(dialURI.String(), nil, timeout, headers, websocketOptions)
return conn, err
case "wss":
dialURI := uri // #623 - Gorilla Websockets does not accept URL's where uri.User != nil
uri.User = nil
dialURI := *uri // #623 - Gorilla Websockets does not accept URL's where uri.User != nil
dialURI.User = nil
conn, err := NewWebsocket(dialURI.String(), tlsc, timeout, headers, websocketOptions)
return conn, err
case "mqtt", "tcp":
Expand Down

0 comments on commit 5e01522

Please sign in to comment.