cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: End of Line Handling (affects ALL platforms)

From: David McCreedy <mccreedytpf_at_msn.com>
Date: Sat, 22 Apr 2006 23:34:50 +0000

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.

Here's my reasoning, using a copy of curl.html that I have laying around as
an example:

The file is 87,203 bytes with 689 LFs so most servers will report a SIZE of
87,203.
We receive 87,892 bytes once the LFs become CRLFs and this is one of the two
possible lengths that will make us happy (those being 87,203 or 87,892).
But allowing for a mixture means that we'd treat anything from 87,203
through 87,892 as OK.
So the chances of us mistaking a bad transfer as good goes way up.

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

-David McCreedy
Received on 2006-04-23