|
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 |
@@ -272,6 +273,11 @@ def self.detect_idle_timeout uri, max = 10 |
272 | 273 |
|
273 | 274 | attr_reader :ciphers |
274 | 275 |
|
| 276 | + ## |
| 277 | + # Extra certificates to be added to the certificate chain |
| 278 | + |
| 279 | + attr_reader :extra_chain_cert |
| 280 | + |
275 | 281 | ## |
276 | 282 | # Sends debug_output to this IO via Net::HTTP#set_debug_output. |
277 | 283 | # |
@@ -592,6 +598,21 @@ def ciphers= ciphers |
592 | 598 | reconnect_ssl |
593 | 599 | end |
594 | 600 |
|
| 601 | + if Net::HTTP.method_defined?(:extra_chain_cert=) |
| 602 | + ## |
| 603 | + # Extra certificates to be added to the certificate chain. |
| 604 | + # It is only supported starting from Net::HTTP version 0.1.1 |
| 605 | + def extra_chain_cert= extra_chain_cert |
| 606 | + @extra_chain_cert = extra_chain_cert |
| 607 | + |
| 608 | + reconnect_ssl |
| 609 | + end |
| 610 | + else |
| 611 | + def extra_chain_cert= _extra_chain_cert |
| 612 | + raise "extra_chain_cert= is not supported by this version of Net::HTTP" |
| 613 | + end |
| 614 | + end |
| 615 | + |
595 | 616 | ## |
596 | 617 | # Creates a new connection for +uri+ |
597 | 618 |
|
@@ -1043,6 +1064,10 @@ def ssl connection |
1043 | 1064 | connection.key = @private_key |
1044 | 1065 | end |
1045 | 1066 |
|
| 1067 | + if defined?(@extra_chain_cert) and @extra_chain_cert |
| 1068 | + connection.extra_chain_cert = @extra_chain_cert |
| 1069 | + end |
| 1070 | + |
1046 | 1071 | connection.cert_store = if @cert_store then |
1047 | 1072 | @cert_store |
1048 | 1073 | else |
|
0 commit comments