ftp: add 'prefer_ascii' to the transfer state struct

... and make sure the code never updates 'set.prefer_ascii' as it breaks
handle reuse which should use the setting as the user specified it.

Added test 1569 to verify: it first makes an FTP transfer with ';type=A'
and then another without type on the same handle and the second should
then use binary. Previously, curl failed this.

Closes #6578
This commit is contained in:
Daniel Stenberg 2021-02-08 15:56:10 +01:00
parent 0829909ebd
commit 115c9e27f5
No known key found for this signature in database
GPG key ID: 5CC908FDB71E12C2
9 changed files with 146 additions and 21 deletions

View file

@ -187,7 +187,7 @@ test1540 \
\
test1550 test1551 test1552 test1553 test1554 test1555 test1556 test1557 \
test1558 test1559 test1560 test1561 test1562 test1563 test1564 test1565 \
test1566 test1567 test1568 \
test1566 test1567 test1568 test1569 \
\
test1590 test1591 test1592 test1593 test1594 test1595 test1596 \
\

73
tests/data/test1569 Normal file
View file

@ -0,0 +1,73 @@
<testcase>
<info>
<keywords>
FTP
PASV
RETR
</keywords>
</info>
# Server-side
<reply>
<data nocheck="yes">
data
to
see
that FTP
works
so does it?
</data>
<servercmd>
REPLY EPSV 500 no such command
</servercmd>
</reply>
# Client-side
<client>
<server>
ftp
</server>
<name>
FTP first type=A then regular URL
</name>
<tool>
lib1569
</tool>
<command>
"ftp://%HOSTIP:%FTPPORT/1569;type=A" ftp://%HOSTIP:%FTPPORT/1569
</command>
</client>
# Verify data after the test has been "shot"
<verify>
<protocol>
USER anonymous
PASS ftp@example.com
PWD
EPSV
PASV
TYPE A
RETR 1569
PASV
TYPE I
SIZE 1569
RETR 1569
QUIT
</protocol>
</verify>
<stdout>
data
to
see
that FTP
works
so does it?
data
to
see
that FTP
works
so does it?
</stdout>
</testcase>