File tree 2 files changed +4
-2
lines changed
2 files changed +4
-2
lines changed Original file line number Diff line number Diff line change 65
65
* Add `sum` to DUPLICATE_POLICY documentation of `TS.CREATE`, `TS.ADD` and `TS.ALTER`
66
66
* Prevent async ClusterPipeline instances from becoming "false-y" in case of empty command stack (#3061)
67
67
* Close Unix sockets if the connection attempt fails. This prevents `ResourceWarning`s. (#3314)
68
+ * Close SSL sockets if the connection attempt fails, or if validations fail. (#3317)
68
69
69
70
* 4.1.3 (Feb 8, 2022)
70
71
* Fix flushdb and flushall (#1926)
Original file line number Diff line number Diff line change @@ -819,7 +819,7 @@ def _connect(self):
819
819
sock = super ()._connect ()
820
820
try :
821
821
return self ._wrap_socket_with_ssl (sock )
822
- except OSError :
822
+ except ( OSError , RedisError ) :
823
823
sock .close ()
824
824
raise
825
825
@@ -854,7 +854,6 @@ def _wrap_socket_with_ssl(self, sock):
854
854
context .minimum_version = self .ssl_min_version
855
855
if self .ssl_ciphers :
856
856
context .set_ciphers (self .ssl_ciphers )
857
- sslsock = context .wrap_socket (sock , server_hostname = self .host )
858
857
if self .ssl_validate_ocsp is True and CRYPTOGRAPHY_AVAILABLE is False :
859
858
raise RedisError ("cryptography is not installed." )
860
859
@@ -864,6 +863,8 @@ def _wrap_socket_with_ssl(self, sock):
864
863
"- not both."
865
864
)
866
865
866
+ sslsock = context .wrap_socket (sock , server_hostname = self .host )
867
+
867
868
# validation for the stapled case
868
869
if self .ssl_validate_ocsp_stapled :
869
870
import OpenSSL
You can’t perform that action at this time.
0 commit comments