nojb / ocaml-imap

Lwt-compatible IMAP4rev1 client library for OCaml
https://nojb.github.io/ocaml-imap/imap
Other
40 stars 17 forks source link

parser expects spaces in envelope address lists #22

Closed phi-gamma closed 8 years ago

phi-gamma commented 9 years ago

From RFC 3501:

address         = "(" addr-name SP addr-adl SP addr-mailbox SP
                  addr-host ")"
…
env-bcc         = "(" 1*address ")" / nil
env-cc          = "(" 1*address ")" / nil
…
env-from        = "(" 1*address ")" / nil
…
env-reply-to    = "(" 1*address ")" / nil
env-sender      = "(" 1*address ")" / nil
…
env-to          = "(" 1*address ")" / nil

However, the current parser expects address lists in the envelope to be separated by spaces (p_list). This breaks as soon as one of the cited fields contains multiple addresses. Here’s a patch that introduces a variation on the list pattern without spaces:

    https://gist.github.com/anonymous/d8dba7931b2d7484f5ee

If I apply this, ocaml-imap appears to fetch mailbox items pretty well =)

nojb commented 9 years ago

Great, Thanks! Would you like to open a pull request for your patch ? Or if you prefer I can apply the patch myself.

phi-gamma commented 9 years ago

Expect a PR later today.

phi-gamma commented 9 years ago

See https://github.com/nojb/ocaml-imap/pull/23 -- though I haven’t been able to run any further tests on it.

nojb commented 8 years ago

Closing this as it is resolved.