curl-library
Re: POP3 returns line data and CRLF separately, drops final CRLF
Date: Thu, 9 Feb 2012 00:06:51 +0100 (CET)
On Wed, 8 Feb 2012, Rich Gray wrote:
> 1. Libcurl is returning message data line-by-line, with two callbacks per
> line - one for the line data and the other for the CRLF. This seems like
> strange behavior. I'd coded as if I were getting the data off a TCP
> connection - might get one byte, might get the whole message in one shot,
> might get anything between. So I'm curious as to what the intent is here.
libcurl can of course deliver data this way and still adhere to the API/ABI
just fine. It does this because of how it needs to traverse the entire data
and do magic on dot-prefixed lines and while doing so it can just as well
ship data off to the client like this.
> If it's going to return line at a time, it would be nice to get the line
> with the CRLF in one callback. If, as a function of the dot de-stuffing,
> libcurl returns whole chunks of message data on CRLF boundaries, that would
> be fine too. I can deal with full, unaligned chunks of data too. For the
> moment, I'm not going to consider any sort of alignment entitlement.
If you can make the code any better and provide data to the application in
less invokes or in another more convenient way then please feel free to have a
go at it! I think that quite simply nobody has cared about that particular
effect.
> 2. Libcurl is dropping the final CRLF from the data.
> I think the libcurl implementation has keyed off the "CRLF.CRLF" sentence in
> the middle of this paragraph, whereas the final sentence clearly states that
> the final ".CRLF" is not part of the data. By implication, the immediately
> preceding CRLF of the last line is part of the data. Or, it's just a bug!
> ;P
If libcurl gets the wrong data compared with what other tools say then it
would be an indication that this is a bug or misinterpretation of the spec.
We do have POP3 test cases that seem to run fine though so it would then also
indicate that those are wrong... (for example test 800, 808, 809, 810, 811
etc)
-- / daniel.haxx.se ------------------------------------------------------------------- List admin: http://cool.haxx.se/list/listinfo/curl-library Etiquette: http://curl.haxx.se/mail/etiquette.htmlReceived on 2012-02-09