-
Notifications
You must be signed in to change notification settings - Fork 96
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
imap fetch command response parsing #135
Comments
For the test purposes, I am using Dovecot, Gmail, Outlook, Zoho, Yahoo, Vkontakte servers. So far, I did not see such case, but I will take a more detailed look with UIDs. |
Thank you for replying! $ openssl s_client -connect imap.naver.com:993 -quiet
... # login, select
3 UID FETCH 38 (RFC822) # request UID FETCH command
# receive data
* 1 FETCH (RFC822 {1998} # untagged response
... # mime data
UID 38) # receive UID data after RFC822 data
3 OK Fetch completed. # tagged response i searched rfc document but i cannot find that |
As you know, if imap client send
UID FETCH
command, then imap server must sendUID
data in the response.https://www.rfc-editor.org/rfc/rfc3501#section-6.4.8
However there is no rule which specifies the order between
UID
and other data(RFC822
orRFC822.HEADER
).For example, if client send
123 UID FETCH 10 (RFC822)\r\n
command, imap server can send following responses.(
123
is tag,10
is uid)RFC822
data afterUID
data* 3 FETCH (UID 10 RFC822 {6}\r\n
3
is message sequence numberabcd\r\n
)\r\n
123 OK Fetch completed.\r\n
UID
data afterRFC822
data* 3 FETCH (RFC822 {6}\r\n
3
is message sequence numberabcd\r\n
UID 10)\r\n
123 OK Fetch completed.\r\n
The second case cannot be covered by the current mailio:imap::fetch function logic because it gets out of
for loop
(checking if requested tokens exist or not) when it metRFC822
token.So even though it gets
UID
data after receiving literal response, it can't parseUID
data.This case actually happens often.
So... i recommend to parse response after receiving all responses is completed(until
parenthesis_list_counter_
becomes 0).The text was updated successfully, but these errors were encountered: