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