Skip to content

βœ¨πŸ› Update BODYSTRUCTURE parser; add location; fix bugs#113

Merged
nevans merged 1 commit intomasterfrom
bodystructure-parse-fixes
Feb 12, 2023
Merged

βœ¨πŸ› Update BODYSTRUCTURE parser; add location; fix bugs#113
nevans merged 1 commit intomasterfrom
bodystructure-parse-fixes

Conversation

@nevans
Copy link
Copy Markdown
Collaborator

@nevans nevans commented Feb 12, 2023

n.b. this was split off from #104 as its own PR.

✨ Add missing "location" extension data.

This was missing from RFC2060 but part of RFC3501. It was also missing from Net::IMAP... until now! πŸ˜„

πŸ› Fix several bugs. Most importantly:

  • More strict about where NIL is not allowed, e.g: number, envelope, and body. Ignoring these uncommon bugs made it difficult to workaround much more common server bugs elsewhere.
  • πŸ—‘οΈ BodyTypeAttachment and BodyTypeExtension won't be returned any more and the constants have been deprecated.
  • Better workaround for multipart parts with... zero parts.

🚧 TODO: Although this will parse most strange BODYSTRUCTURE msg-att found in the wild, a future PR will backtrack on parse errors and try one or more "fool-proof" algorithms that partially parse nearly all invalid body structures sent by buggy servers... even in pathological cases, such as when servers send the message-id as a quoted string containing unescaped quotation marks!

  • ♻️ Add lookahead and peek methods to def_char_matchers, and peek_str?, peek_re, for matching without consuming and using MatchData.
  • ♻️ rename case_insensitive__string to match new parser style.
  • ♻️ add number64 aliases (size is unenforced)

✨ Add missing "location" extension data.

This was missing from RFC2060 but part of RFC3501.
It was also missing from Net::IMAP... until now! πŸ˜„

πŸ› Fix many bugs.  Most importantly:
* More strict about where NIL is allowed, e.g: `number`, `envelope`,
  and `body`.  Ignoring these rare server bugs made it difficult to
  workaround much more common server bugs elsewhere.
* BodyTypeAttachment and BodyTypeExtension won't be returned any more
  and the constants have been deprecated.
* Better workaround for multipart parts with... zero parts.

🚧 TODO: Although this will parse *most* strange BODYSTRUCTURE msg-att
found in the wild, a future PR will backtrack on parse errors and try
one or more "fool-proof" algorithms that partially parse *nearly* all
invalid body structures sent by buggy servers... even in pathological
cases, such as when servers send the message-id as a quoted string
containing unescaped quotation marks!

♻️ Add lookahead and peek methods to def_char_matchers, and peek_str?,
peek_re, for matching without consuming and using MatchData.
♻️ rename case_insensitive__string to match new parser style.
♻️ add number64 aliases. (size is unenforced)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

IMAP4rev1 Requirement for IMAP4rev1, RFC3501

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant