xref: /curl/tests/data/test1405 (revision cd4aee15)
1<testcase>
2# Derived from test227
3<info>
4<keywords>
5FTP
6post-quote
7pre-quote
8--libcurl
9</keywords>
10</info>
11# Server-side
12<reply>
13<data>
14data
15    to
16      see
17that FTP
18works
19  so does it?
20</data>
21<servercmd>
22REPLY EPSV 500 no such command
23REPLY FAIL 500 this might not be a failure!
24</servercmd>
25</reply>
26
27# Client-side
28<client>
29<server>
30ftp
31</server>
32<name>
33--libcurl for FTP with quote ops
34</name>
35<setenv>
36SSL_CERT_FILE=
37</setenv>
38<command>
39ftp://%HOSTIP:%FTPPORT/%TESTNUMBER -Q "NOOP 1" -Q "+NOOP 2" -Q "-NOOP 3" -Q "*FAIL" -Q "+*FAIL HARD" --libcurl %LOGDIR/test%TESTNUMBER.c
40</command>
41</client>
42
43# Verify data after the test has been "shot"
44<verify>
45<strip>
46QUIT
47</strip>
48<protocol>
49USER anonymous
50PASS ftp@example.com
51PWD
52NOOP 1
53FAIL
54EPSV
55PASV
56TYPE I
57NOOP 2
58FAIL HARD
59SIZE %TESTNUMBER
60RETR %TESTNUMBER
61NOOP 3
62QUIT
63</protocol>
64<file name="%LOGDIR/test%TESTNUMBER.c" mode="text">
65/********* Sample code generated by the curl command line tool **********
66 * All curl_easy_setopt() options are documented at:
67 * https://curl.se/libcurl/c/curl_easy_setopt.html
68 ************************************************************************/
69#include <curl/curl.h>
70
71int main(int argc, char *argv[])
72{
73  CURLcode ret;
74  CURL *hnd;
75  struct curl_slist *slist1;
76  struct curl_slist *slist2;
77  struct curl_slist *slist3;
78
79  slist1 = NULL;
80  slist1 = curl_slist_append(slist1, "NOOP 1");
81  slist1 = curl_slist_append(slist1, "*FAIL");
82  slist2 = NULL;
83  slist2 = curl_slist_append(slist2, "NOOP 3");
84  slist3 = NULL;
85  slist3 = curl_slist_append(slist3, "NOOP 2");
86  slist3 = curl_slist_append(slist3, "*FAIL HARD");
87
88  hnd = curl_easy_init();
89  curl_easy_setopt(hnd, CURLOPT_BUFFERSIZE, 102400L);
90  curl_easy_setopt(hnd, CURLOPT_URL, "ftp://%HOSTIP:%FTPPORT/%TESTNUMBER");
91  curl_easy_setopt(hnd, CURLOPT_QUOTE, slist1);
92  curl_easy_setopt(hnd, CURLOPT_POSTQUOTE, slist2);
93  curl_easy_setopt(hnd, CURLOPT_PREQUOTE, slist3);
94  curl_easy_setopt(hnd, CURLOPT_VERBOSE, 1L);
95  curl_easy_setopt(hnd, CURLOPT_FTP_SKIP_PASV_IP, 1L);
96  curl_easy_setopt(hnd, CURLOPT_TCP_KEEPALIVE, 1L);
97
98  /* Here is a list of options the curl code used that cannot get generated
99     as source easily. You may choose to either not use them or implement
100     them yourself.
101
102  CURLOPT_WRITEDATA was set to an object pointer
103  CURLOPT_WRITEFUNCTION was set to a function pointer
104  CURLOPT_READDATA was set to an object pointer
105  CURLOPT_READFUNCTION was set to a function pointer
106  CURLOPT_SEEKDATA was set to an object pointer
107  CURLOPT_SEEKFUNCTION was set to a function pointer
108  CURLOPT_ERRORBUFFER was set to an object pointer
109  CURLOPT_STDERR was set to an object pointer
110  CURLOPT_DEBUGFUNCTION was set to a function pointer
111  CURLOPT_DEBUGDATA was set to an object pointer
112  CURLOPT_HEADERFUNCTION was set to a function pointer
113  CURLOPT_HEADERDATA was set to an object pointer
114
115  */
116
117  ret = curl_easy_perform(hnd);
118
119  curl_easy_cleanup(hnd);
120  hnd = NULL;
121  curl_slist_free_all(slist1);
122  slist1 = NULL;
123  curl_slist_free_all(slist2);
124  slist2 = NULL;
125  curl_slist_free_all(slist3);
126  slist3 = NULL;
127
128  return (int)ret;
129}
130/**** End of sample code ****/
131</file>
132<stripfile>
133# CURLOPT_USERAGENT and CURLOPT_MAXREDIRS requires HTTP protocol
134# CURLOPT_INTERLEAVEDATA requires RTSP (HTTP) protocol
135# support, IOW depends on configuration - just ignore these.
136$_ = '' if /CURLOPT_USERAGENT/
137$_ = '' if /CURLOPT_MAXREDIRS/
138# CURLOPT_SSL_VERIFYPEER, SSH_KNOWNHOSTS and HTTP_VERSION vary with
139# configurations - just ignore them
140$_ = '' if /CURLOPT_SSL_VERIFYPEER/
141$_ = '' if /CURLOPT_SSH_KNOWNHOSTS/
142$_ = '' if /CURLOPT_HTTP_VERSION/
143$_ = '' if /CURLOPT_HTTP09_ALLOWED/
144$_ = '' if /CURLOPT_INTERLEAVEDATA/
145</stripfile>
146</verify>
147</testcase>
148