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

Support starttls connections #1084

Closed
wants to merge 1 commit into from
Closed

Support starttls connections #1084

wants to merge 1 commit into from

Conversation

tonobo
Copy link

@tonobo tonobo commented Mar 15, 2017

Provide ability to serve "starttls_options", if set ssl will be disabled.

Provide ability to serve "starttls_options", if set ssl will be disabled.
Copy link
Collaborator

@jeremy jeremy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice addition. Needs test coverage!


imap = Net::IMAP.new(settings[:address], settings[:port], settings[:enable_ssl], nil, false)
tmp_ssl = settings[:enable_ssl]
tmp_ssl = false unless settings[:starttls_options].nil?
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since these options are mutually exclusive, we can raise an ArgumentError if both are set.

tmp_ssl = false unless settings[:starttls_options].nil?

imap = Net::IMAP.new(settings[:address], settings[:port], tmp_ssl, nil, false)
if settings[:starttls_options].is_a?(Hash)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Providing an options hash to enable/disable the feature is a bit awkward, particular if you don't need to set any options. Would expose this as a boolean: starttls: true


imap = Net::IMAP.new(settings[:address], settings[:port], tmp_ssl, nil, false)
if settings[:starttls_options].is_a?(Hash)
imap.starttls(settings[:starttls_options])
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These options aren't unique to STARTTLS. They're also used when SSL is enabled. Both establish a TLS session on the socket.

That suggests calling this tls_options: { … } and allowing it to be used in conjunction with both IMAPS and STARTTLS.

@jeremy
Copy link
Collaborator

jeremy commented May 22, 2017

#723

@jeremy jeremy closed this May 22, 2017
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

2 participants