Skip to content

Commit b20004a

Browse files
committed
Don't send '_server_host' attribute if unix socket is used
1 parent 61915a6 commit b20004a

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

connector.go

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,11 @@ func encodeConnectionAttributes(cfg *Config) string {
3434
connAttrsBuf = appendLengthEncodedString(connAttrsBuf, connAttrPlatformValue)
3535
connAttrsBuf = appendLengthEncodedString(connAttrsBuf, connAttrPid)
3636
connAttrsBuf = appendLengthEncodedString(connAttrsBuf, strconv.Itoa(os.Getpid()))
37-
connAttrsBuf = appendLengthEncodedString(connAttrsBuf, connAttrServerHost)
3837
serverHost, _, _ := net.SplitHostPort(cfg.Addr)
39-
connAttrsBuf = appendLengthEncodedString(connAttrsBuf, serverHost)
38+
if serverHost != "" {
39+
connAttrsBuf = appendLengthEncodedString(connAttrsBuf, connAttrServerHost)
40+
connAttrsBuf = appendLengthEncodedString(connAttrsBuf, serverHost)
41+
}
4042

4143
// user-defined connection attributes
4244
for _, connAttr := range strings.Split(cfg.ConnectionAttributes, ",") {

0 commit comments

Comments
 (0)