|
65 | 65 | # #ca_path :: Directory with certificate-authorities |
66 | 66 | # #cert_store :: An SSL certificate store |
67 | 67 | # #ciphers :: List of SSl ciphers allowed |
| 68 | +# #extra_chain_cert :: Extra certificates to be added to the certificate chain |
68 | 69 | # #private_key :: The client's SSL private key |
69 | 70 | # #reuse_ssl_sessions :: Reuse a previously opened SSL session for a new |
70 | 71 | # connection |
@@ -270,6 +271,11 @@ def self.detect_idle_timeout uri, max = 10 |
270 | 271 |
|
271 | 272 | attr_reader :ciphers |
272 | 273 |
|
| 274 | + ## |
| 275 | + # Extra certificates to be added to the certificate chain |
| 276 | + |
| 277 | + attr_reader :extra_chain_cert |
| 278 | + |
273 | 279 | ## |
274 | 280 | # Sends debug_output to this IO via Net::HTTP#set_debug_output. |
275 | 281 | # |
@@ -574,6 +580,21 @@ def ciphers= ciphers |
574 | 580 | reconnect_ssl |
575 | 581 | end |
576 | 582 |
|
| 583 | + if Net::HTTP.method_defined?(:extra_chain_cert=) |
| 584 | + ## |
| 585 | + # Extra certificates to be added to the certificate chain. |
| 586 | + # It is only supported starting from Net::HTTP version 0.1.1 |
| 587 | + def extra_chain_cert= extra_chain_cert |
| 588 | + @extra_chain_cert = extra_chain_cert |
| 589 | + |
| 590 | + reconnect_ssl |
| 591 | + end |
| 592 | + else |
| 593 | + def extra_chain_cert= _extra_chain_cert |
| 594 | + raise "extra_chain_cert= is not supported by this version of Net::HTTP" |
| 595 | + end |
| 596 | + end |
| 597 | + |
577 | 598 | ## |
578 | 599 | # Creates a new connection for +uri+ |
579 | 600 |
|
@@ -1023,6 +1044,10 @@ def ssl connection |
1023 | 1044 | connection.key = @private_key |
1024 | 1045 | end |
1025 | 1046 |
|
| 1047 | + if defined?(@extra_chain_cert) and @extra_chain_cert |
| 1048 | + connection.extra_chain_cert = @extra_chain_cert |
| 1049 | + end |
| 1050 | + |
1026 | 1051 | connection.cert_store = if @cert_store then |
1027 | 1052 | @cert_store |
1028 | 1053 | else |
|
0 commit comments