Skip to content

Commit 69b14f1

Browse files
Fix sslinline for connections after the first one.
The sslinline functionality would delete the required keys after upgrading the first connection. This commit adds the sslinine key to the isDriverSetting so that it is not sent to Posgres which would cause a crash. It also removes the delete of the keys necessary for sslinline to allow SSL upgrades for connections after the first one.
1 parent d076090 commit 69b14f1

File tree

2 files changed

+1
-9
lines changed

2 files changed

+1
-9
lines changed

conn.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1106,7 +1106,7 @@ func isDriverSetting(key string) bool {
11061106
return true
11071107
case "password":
11081108
return true
1109-
case "sslmode", "sslcert", "sslkey", "sslrootcert":
1109+
case "sslmode", "sslcert", "sslkey", "sslrootcert", "sslinline":
11101110
return true
11111111
case "fallback_application_name":
11121112
return true

ssl.go

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -59,9 +59,6 @@ func ssl(o values) (func(net.Conn) (net.Conn, error), error) {
5959
return nil, err
6060
}
6161

62-
// This pseudo-parameter is not recognized by the PostgreSQL server, so let's delete it after use.
63-
delete(o, "sslinline")
64-
6562
// Accept renegotiation requests initiated by the backend.
6663
//
6764
// Renegotiation was deprecated then removed from PostgreSQL 9.5, but
@@ -89,9 +86,6 @@ func sslClientCertificates(tlsConf *tls.Config, o values) error {
8986
sslinline := o["sslinline"]
9087
if sslinline == "true" {
9188
cert, err := tls.X509KeyPair([]byte(o["sslcert"]), []byte(o["sslkey"]))
92-
// Clear out these params, in case they were to be sent to the PostgreSQL server by mistake
93-
o["sslcert"] = ""
94-
o["sslkey"] = ""
9589
if err != nil {
9690
return err
9791
}
@@ -157,8 +151,6 @@ func sslCertificateAuthority(tlsConf *tls.Config, o values) error {
157151

158152
var cert []byte
159153
if sslinline == "true" {
160-
// // Clear out this param, in case it were to be sent to the PostgreSQL server by mistake
161-
o["sslrootcert"] = ""
162154
cert = []byte(sslrootcert)
163155
} else {
164156
var err error

0 commit comments

Comments
 (0)