File tree 1 file changed +9
-11
lines changed
1 file changed +9
-11
lines changed Original file line number Diff line number Diff line change @@ -94,6 +94,15 @@ func (cfg *Config) normalize() error {
94
94
cfg .Addr = ensureHavePort (cfg .Addr )
95
95
}
96
96
97
+ if cfg .tls != nil {
98
+ if cfg .tls .ServerName == "" && ! cfg .tls .InsecureSkipVerify {
99
+ host , _ , err := net .SplitHostPort (cfg .Addr )
100
+ if err == nil {
101
+ tlsConfig .ServerName = host
102
+ }
103
+ }
104
+ }
105
+
97
106
return nil
98
107
}
99
108
@@ -521,10 +530,6 @@ func parseDSNParams(cfg *Config, params string) (err error) {
521
530
if boolValue {
522
531
cfg .TLSConfig = "true"
523
532
cfg .tls = & tls.Config {}
524
- host , _ , err := net .SplitHostPort (cfg .Addr )
525
- if err == nil {
526
- cfg .tls .ServerName = host
527
- }
528
533
} else {
529
534
cfg .TLSConfig = "false"
530
535
}
@@ -538,13 +543,6 @@ func parseDSNParams(cfg *Config, params string) (err error) {
538
543
}
539
544
540
545
if tlsConfig := getTLSConfigClone (name ); tlsConfig != nil {
541
- if len (tlsConfig .ServerName ) == 0 && ! tlsConfig .InsecureSkipVerify {
542
- host , _ , err := net .SplitHostPort (cfg .Addr )
543
- if err == nil {
544
- tlsConfig .ServerName = host
545
- }
546
- }
547
-
548
546
cfg .TLSConfig = name
549
547
cfg .tls = tlsConfig
550
548
} else {
You can’t perform that action at this time.
0 commit comments