Skip to content

Commit

Permalink
Prep for mixed mode
Browse files Browse the repository at this point in the history
Signed-off-by: Derek Collison <derek@nats.io>
  • Loading branch information
derekcollison committed Jun 6, 2020
1 parent fdbf7d6 commit fc6fed8
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion nats.go
Original file line number Diff line number Diff line change
Expand Up @@ -568,6 +568,7 @@ type serverInfo struct {
Version string `json:"version"`
AuthRequired bool `json:"auth_required"`
TLSRequired bool `json:"tls_required"`
TLSAvailable bool `json:"tls_available"`
Headers bool `json:"headers"`
MaxPayload int64 `json:"max_payload"`
ConnectURLs []string `json:"connect_urls,omitempty"`
Expand Down Expand Up @@ -1601,7 +1602,7 @@ func (nc *Conn) checkForSecure() error {
o := nc.Opts

// Check for mismatch in setups
if o.Secure && !nc.info.TLSRequired {
if o.Secure && !nc.info.TLSRequired && !nc.info.TLSAvailable {
return ErrSecureConnWanted
} else if nc.info.TLSRequired && !o.Secure {
// Switch to Secure since server needs TLS.
Expand Down

0 comments on commit fc6fed8

Please sign in to comment.