cURL / Mailing Lists / curl-library / Single Mail

curl-library

RE: Dot character as first character in smtp email

From: Steve Holme <steve_holme_at_hotmail.com>
Date: Wed, 16 May 2012 23:07:55 +0100

Hi Daniel,

On Wed, 16 May 2012, Daniel Stenberg wrote:

I've just realised it's Wednesday and not Tuesday as I quoted in the "who
wrote what" line in my previous email. At least I got this one right ;-)

> > I have prepared a fix but just quickly wanted to ask if there is a
> > specific reason we are checking for CRLF.CRLF before I push the fix. I
> > appreciate I've done a fair bit of work in this area but I can't think
> > why it is being done like this and not as per the RFC.
>
> I didn't check the code for this right now, but isn't that simply because
> we don't have any line concept in the code (just a blob of data with a
> length) so we check for CRLF to mean the end of a line and then
> ".CRLF" to be a single line with a single dot in it?

That's right we don't have the concept of a line of data... But even with a
blob we can detect a line of data beginning with a dot as being CRLF. rather
than CRLF.CRLF. Even in the case where the dot is the first character in the
message it is proceeded by a CRLF because of the header information and null
line.

The fix I have come up with essentially changes the check from the full 5
character EOB check to a 3 character check. That also simplifies the code
where we have a bit of a work around for the repeated EOB use case, for
example CRLF.CRLF.CRLF, as it doesn't need to advance the EOB counter to 2
instead it can reset it to zero as we have only matched CRLF. and not the
first CRLF.CRLF in this example.

I appreciate the release is only a week away but I would like to push this
as a last minute fix if you are happy with that.

Kind Regards

Steve

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