Skip to content

Commit

Permalink
Remove changes introduced in PR eclipse#319 (escaping % in server str…
Browse files Browse the repository at this point in the history
…ing). This change broke connections to AWS (and potentially other websocket providers) due to the use of parameters. Ref issues eclipse#479 and eclipse#469.

Signed-off-by: Matt Brittan <matt@brittan.nz>
  • Loading branch information
MattBrittan committed Jan 28, 2021
1 parent deddaa7 commit 74716b9
Showing 1 changed file with 0 additions and 3 deletions.
3 changes: 0 additions & 3 deletions options.go
Expand Up @@ -21,7 +21,6 @@ import (
"crypto/tls"
"net/http"
"net/url"
"regexp"
"strings"
"time"
)
Expand Down Expand Up @@ -137,14 +136,12 @@ func NewClientOptions() *ClientOptions {
//
// An example broker URI would look like: tcp://foobar.com:1883
func (o *ClientOptions) AddBroker(server string) *ClientOptions {
re := regexp.MustCompile(`%(25)?`)
if len(server) > 0 && server[0] == ':' {
server = "127.0.0.1" + server
}
if !strings.Contains(server, "://") {
server = "tcp://" + server
}
server = re.ReplaceAllLiteralString(server, "%25")
brokerURI, err := url.Parse(server)
if err != nil {
ERROR.Println(CLI, "Failed to parse %q broker address: %s", server, err)
Expand Down

0 comments on commit 74716b9

Please sign in to comment.