cURL / Mailing Lists / curl-library / Single Mail

curl-library

RE: [PATCH] POP3: Expanded the supported commands

From: Steve Holme <steve_holme_at_hotmail.com>
Date: Tue, 27 Mar 2012 21:00:56 +0100

Hi all,

On Wed, Mar 14 2012, Steve Holme wrote:

> > > I'm happy to implement the simple append but it may be a little
> > > confusing.
> >
> > The simple append makes -X work more like HTTP in that the argument
> > stays the same and only the command changes. That's less surprising to
>> the user for the most common cases.
>
> No worries I will add this before posting the feature set.

I've implemented the append as suggested - rather simplistic as you can see
from the code snippet from pop_retr() towards the end of this email ;-)

> > As an aside, one thing to keep in mind while coding is to make sure
> > that \r\n is stripped out of the -X command (or return an error).
>
> I had forgotten about that so thank you for reminding me ;-)
>
> I guess I should implement the same parsing that you used when
> fixing the data injection problem within the path problem.

I've also implemented a pop3_parse_custom_request() function that takes the
contents of conn->data->set.str[STRING_CUSTOMREQUEST] and passes it through
Curl_urldecode() before storing it in the pop_conn structure aka the pop3c
variable.

I am now in a position to post my changes, however, as I have already pushed
some of the code tidy ups and simplifications this weekend the final changes
aren't that complicated.

In summary I have:

* Added a variable to pop_conn called custom to hold the contents of the
parsed custom request setting "str[STRING_CUSTOMREQUEST]".
* Added a function to parse the above contents as
pop3_parse_custom_request().
* Modified the pop3_list() and pop3_retr() functions to send the custom
request if it has been set. For example in pop3_retr():

  result = Curl_pp_sendf(&conn->proto.pop3c.pp, "%s %s",
                         pop3c->custom[0] != '\0' ? pop3c->custom : "RETR",
                         pop3c->mailbox);

And that's it.

If nobody has any issues with this approach I will commit and push the
changes over the next few days.

Kind Regards

Steve

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