cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: End of Line Handling (affects ALL platforms)

From: Jamie Lokier <jamie_at_shareable.org>
Date: Sun, 23 Apr 2006 16:27:06 +0100

David McCreedy wrote:
> On Sat, 22APR 2006, Jamie Lokier wrote
>
> >If the file on the server's disk contains a mixture of LF-only and
> >CRLF line endings, it seems likely the server will report the size of
> >that file, and convert the LF-only endings to CRLF, without changing
> >the existing CRLFs.
> >
> >In which case, the client check against the two sizes will fail,
> >despite a successful transfer. It should be a range change: SIZE <=
> >received <= SIZE+line_ends.
> >
> >Have I got that right?
>
> Except that a text file shouldn't have a mixture of LFs and CRLFs.
> I'd prefer to keep treating that as an error, as is done today.

No, but occasionally they do. I've seen quite a few over the years.

While you might regard the contents of such a file as erroneous for
some applications, it's hard to see how to justify calling it a data
transfer error.

> I don't think it's worth it to accommodate text files with bad line endings.

Your call. I just wanted to point it out.

These days, it might be better to always transfer files in binary
mode, and canonicalise line endings at the client if the client has
requested ascii mode.

-- Jamie
Received on 2006-04-23