cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: Broken libcurl FTP list parsing

From: Marc Hörsken <info_at_marc-hoersken.de>
Date: Sun, 26 Jan 2014 20:13:05 +0100

Am 26.01.2014 19:54, schrieb Steve Holme:
>
> That's the bit I'm not sure about... and got really confused over when
> Daniel sent me some log files last month!

Yes, I was confused by the log output, too. That is why I did the
following commit to actually visualize the line-endings:
https://github.com/bagder/curl/commit/23a04863aa40d3576a063cf8ec4894c1d879b442

> I believe that the server sends CRLF for Test 101, 102, etc... and
> previously Test 100, as can be seen in the output of ftp_sockdata.log and
> from the line ending code in directories.pm - If I have understood that code
> correctly.
>
> However, the datacheck sections of those tests contain LF only - so where is
> that conversion/stripping happening?

The conversion is happening due to curl printing it's output to stdout
which is a either a Console window or Console buffer that is being
redirected through an anonymous Pipe on Windows.
As far as I understand it so far, the way that Windows consoles work
causes it to automatically convert [LF] to [CR][LF].

>
> I'm not a fan of fixing up the test files, like what we have done so far, as
> it means that the test files have a mixture of CRLF and LF characters in
> them that a) text editors don’t like, b) get missed when reviewing and c)
> might not be present in patch files. I think your appreciate is a lot better
> - I just don't fancy fixing up all areas of the email protocols where we
> call sendcontrol() with the same two lines of regex. Senddata() I believe is
> only used in FTP as it is the only protocol that implements a data channel.

You are right, we should avoid mixing [LF] and [CR][LF] inside the test
files since that can easily be broken and will probably confuse git,
too. Especially if someone tries to work with the git repository using
autocrlf turned on.
I think the best approach with regards to the test files is using [LF]
only. The test suite should then take care of converting the expected
output to [CR][LF] if required.

I am open to your proposal about changing senddata or sendcontrol. If
these functions only handle textual data, we could also make them log
the data like I did with the previously posted
0001-ftpserver.pl-added-logging-to-data-channel.patch

Do you think it makes sense to go ahead and merge all or a subset of my
patches in order to get started?

Best regards,
Marc
-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette: http://curl.haxx.se/mail/etiquette.html
Received on 2014-01-26