cURL / Mailing Lists / curl-library / Single Mail

curl-library

RE: Some fixes to the SMTP code

From: Daniel Stenberg <daniel_at_haxx.se>
Date: Mon, 22 Feb 2010 16:41:43 +0100 (CET)

On Mon, 22 Feb 2010, Patrick Monnerat wrote:

> I recently found some bugs in the '.' processing:
>
> _ If the '.' comes first in data (i.e.: on the first data line; this is
> perfectly legal for a non-MIME message), it is not doubled.

Oh, I guess I wasn't inventive enough when I wrote test cases for the escape
function!

> _ The current code seems to add a blank line (an extra-crlf) at the end
> of data even if the last line is terminated.

Right, it just always unconditionally sends a CRLF[dot]CRLF at the end of the
body and that's probably a bit too naive then.

> We also might consider mapping CRs and/or LFs alone (I mean not
> combined) into CRLFs, because SMTP data is text-only.

Right. The question is where we draw the line, what we do and what the app
does. I kind of stopped at leaving "everything" in the DATA part to be the
app's responsibility except the transfer-encoding that needs to be done for
the client to server communication to work, the CRLF[dot]CRLF. But that
boundary isn't crystal clear, I realize that.

Perhaps CR and LF to CRLF is another conversion that we should do.

> I did not touch this part of the code, since it clearly appears from the
> comment you intend to replace it with a clever algorithm.

I'm not sure "intend" is the correct word here. I just noticed that I solved
the problem in a rather simple-minded way and it struck me that using some
more clever approach it could be improved to perform better. But if we add
more conversion stuff into the loop there, we need to reconsider how that
would be done anyway.

> Do you plan to implement some kind of mechanism for quoted-printable
> and/or base64 automatic encoding, or would you leave it to the caller ?

That's stuff I think we should leave for the app to deal with. Taking on those
things will no doubt mean a lot of work and a lot of new code and I'm not
really prepared to go down that road...

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