-
Notifications
You must be signed in to change notification settings - Fork 923
Don't panic in SSL code #734
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
e07bd0f
to
dac763b
Compare
ssl.go
Outdated
@@ -12,7 +12,7 @@ import ( | |||
|
|||
// ssl generates a function to upgrade a net.Conn based on the "sslmode" and | |||
// related settings. The function is nil when no upgrade should take place. | |||
func ssl(o values) func(net.Conn) net.Conn { | |||
func ssl(o values) (f func(net.Conn) (net.Conn, error), err error) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What's the reason to use a named return here? I don't see one. Ditto below.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Removed.
ssl.go
Outdated
@@ -31,7 +31,7 @@ func ssl(o values) func(net.Conn) net.Conn { | |||
// behavior is discouraged, and applications that need certificate | |||
// validation should always use verify-ca or verify-full. | |||
if sslrootcert, ok := o["sslrootcert"]; ok { | |||
if _, err := os.Stat(sslrootcert); err == nil { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should stay since the err
here is definitely not the same as the one in the return.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
This change removes panics from SSL code. This is a part of the ongoing process of removing panics from lib/pq code. Refs lib#681.
@mjibson PTAL. |
Quite late for a review, but I wanted to mention that this line is partly why I left the panics alone: |
This change removes panics from SSL code. This is a part of the ongoing process of removing panics from lib/pq code.
Refs #681.