FTP: partly revert eeb7c12807

Since ASCII transfers on FTP means sending CRLF line endings, we should
still keep converting them to LF-only on platforms where text files
typically do not use CRLF.

This also DOES NOT convert existing CRLF line endings on ASCII uploads
but only does stand-alone LF => CRLF.

Regression from eeb7c12807 shipped in 8.10.0

Reported-by: finkjsc on github
Fixes #14873
Closes #14875
This commit is contained in:
Daniel Stenberg 2024-09-12 08:15:14 +02:00
parent 2b652b8634
commit 7eda757d99
No known key found for this signature in database
GPG key ID: 5CC908FDB71E12C2
7 changed files with 54 additions and 19 deletions

View file

@ -694,11 +694,14 @@ content
### `<stripfile4>`
### `<upload [crlf="yes"]>`
### `<upload [crlf="yes"] [nonewline="yes"]>`
the contents of the upload data curl should have sent
`crlf=yes` forces *upload* newlines to become CRLF even if not written so in
the source file.
`nonewline=yes` means that the last byte (the trailing newline character)
should be cut off from the upload data before comparing it.
### `<valgrind>`
disable - disables the valgrind log check for this test

View file

@ -16,8 +16,12 @@ ftp
<name>
FTP PASV upload ASCII file
</name>
<file name="%LOGDIR/test%TESTNUMBER.txt">
<file name="%LOGDIR/test%TESTNUMBER.txt" nonewline="yes">
%if win32
%repeat[1750 x a line of text used for verifying this !%0d%0a]%
%else
%repeat[1750 x a line of text used for verifying this !%0a]%
%endif
</file>
<command>
"ftp://%HOSTIP:%FTPPORT/%TESTNUMBER;type=a" -T %LOGDIR/test%TESTNUMBER.txt
@ -29,7 +33,7 @@ FTP PASV upload ASCII file
<strip>
QUIT
</strip>
<upload crlf="yes">
<upload crlf="yes" nonewline="yes">
%repeat[1750 x a line of text used for verifying this !%0a]%
</upload>
<protocol>

View file

@ -16,8 +16,8 @@ ftp
<name>
FTP PASV upload ASCII file already using CRLF
</name>
<file name="%LOGDIR/test%TESTNUMBER.txt" crlf="yes">
%repeat[1750 x a line of text used for verifying this !%0a]%
<file name="%LOGDIR/test%TESTNUMBER.txt" nonewline="yes">
%repeat[1750 x a line of text used for verifying this !%0d%0a]%
</file>
<command>
"ftp://%HOSTIP:%FTPPORT/%TESTNUMBER;type=a" -T %LOGDIR/test%TESTNUMBER.txt
@ -29,7 +29,7 @@ FTP PASV upload ASCII file already using CRLF
<strip>
QUIT
</strip>
<upload crlf="yes">
<upload crlf="yes" nonewline="yes">
%repeat[1750 x a line of text used for verifying this !%0a]%
</upload>
<protocol>

View file

@ -1497,6 +1497,11 @@ sub singletest_check {
if($hash{'crlf'}) {
subnewlines(1, \$_) for @upload;
}
if($hash{'nonewline'}) {
# Yes, we must cut off the final newline from the final line
# of the upload data
chomp($upload[-1]);
}
$res = compare($runnerid, $testnum, $testname, "upload", \@out, \@upload);
if ($res) {