Skip to content

Commit

Permalink
Allow non-TLS detection automatically for in-process conns without `A…
Browse files Browse the repository at this point in the history
…llowNonTLS` in config

Signed-off-by: Neil Twigg <neil@nats.io>
  • Loading branch information
neilalexander committed Jul 19, 2023
1 parent e9aa7ed commit d890d2f
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions server/server.go
Expand Up @@ -2678,8 +2678,9 @@ func (s *Server) createClientEx(conn net.Conn, inProcess bool) *client {

var pre []byte
// If we have both TLS and non-TLS allowed we need to see which
// one the client wants.
if !isClosed && opts.TLSConfig != nil && opts.AllowNonTLS {
// one the client wants. We'll always allow this for in-process
// connections.
if !isClosed && opts.TLSConfig != nil && (inProcess || opts.AllowNonTLS) {
pre = make([]byte, 4)
c.nc.SetReadDeadline(time.Now().Add(secondsToDuration(opts.TLSTimeout)))
n, _ := io.ReadFull(c.nc, pre[:])
Expand Down

0 comments on commit d890d2f

Please sign in to comment.