cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: Issue with IMAP UID FETCH

From: Dionysios Kalofonos <peitemou_at_gmail.com>
Date: Wed, 09 Apr 2014 09:11:49 +0300

On 4/8/14, 12:07 AM, Steve Holme wrote:
> On Mon, 7 Apr 2014, Dionysios Kalofonos wrote:
>
>> I am writing you regarding the IMAP API and in particular the FETCH
>> command.
>>
>> According to the curl_easy_setopt documentation a FETCH request
>> is made with the URL
>>
>> imap://user:password_at_mail.example.com/INBOX/;UID=1
>>
>> However, even though in the URL we set a UID the command issued is
>> FETCH 1 and not UID FETCH 1 which is inconsistent with the rfc3501.
>
> Unfortunately you are correct. Curl doen't implement the UID based commands
> at present. The IMAP protocol is still work-in-progress to a certain degree
> as I believe we have very few users* of and the current implementation is
> only a year old.
>
> Are the UID variants preferred over the non UID versions?

Ah, although it seems inconsistent at first the rfc5092 does allow a
standard FETCH in this case, my bad, quoting the rfc

The <iuid> refers to an IMAP4 message Unique Identifier (UID), and it
SHOULD be used as the <set> argument to the IMAP4 "UID FETCH"
command.

>
>> I then tried to make a UID FETCH request through a
>> CURLOPT_CUSTOMREQUEST. However, the response handler for
>> custom requests (see imap.c:imap_state_list_resp) cannot handle
>> the case where the response returns continuation data. For
>> example the custom request
>
> Currently all custom requests for IMAP overload the behaviour of a LIST
> command :(

If i wanted to fix this how would i go about it? I am not yet familiar
enough with the code.

>
> Whilst the URL handling in curl is based of RFC-5092 it doesn't implement it
> 100% at the moment. For example:
>
> * SEARCH command is via custom command at not URL query parameter
> * Doesn't support the <ipartial> keyword
> * Doesn't support <enc_mailbox> for EXAMINE custom request
>
> These are things that I would like to change so if you have any suggestions
> or ideas about how we may do this or fancy helping out with some patches
> that would be fantastic.

Studying this issue, i also noticed that curl implements the FETCH
request as

FETCH n BODY[...]

while the rfc5092 requires a BODY.PEEK, in detail

The <isection> field is optional. If not present, the URL refers to
the entire Internet message as returned by the IMAP command "UID
FETCH <uid> BODY.PEEK[]". If present, the URL refers to the object
returned by a "UID FETCH <uid> BODY.PEEK[<section>]" command.

I am more than happy to help.
Kind regards,

-- 
Dionysios Kalofonos
-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette:  http://curl.haxx.se/mail/etiquette.html
Received on 2014-04-09