Skip to content

Conversation

nevans
Copy link

@nevans nevans commented Oct 18, 2023

This adds support for asking a POP server about its capabilities (RFC2449).

  • Adds Net::POP3Command#capa, which issues the CAPA command and encodes the result as a hash of {tag => params for tag, *params in each_list_item}. Tags and params are both upcased, to simplify case insensitive matching.
  • Adds Net::POP3#capabilities, which caches the result from command.capa.
  • Adds Net::POP3#capable?, which returns whether #capabilities includes a specific tag and param.
  • Adds Net::POP3#clear_cached_capabilities, which clears the capabilities cache.
  • Adds Net::POP3#sasl_capable? and Net::POP3#sasl_mechanisms, which query support of the "SASL" capabability.

Note that the STLS extension modifies the CAPA requirements. If support is added for STLS, the capabilities cache must be reset.


This is needed in order to properly support SASL authentication using the AUTH command (RFC5034).

And a basic SASL implementation should be the basis for supporting OAuth2 (whether via the non-standard XOAUTH2 SASL mechanism or the standard OAUTHBEARER SASL mechanism). Therefore, CAPA is a requirement for proper implementation of OAuth2.

@nevans nevans force-pushed the add-capabilities branch 2 times, most recently from 8c6f61a to cdd0592 Compare October 18, 2023 02:39
@nevans nevans mentioned this pull request Jun 7, 2024
@nevans nevans force-pushed the add-capabilities branch 2 times, most recently from cbb780b to 81e6062 Compare June 23, 2024 12:24
@nevans
Copy link
Author

nevans commented Jun 23, 2024

I rebased this and changed it a little. Now it only add the #capa method to POP3Command, and the other methods are implemented directly on POP3.

Add Net::POP3Command#capa, which issues the CAPA command and encodes the
result as a hash of {tag => param for tag, param in each_list_item}.
tags and params are both upcased, to simplify case insensitive matching.

Add Net::POP3#capabilities, which caches the result from `command.capa`.

Add Net::POP3#capable?, which returns whether #capabilities includes
a specific `tag` and `param`.

Add Net::POP3#clear_cached_capabilities, which clears the capabilities
cache.

Add Net::POP3#sasl_capable? and Net::POP3#sasl_mechanisms, which query
support of the "SASL" capabability.

Note that the `STLS` extension modifies the CAPA requirements.  When
support is added for `STLS`, the capabilities cache must be reset.
@nevans nevans force-pushed the add-capabilities branch from 81e6062 to 46d1a8a Compare June 24, 2024 00:34
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