cURL / Mailing Lists / curl-library / Single Mail

curl-library

POP3 empty list problem & solution + DELE command + SMTP fix

From: Graeme Gill <graeme2_at_argyllcms.com>
Date: Tue, 12 Jul 2011 11:09:48 +1000

I'm trying to use libcurl to read mail from a POP3 mailbox,
and have come across an issue with the Curl_pop3_write()
function not detecting the end of body marker properly.

In curl 7.21.7 it's defined as "\r\n.\r\n", but this assumes
that there is at least one line of reply in the body to supply
the first "\r\n". For the LIST command when there are no
messages, this is not the case, and curl_easy_perform() hangs.

A side effect of this bug is that the final line looses its
"\r\n" ending.

Another problem is that the byte-stuffed sequence "\r\n.."
(ie. escaped EOB) is not being un-stuffed.

I also needed to add the DELE command, to be able to remove
mail messages once they have been read. Following the style of
the list option, I added a delete option CURLOPT_DELETE to allow this.

There is a minor problems in smtp.c too, to do with
EOB handling. If there is a . at the start of the first line
of the DATA body, it is not escaped properly and the data body
is lost. (This is not likely for useful data bodies, but I
include a fix along the same lines as the pop3 changes for
completeness.)

Attached is a set of patches based on 7.21.7.

cheers,

Graeme Gill.

-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette: http://curl.haxx.se/mail/etiquette.html

  • text/plain attachment: patch1
Received on 2011-07-12