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 <command> 36ftp://%HOSTIP:%FTPPORT/1405 -Q "NOOP 1" -Q "+NOOP 2" -Q "-NOOP 3" -Q "*FAIL" -Q "+*FAIL HARD" --libcurl log/test1405.c 37</command> 38</client> 39 40# Verify data after the test has been "shot" 41<verify> 42<protocol> 43USER anonymous 44PASS ftp@example.com 45PWD 46NOOP 1 47FAIL 48EPSV 49PASV 50TYPE I 51NOOP 2 52FAIL HARD 53SIZE 1405 54RETR 1405 55NOOP 3 56QUIT 57</protocol> 58<file name="log/test1405.c" mode="text"> 59/********* Sample code generated by the curl command line tool ********** 60 * All curl_easy_setopt() options are documented at: 61 * http://curl.haxx.se/libcurl/c/curl_easy_setopt.html 62 ************************************************************************/ 63#include <curl/curl.h> 64 65int main(int argc, char *argv[]) 66{ 67 CURLcode ret; 68 CURL *hnd; 69 struct curl_slist *slist1; 70 struct curl_slist *slist2; 71 struct curl_slist *slist3; 72 73 slist1 = NULL; 74 slist1 = curl_slist_append(slist1, "NOOP 1"); 75 slist1 = curl_slist_append(slist1, "*FAIL"); 76 slist2 = NULL; 77 slist2 = curl_slist_append(slist2, "NOOP 3"); 78 slist3 = NULL; 79 slist3 = curl_slist_append(slist3, "NOOP 2"); 80 slist3 = curl_slist_append(slist3, "*FAIL HARD"); 81 82 hnd = curl_easy_init(); 83 curl_easy_setopt(hnd, CURLOPT_URL, "ftp://%HOSTIP:%FTPPORT/1405"); 84 curl_easy_setopt(hnd, CURLOPT_HEADER, 1L); 85 curl_easy_setopt(hnd, CURLOPT_QUOTE, slist1); 86 curl_easy_setopt(hnd, CURLOPT_POSTQUOTE, slist2); 87 curl_easy_setopt(hnd, CURLOPT_PREQUOTE, slist3); 88 curl_easy_setopt(hnd, CURLOPT_VERBOSE, 1L); 89 curl_easy_setopt(hnd, CURLOPT_TCP_KEEPALIVE, 1L); 90 91 /* Here is a list of options the curl code used that cannot get generated 92 as source easily. You may select to either not use them or implement 93 them yourself. 94 95 CURLOPT_WRITEDATA set to a objectpointer 96 CURLOPT_WRITEFUNCTION set to a functionpointer 97 CURLOPT_READDATA set to a objectpointer 98 CURLOPT_READFUNCTION set to a functionpointer 99 CURLOPT_SEEKDATA set to a objectpointer 100 CURLOPT_SEEKFUNCTION set to a functionpointer 101 CURLOPT_ERRORBUFFER set to a objectpointer 102 CURLOPT_STDERR set to a objectpointer 103 CURLOPT_DEBUGFUNCTION set to a functionpointer 104 CURLOPT_DEBUGDATA set to a objectpointer 105 CURLOPT_HEADERFUNCTION set to a functionpointer 106 CURLOPT_HEADERDATA set to a objectpointer 107 108 */ 109 110 ret = curl_easy_perform(hnd); 111 112 curl_easy_cleanup(hnd); 113 hnd = NULL; 114 curl_slist_free_all(slist1); 115 slist1 = NULL; 116 curl_slist_free_all(slist2); 117 slist2 = NULL; 118 curl_slist_free_all(slist3); 119 slist3 = NULL; 120 121 return (int)ret; 122} 123/**** End of sample code ****/ 124</file> 125<stripfile> 126# CURLOPT_USERAGENT and CURLOPT_MAXREDIRS requires HTTP protocol 127# support, IOW depends on configuration - just ignore these. 128$_ = '' if /CURLOPT_USERAGENT/ 129$_ = '' if /CURLOPT_MAXREDIRS/ 130# CURLOPT_SSL_VERIFYPEER and SSH_KNOWNHOSTS vary with configurations - just 131# ignore them 132$_ = '' if /CURLOPT_SSL_VERIFYPEER/ 133$_ = '' if /CURLOPT_SSH_KNOWNHOSTS/ 134</stripfile> 135</verify> 136</testcase> 137