@@ -440,10 +440,26 @@ def self.detect_idle_timeout uri, max = 10
440
440
# SSL version to use.
441
441
#
442
442
# By default, the version will be negotiated automatically between client
443
- # and server. Ruby 1.9 and newer only.
443
+ # and server. Ruby 1.9 and newer only. Deprecated since Ruby 2.5.
444
444
445
445
attr_reader :ssl_version
446
446
447
+ ##
448
+ # Minimum SSL version to use, e.g. :TLS1_1
449
+ #
450
+ # By default, the version will be negotiated automatically between client
451
+ # and server. Ruby 2.5 and newer only.
452
+
453
+ attr_reader :min_version
454
+
455
+ ##
456
+ # Maximum SSL version to use, e.g. :TLS1_2
457
+ #
458
+ # By default, the version will be negotiated automatically between client
459
+ # and server. Ruby 2.5 and newer only.
460
+
461
+ attr_reader :max_version
462
+
447
463
##
448
464
# Where this instance's last-use times live in the thread local variables
449
465
@@ -533,6 +549,8 @@ def initialize name: nil, proxy: nil, pool_size: DEFAULT_POOL_SIZE
533
549
@private_key = nil
534
550
@ssl_timeout = nil
535
551
@ssl_version = nil
552
+ @min_version = nil
553
+ @max_version = nil
536
554
@verify_callback = nil
537
555
@verify_depth = nil
538
556
@verify_mode = nil
@@ -1044,6 +1062,8 @@ def ssl connection
1044
1062
connection . ciphers = @ciphers if @ciphers
1045
1063
connection . ssl_timeout = @ssl_timeout if @ssl_timeout
1046
1064
connection . ssl_version = @ssl_version if @ssl_version
1065
+ connection . min_version = @min_version if @min_version
1066
+ connection . max_version = @max_version if @max_version
1047
1067
1048
1068
connection . verify_depth = @verify_depth
1049
1069
connection . verify_mode = @verify_mode
@@ -1115,6 +1135,24 @@ def ssl_version= ssl_version
1115
1135
reconnect_ssl
1116
1136
end
1117
1137
1138
+ ##
1139
+ # Minimum SSL version to use
1140
+
1141
+ def min_version = min_version
1142
+ @min_version = min_version
1143
+
1144
+ reconnect_ssl
1145
+ end
1146
+
1147
+ ##
1148
+ # maximum SSL version to use
1149
+
1150
+ def max_version = max_version
1151
+ @max_version = max_version
1152
+
1153
+ reconnect_ssl
1154
+ end
1155
+
1118
1156
##
1119
1157
# Sets the depth of SSL certificate verification
1120
1158
0 commit comments