cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: [bagder/curl] e51b23: getpart.pm: Strip carriage returns to fix Windows ...

From: Daniel Stenberg <daniel_at_haxx.se>
Date: Sun, 7 Apr 2013 00:15:28 +0200 (CEST)

On Sat, 6 Apr 2013, Marc Hoersken wrote:

> I think so, yes. I know that the line endings are tuned, usually to
> LF, but for some reason curl actually generates output with CRLF for
> some tests.

curl generates whatever it gets from the server (unless in the very rare case
--crlf is used).

> For example testcase 100: curl outputs the FTP servers directory listing
> with CRLF, while the testcase definition requires LF.

The test server outputs the directory with LFs only. That's a flaw we should
fix. ftpserver.pl clearly has the directory stored internally with CRLF
endings but for some reason the CRs get lost in transition! (I suspect the
sockfilt handling is to blame...)

I'm glad you spotted this. I think we should take the logical next step and
move away from the hard-coded directory contents within ftpserver.pl and
instead make it be specified by the test file like for normal tests. The only
thing we need to do to make it happen is to make sure we can extract the test
case number in a different way than after the last slash for these cases.

> Depends on what we want curl to output. If curl should output the content
> with OS-specific line endings, the testsuite is not able to handle that
> right now. If curl should output with generic line endings (meaning LF in
> this case), at least the ftp part of curl is currently not doing that.

curl outputs binary, the exact thing that was sent from the server normally.
The only way to get curl to treat anything as "text" (that makes a difference
to weirdo operating systems that have that notion), is if you use the
-B/--use-ascii option.

Subsequently, a command line like "curl ftp://server/ -o dump" *will* create a
file with CRLF line endings as long as the server sends such (which a FTP
compliant server does). And it should do so on all operating systems as far as
I can see.

In our test server case, the FTP server is clearly not doing the right
thing!

-- 
  / daniel.haxx.se
-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette:  http://curl.haxx.se/mail/etiquette.html
Received on 2013-04-07