Re: [PATCH v2 2/2] send-email: introduce sendemail.smtpsslcertpath
From: Junio C Hamano <hidden>
Date: 2016-06-15 22:58:01
Jeff King [off-list ref] writes:
On Fri, Jul 05, 2013 at 08:29:48PM +0000, brian m. carlson wrote:quoted
On Fri, Jul 05, 2013 at 10:20:11AM -0700, Junio C Hamano wrote:quoted
+# Helper to come up with SSL/TLS certification validation params +# and warn when doing no verification +sub ssl_verify_params { + use IO::Socket::SSL qw(SSL_VERIFY_PEER SSL_VERIFY_NONE);You might as well put this at the top of the file, because all use statements happen at compile time anyway, regardless of their location. If you want to lazy-load this, you need to do: require IO::Socket::SSL; IO::Socket::SSL->import(qw(SSL_VERIFY_PEER SSL_VERIFY_NONE)); which is equivalent to "use" except that it happens at runtime.I think we _must_ lazy load this, or else we are breaking git-send-email users on platforms that do not have IO::Socket::SSL (and do not plan on using SSL themselves). The same goes for the "use" in patch 1/2.
A very good point. Thanks. Also it appears that people seem to be seeing different behaviours depending on the versions of IO::Socket::SSL they have; we may need to conditionalize what our code does depending on $PACKAGE::Version after we do that lazy loading.