mirror of
https://github.com/curl/curl.git
synced 2026-08-24 19:13:39 +03:00
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:
parent
0829909ebd
commit
115c9e27f5
9 changed files with 146 additions and 21 deletions
|
|
@ -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
73
tests/data/test1569
Normal 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>
|
||||
|
|
@ -57,7 +57,7 @@ noinst_PROGRAMS = chkhostname libauthretry libntlmconnect \
|
|||
lib1534 lib1535 lib1536 lib1537 lib1538 lib1539 \
|
||||
lib1540 \
|
||||
lib1550 lib1551 lib1552 lib1553 lib1554 lib1555 lib1556 lib1557 \
|
||||
lib1558 lib1559 lib1560 lib1564 lib1565 lib1567 lib1568 \
|
||||
lib1558 lib1559 lib1560 lib1564 lib1565 lib1567 lib1568 lib1569 \
|
||||
lib1591 lib1592 lib1593 lib1594 lib1596 \
|
||||
lib1905 lib1906 lib1907 lib1908 lib1910 lib1911 lib1912 lib1913 \
|
||||
lib1915 lib1916 lib1917 lib1918 lib1933 lib1934 lib1935 lib1936 \
|
||||
|
|
@ -608,6 +608,9 @@ lib1567_CPPFLAGS = $(AM_CPPFLAGS)
|
|||
lib1568_SOURCES = lib1568.c $(SUPPORTFILES)
|
||||
lib1568_CPPFLAGS = $(AM_CPPFLAGS)
|
||||
|
||||
lib1569_SOURCES = lib1569.c $(SUPPORTFILES)
|
||||
lib1569_CPPFLAGS = $(AM_CPPFLAGS)
|
||||
|
||||
lib1591_SOURCES = lib1591.c $(SUPPORTFILES) $(TESTUTIL) $(WARNLESS)
|
||||
lib1591_LDADD = $(TESTUTIL_LIBS)
|
||||
lib1591_CPPFLAGS = $(AM_CPPFLAGS) -DLIB1591
|
||||
|
|
|
|||
46
tests/libtest/lib1569.c
Normal file
46
tests/libtest/lib1569.c
Normal file
|
|
@ -0,0 +1,46 @@
|
|||
/***************************************************************************
|
||||
* _ _ ____ _
|
||||
* Project ___| | | | _ \| |
|
||||
* / __| | | | |_) | |
|
||||
* | (__| |_| | _ <| |___
|
||||
* \___|\___/|_| \_\_____|
|
||||
*
|
||||
* Copyright (C) 2021, Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||
*
|
||||
* This software is licensed as described in the file COPYING, which
|
||||
* you should have received as part of this distribution. The terms
|
||||
* are also available at https://curl.se/docs/copyright.html.
|
||||
*
|
||||
* You may opt to use, copy, modify, merge, publish, distribute and/or sell
|
||||
* copies of the Software, and permit persons to whom the Software is
|
||||
* furnished to do so, under the terms of the COPYING file.
|
||||
*
|
||||
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
|
||||
* KIND, either express or implied.
|
||||
*
|
||||
***************************************************************************/
|
||||
#include "test.h"
|
||||
|
||||
#include "testtrace.h"
|
||||
#include "memdebug.h"
|
||||
|
||||
int test(char *URL)
|
||||
{
|
||||
CURLcode ret;
|
||||
CURL *hnd;
|
||||
curl_global_init(CURL_GLOBAL_ALL);
|
||||
|
||||
hnd = curl_easy_init();
|
||||
curl_easy_setopt(hnd, CURLOPT_URL, URL);
|
||||
curl_easy_setopt(hnd, CURLOPT_VERBOSE, 1L);
|
||||
curl_easy_setopt(hnd, CURLOPT_HEADER, 1L);
|
||||
|
||||
ret = curl_easy_perform(hnd);
|
||||
|
||||
curl_easy_setopt(hnd, CURLOPT_URL, libtest_arg2);
|
||||
ret = curl_easy_perform(hnd);
|
||||
curl_easy_cleanup(hnd);
|
||||
|
||||
curl_global_cleanup();
|
||||
return (int)ret;
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue