Repository navigation
Conversation
|
Thank you for the work. Feel free to close #147. |
|
Can this be merged into the gem? |
Add a new test case to confirm the current behavior. Commit fa68e64 fixed the handling of certificate identity check when connecting to an IP address, but the happy path is currently not covered by the test suite.
Add Net::HTTP#ssl_context to return the SSLContext used for HTTPS connections to allow users to configure it directly. Also change the existing SSL/TLS-related accessors to forward to the SSLContext instance directly rather than storing values in Net::HTTP's instance variables and applying them later in Net::HTTP#start. This avoids inconsistencies between, for example, http.cert_store and http.ssl_context.cert_store. The SSLContext instance is now reused for all connections made by a Net::HTTP instance. As a result, the SSLContext becomes frozen on the first connection attempt, and SSL/TLS-related options can no longer be changed afterward. Although I do not expect this to affect most users, it is technically a breaking change. [Feature #19641]
40107ee to
bf989e3
Compare
|
@nurse What do you think about this? |
|
At #372 (comment), @mame found that this would break at least one gem:
Also I just realized that the current change breaks I'll think if there is any way around. I still think the current approach using For now, let me change this PR to a draft because this is not ready to merge. |
Add
Net::HTTP#ssl_contextto return theSSLContextused for HTTPS connections, and reuse the same object for future connections made by the sameNet::HTTPinstance.Also change existing SSL/TLS-related accessors to interact with the
SSLContextdirectly, rather than temporarily storing values in instance variables and applying them later inNet::HTTP#start.Note that the
SSLContextbecomes frozen after the first connection is made using theNet::HTTPinstance. Although I do not expect this to affect most users, it is a compatibility concern.[Feature #19641] https://bugs.ruby-lang.org/issues/19641
/cc @shouichi
An alternative to #147. Instead of accepting user-supplied
SSLContext, this PR makesNet::HTTPprepareSSLContextearlier and expose it. This avoids ambiguity when bothNet::HTTPaccessors andSSLContextaccessors are used.This doesn't address my comment in the PR #147 (comment), but I think this incompatibility may be unavoidable. It should be documented in the release note.
This resolves #139 by allowing users to do the following: