Skip to content

🔍 Add more detail to Net::IMAP#inspect TLS info#674

Open
nevans wants to merge 1 commit intomasterfrom
improved-inspect-tls-state
Open

🔍 Add more detail to Net::IMAP#inspect TLS info#674
nevans wants to merge 1 commit intomasterfrom
improved-inspect-tls-state

Conversation

@nevans
Copy link
Copy Markdown
Collaborator

@nevans nevans commented May 5, 2026

Previously, the existence of ssl_ctx would cause TLS (NOT VERIFIED) to be output. But that isn't quite right: ssl_ctx is assigned immediately, before sending the STARTTLS command, before calling start_tls_session, and before start_tls_session returns. And those intermediate states are important distinctions for debugging TLS issues.

So this updates Net::IMAP#inspect with two new TLS/PLAINTEXT states:

  • PLAINTEXT (TLS NOT STARTED), when:
    • #starttls has been called (@ssl_ctx has been set),
    • but #start_tls_session hasn't (@sock is a TCPSocket).
  • TLS (NOT ESTABLISHED), when:
    • #start_tls_session was called (@sock is an SSLSocket),
    • but hasn't returned successfully (@sock.session isn't available).

Previously, the existance of `ssl_ctx` would cause `TLS (NOT VERIFIED)`
to be printed.  But that isn't quite right: `ssl_ctx` is assigned
immediately, before sending the `STARTTLS` command, before calling
`start_tls_session`, and before `start_tls_session` returns.  And those
intermediate states are important distinctions for debugging TLS issues.

So this updates `Net::IMAP#inspect` with two new TLS/PLAINTEXT states:
* `PLAINTEXT (TLS NOT STARTED)`, when:
  * `#starttls` has been called (`@ssl_ctx` has been set),
  * but `#start_tls_session` hasn't (`@sock` is a `TCPSocket`).
* `TLS (NOT ESTABLISHED)`, when:
  * `#start_tls_session` was called (`@sock` is an `SSLSocket`),
  * but hasn't returned successfully (`@sock.session` isn't available).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant