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