cURL / Mailing Lists / curl-library / Single Mail

curl-library

RE: [PATCH] pop3.c: Fixed drop of final CRLF in EOB checking

From: Steve Holme <steve_holme_at_hotmail.com>
Date: Mon, 20 Feb 2012 22:33:00 +0000

Hi Daniel,

> > Are you able to run the test to see if this patch breaks them please?
>
> Yes, it does but it begs the question of who's right and who's wrong! =)

Thank you for running the test case - that's fantastic.

> The idea in the test being that the <data> part is what is being sent from
> the server, retrieved by curl. And the test script checks that after the
> transfer but the generated output is not the same as the expected. The
> extra CRLF is there:
>
> [logs edited out for clarity]

The logs confused me to begin with as I was expecting to see "0d 0a" between
each line rather than just 0a. Is that by design / a flaw of the test
scripts when running under linux or is it intentional?

I also wouldn't expect to see an extra CRLF as such, though I guess you
could argue it depends on whether the sending application is adding the CRLF
at the beginning of the EOB or not. To that degree we can't tell what the
sending application is doing but I guess you can compare what would be sent
by the user using telnet for example, which would typically be:

From: me_at_somewhere<CRLF>
To: fake_at_nowhere<CRLF>
<CRLF>
body<CRLF>
<CRLF>
--<CRLF>
  yours sincerely<CRLF>
 . <CRLF>

Rather than:

From: me_at_somewhere<CRLF>
To: fake_at_nowhere<CRLF>
<CRLF>
body<CRLF>
<CRLF>
--<CRLF>
  yours sincerely<CRLF>
<CRLF>
 . <CRLF>

Obviously I've used <CRLF> to depict a really 0d 0a combination ;-)

As the current code stands, and I guess this was what Rich's point was... if
someone was to send the top message then only the following will be received
by curl or an application using libcurl:

From: me_at_somewhere<CRLF>
To: fake_at_nowhere<CRLF>
<CRLF>
body<CRLF>
<CRLF>
--<CRLF>
  yours sincerely

This is why I think the patch is needed, and to a certain degree you could
also argue that libcurl's SMTP module shouldn't add CRLF.CRLF if the last
two characters of the body are CRLF but just .CRLF instead ;-)

Kind Regards

Steve

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