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

Read bytes when fetching or uid_fetching. #33

Closed
wants to merge 1 commit into from

Conversation

vandenoever
Copy link
Contributor

@vandenoever vandenoever commented Mar 6, 2017

This returns raw bytes for each result as well as the id.

This is a first version of this patch. It {c,sh}ould have more error checking.

@vandenoever
Copy link
Contributor Author

I've checked this patch with DavMail, an IMAP proxy.

@dario23
Copy link

dario23 commented May 14, 2017

upon further testing of vandenoever:fetch, i have questions:

  • do i see it right that the regex in START_RE does not match all combinations of requests one can send using fetch/not all possible responses from the IMAP server?
  • more generally: would patches that use an actual parser (i'm thinking of https://github.com/Geal/nom) to read the IMAP server response be welcome?

@vandenoever
Copy link
Contributor Author

@dario23 yes, the matching is certainly not perfect, i made it to work with the server that I use, davmail.

@jonhoo
Copy link
Collaborator

jonhoo commented Oct 1, 2017

Having thought about this for a little while, now, I'm not convinced that the approach taken by this patch is the right one. Ultimately, the API should expose more structured responses (#28), but even then we'll want to expose String to the user for things like subjects and header values. I think the most ergonomic thing to do would be for the library to internally use the encoding crate to convert from the server's encoding, or that of individual messages, to regular UTF-8 strings.

Since that would likely be a lot of work, and would require changing the API significantly, I don't think accepting this PR would move things in the right direction. Instead, the easy way to deal with this is to use RFC5738's IMAP extensions (specifically, IMAP4rev1), which provides UTF-8 versions of commands that always return UTF-8 encoded responses. That would allow us to keep most of the code the same as it currently is, while working with servers that don't default to UTF-8.

I'd be happy to accept a PR for either of these (though realistically the second option is probably the one you should try out if you want to fix this), but will close this PR.

@jonhoo jonhoo closed this Oct 1, 2017
@dario23
Copy link

dario23 commented Oct 19, 2017

@jonhoo there are problems with re-coding content during server communication though, e.g. when verifying signatures/checksums, which won't match after re-coding to utf8

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.

3 participants