cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: [PATCH] POP3: Expanded the supported commands

From: Dan Fandrich <dan_at_coneharvesters.com>
Date: Tue, 13 Mar 2012 23:52:00 +0100

On Sat, Mar 10, 2012 at 07:44:46PM +0000, Steve Holme wrote:
> I would appreciate it if you, Dan and anyone else who is interested could
> give the following list a little review. The list contains all the proposed
> command line arguments for all POP3 commands. I have only grouped them for
> easy of reading here, the code I have written doesn't treat them any
> differently (and in fact I have managed to keep the existing list and retr
> response functions, dropping the list single function).
>
> List Commands
>
> --url pop3://mail.domain.com OR --url pop3://mail.domain.com -X LIST
> --url pop3://mail.domain.com -X UIDL
>
> Single List Commands
>
> --url pop3://mail.domain.com/1 -l OR --url pop3://mail.domain.com -I -X
> "LIST 1"
> --url pop3://mail.domain.com -I -X "UIDL 1"
>
> Retrieve Type Commands
>
> --url pop3://mail.domain.com/1 OR --url pop3://mail.domain.com -X "RETR 1"
> --url pop3://mail.domain.com -X "TOP 1 0"
> --url pop3://mail.domain.com -X CAPA
>
> Instructional Type Commands
>
> --url pop3://mail.domain.com -I -X STAT
> --url pop3://mail.domain.com -I -X NOOP
> --url pop3://mail.domain.com -I -X "DELE 1"
> --url pop3://mail.domain.com -I -X RSET

This looks great to me!

> Obviously if a user was to specify the mailbox in the URL and perform -X
> "DELE 1" the mailbox in the URL is currently ignored. We could append the
> mailbox to the custom command which might be useful for LIST, UIDL and DELE
> but that would cause problems for TOP as you NEED to specify either 0 for
> "Just the headers" or the number of lines required from the message -
> However I am flexible here so any opinions would be appreciated.

I agree, this ends up being ugly no matter which way it's done. It would
be nice to be more HTTP-like and override JUST the command and get the
parameters from the URL, but that means extending the URL syntax to
handle the TOP case. And while HTTP was designed with a consistent syntax
consisting of command+URL, clearly POP-3 was not designed so
consistently. It's conceivable that a future POP-3 command could take 3
arguments, or 99 or be otherwise radically different and curl would
provide no way to send it. I don't see that leaving any choice but to
allow embedding the arguments into the command override as you've done.

We could still unconditionally append the mailbox in the URL to
the command, if it's present. So, delete could be done by either:

 --url pop3://mail.domain.com -I -X "DELE 1"

or

 --url pop3://mail.domain.com/1 -I -X DELE

while the former syntax would HAVE to be used for TOP (since you can
only provide one parameter in the URL).

>>> Dan
-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette: http://curl.haxx.se/mail/etiquette.html
Received on 2012-03-13