curl-library
RE: Enhancing POP3 to support extra commands
Date: Fri, 2 Dec 2011 12:32:44 +0000
Hi all,
> >> How about this instead: rather than embedding operations into the URL
> >> itself, why not use the "--quote" option, or even the "--request"
> >> option to specify them? That's analagous to how this would be done
> >> for HTTP, FTP and SFTP; to delete a file on those, you'd use -X DELETE,
> >> -Q DELE X and -Q rm X, respectively. That actually seems more natural
> >> to me than inventing a URL scheme to do the same.
> >
> > I agree with Dan.
>
> Count me as another supporter of this suggestion. I prefer this approach
> because of the similarity to how it works with the other protocols
already.
> It makes things somewhat consistent between protocols when used with
> libcurl and we aren't inventing or extending new URL formats.
So far we have Graeme and myself for the URL syntax and Rich, Dan and Daniel
for using the -X / -Q options.
However, I am happy to go with the -X / -Q options as I guess it is in
keeping with other protocols and curl itself - I sometimes forget that I'm
working with curl rather than just libcurl.
I've just about got the code working with the URL syntax as per my email
yesterday and have just been investigating the -X and -Q options this
morning.
As such I have a query as I'm a little confused from reading curl's --help
as well as looking at the code:
-Q, --quote CMD Send command(s) to server before transfer (F/SFTP)
-X, --request COMMAND Specify request command to use
-X uses the CURLOPT_CUSTOMREQUEST option, which will be pretty easy for me
to pick up in pop3.c. However, I am lost at -Q and whether I would use
CURLPT_QUOTE, CURLOPT_PREQUOTE or CURLOPT_POSTQUOTE.
Should I be using one or both of these options? My thoughts are to use just
the -X argument so for example curl command lines might be as follows:
--url pop3://mail.domain.com - List all messages
--url pop3://mail.domain.com -X LIST - List all messages
--url pop3://mail.domain.com/3 -X LIST - List mail 3
--url pop3://mail.domain.com/3 -l - List mail 3
(Maintaining compatibility with v7.23.1)
--url pop3://mail.domain.com -X STAT - Return the
connected user's mailbox statistics
--url pop3://mail.domain.com/3 -X TOP - Retrieve the
message header for mail 3
--url pop3://mail.domain.com/3?rows=10 -X TOP - Retrieve the message
header and 10 rows of body text for mail 3
--url pop3://mail.domain.com/3 - Retrieve mail 3
(Maintaining compatibility with v7.23.1)
--url pop3://mail.domain.com/3 -X RETR - Retrieve mail 3
--url pop3://mail.domain.com/3 -X DELE - Delete mail 3
--url pop3://mail.domain.com -X RSET - Perform a reset
(Undoing any deletes)
I have listed all the possible commands above using their POP3 syntax - We
could use full English words such as RETRIEVE, DELETE, RESET etc... ??
I'm not too sure about the rows=10 query on the TOP command (although this
could be shortened to /3?10 and not include the rows argument) as it is the
only URL here that would use a query, which kind of implies that it is the
-X TOP option - So any suggestions on this would be good as well ;-)
Cheers for your input guys.
Steve
-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette: http://curl.haxx.se/mail/etiquette.html
Received on 2011-12-02