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
Add support for specifying an SSL CA path. #8
Conversation
| @@ -148,7 +149,7 @@ def transmit uri, req, payload, & block | |||
|
|
|||
| net = net_http_class.new(uri.host, uri.port) | |||
| net.use_ssl = uri.is_a?(URI::HTTPS) | |||
| net.ssl_version = @ssl_version | |||
| net.ssl_version = @ssl_version if RUBY_VERSION > '1.9' | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is the check for ruby 1.9 or greater necessary?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The Net::HTTP in Ruby 1.8 has no method ssl_version=. I'd be happy to implement the check in some other way.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Okay, that's a very good reason to check then. I'm not a committer BTW, just watching over the pull requests.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
net.ssl_version = @ssl_version if net.respond_to?(:ssl_version=)
What about that? Ugly, I know, but Ruby 1.8 will be retired in June anyway.
Are there consequences to ignoring the SSL version on 1.8?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That would be OK. The main reason I did the RUBY_VERSION check is that I wanted to make it clearer that ssl_version is not going to be passed to Net::HTTP. The patch as written does an additional check in the initializer to avoid setting @ssl_version, and you don't have access to a Net::HTTP object at that time.
It probably depends on your system SSL configuration. I expect that in general without a version it will allow SSLv2, which would be a security risk except that the vast majority of well-configured servers disallow SSLv2 anyway.
|
See rest-client#159. |
|
Administrative note: be mindful of rest-client#166 and rest-client#167. |
|
OK I'm going to clean this up and re-submit to rest-client/rest-client. Do you still want it to work on 1.8 or is rest-client planning to drop support entirely? |
|
I don't consider backwards compatibility with 1.8.x necessary. |
Net::HTTP already supports
ssl_ca_path; rest-client just needs to pass through the option.This also fixes SSL on rubies < 1.9. I couldn't get the tests running in the time I allocated for this, so they may be broken.