-
Notifications
You must be signed in to change notification settings - Fork 29
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
SSL configuration always occurs even when connecting to HTTP #37
Comments
Thank you for reporting this issue @ma2gedev, agree it's worth taking a closer look and it should be relatively straightforward to fix. |
`env[:ssl]` is an instance of `Faraday::SSLOptions`, and as a result, `configure_ssl` is always executed, even when the connection is to HTTP. Fixes lostisland#37
`env[:ssl]` is an instance of `Faraday::SSLOptions`, and as a result, `configure_ssl` is always executed, even when the connection is to HTTP. Fixes lostisland#37
Thank you for your reply. I just created a PR #38 . Could you please review it? Thank you in advance. |
`env[:ssl]` is an instance of `Faraday::SSLOptions`, and as a result, `configure_ssl` is always executed, even when the connection is to HTTP. Fixes lostisland#37
`env[:ssl]` is an instance of `Faraday::SSLOptions`, and as a result, `configure_ssl` is always executed, even when the connection is to HTTP. Fixes #37
Description
Even when connecting to HTTP, the initialization of the cert store (
OpenSSL::X509::Store.new
) always occurs. Depending on the environment, this unnecessary initialization process could lead to performance degradation.In
Faraday::Adapter::NetHttp#configure_ssl
, there is a linereturn unless ssl
to return early. However, thessl
passed here is an instance ofFaraday::SSLOptions
, so the SSL configuration process always occurs without returning early.Environment information
faraday version: 2.10.0
faraday-net_http version: 3.1.0
Steps to reproduce
Perform a connection to http with the following code:
You can confirm that
OpenSSL::X509::Store.new
is always called.Expected result
When connecting to HTTP,
OpenSSL::X509::Store.new
should not be called.Reference information
It seems that other adapters also check whether it is https scheme when performing the ssl configuration process.
I think faraday-net_http also need to check whether the scheme is https as a condition for early return.
The text was updated successfully, but these errors were encountered: