Skip to content
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

Closed
wants to merge 2 commits into from
Closed

Conversation

ab
Copy link

@ab ab commented Jan 16, 2013

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.

@@ -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'
Copy link

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?

Copy link
Author

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.

Copy link

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.

Copy link
Owner

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?

Copy link
Author

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.

@ghost ghost assigned L2G Mar 5, 2013
@L2G
Copy link
Owner

L2G commented Mar 8, 2013

See rest-client#159.

@L2G
Copy link
Owner

L2G commented Mar 24, 2013

Administrative note: be mindful of rest-client#166 and rest-client#167.

@ab
Copy link
Author

ab commented Jul 26, 2013

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?

@L2G
Copy link
Owner

L2G commented Jul 28, 2013

I don't consider backwards compatibility with 1.8.x necessary.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants