113498266Sopenharmony_ci<testcase> 213498266Sopenharmony_ci# Derived from test227 313498266Sopenharmony_ci<info> 413498266Sopenharmony_ci<keywords> 513498266Sopenharmony_ciFTP 613498266Sopenharmony_cipost-quote 713498266Sopenharmony_cipre-quote 813498266Sopenharmony_ci--libcurl 913498266Sopenharmony_ci</keywords> 1013498266Sopenharmony_ci</info> 1113498266Sopenharmony_ci# Server-side 1213498266Sopenharmony_ci<reply> 1313498266Sopenharmony_ci<data> 1413498266Sopenharmony_cidata 1513498266Sopenharmony_ci to 1613498266Sopenharmony_ci see 1713498266Sopenharmony_cithat FTP 1813498266Sopenharmony_ciworks 1913498266Sopenharmony_ci so does it? 2013498266Sopenharmony_ci</data> 2113498266Sopenharmony_ci<servercmd> 2213498266Sopenharmony_ciREPLY EPSV 500 no such command 2313498266Sopenharmony_ciREPLY FAIL 500 this might not be a failure! 2413498266Sopenharmony_ci</servercmd> 2513498266Sopenharmony_ci</reply> 2613498266Sopenharmony_ci 2713498266Sopenharmony_ci# Client-side 2813498266Sopenharmony_ci<client> 2913498266Sopenharmony_ci<server> 3013498266Sopenharmony_ciftp 3113498266Sopenharmony_ci</server> 3213498266Sopenharmony_ci<name> 3313498266Sopenharmony_ci--libcurl for FTP with quote ops 3413498266Sopenharmony_ci</name> 3513498266Sopenharmony_ci<setenv> 3613498266Sopenharmony_ciSSL_CERT_FILE= 3713498266Sopenharmony_ci</setenv> 3813498266Sopenharmony_ci<command> 3913498266Sopenharmony_ciftp://%HOSTIP:%FTPPORT/%TESTNUMBER -Q "NOOP 1" -Q "+NOOP 2" -Q "-NOOP 3" -Q "*FAIL" -Q "+*FAIL HARD" --libcurl %LOGDIR/test%TESTNUMBER.c 4013498266Sopenharmony_ci</command> 4113498266Sopenharmony_ci</client> 4213498266Sopenharmony_ci 4313498266Sopenharmony_ci# Verify data after the test has been "shot" 4413498266Sopenharmony_ci<verify> 4513498266Sopenharmony_ci<protocol> 4613498266Sopenharmony_ciUSER anonymous 4713498266Sopenharmony_ciPASS ftp@example.com 4813498266Sopenharmony_ciPWD 4913498266Sopenharmony_ciNOOP 1 5013498266Sopenharmony_ciFAIL 5113498266Sopenharmony_ciEPSV 5213498266Sopenharmony_ciPASV 5313498266Sopenharmony_ciTYPE I 5413498266Sopenharmony_ciNOOP 2 5513498266Sopenharmony_ciFAIL HARD 5613498266Sopenharmony_ciSIZE %TESTNUMBER 5713498266Sopenharmony_ciRETR %TESTNUMBER 5813498266Sopenharmony_ciNOOP 3 5913498266Sopenharmony_ciQUIT 6013498266Sopenharmony_ci</protocol> 6113498266Sopenharmony_ci<file name="%LOGDIR/test%TESTNUMBER.c" mode="text"> 6213498266Sopenharmony_ci/********* Sample code generated by the curl command line tool ********** 6313498266Sopenharmony_ci * All curl_easy_setopt() options are documented at: 6413498266Sopenharmony_ci * https://curl.se/libcurl/c/curl_easy_setopt.html 6513498266Sopenharmony_ci ************************************************************************/ 6613498266Sopenharmony_ci#include <curl/curl.h> 6713498266Sopenharmony_ci 6813498266Sopenharmony_ciint main(int argc, char *argv[]) 6913498266Sopenharmony_ci{ 7013498266Sopenharmony_ci CURLcode ret; 7113498266Sopenharmony_ci CURL *hnd; 7213498266Sopenharmony_ci struct curl_slist *slist1; 7313498266Sopenharmony_ci struct curl_slist *slist2; 7413498266Sopenharmony_ci struct curl_slist *slist3; 7513498266Sopenharmony_ci 7613498266Sopenharmony_ci slist1 = NULL; 7713498266Sopenharmony_ci slist1 = curl_slist_append(slist1, "NOOP 1"); 7813498266Sopenharmony_ci slist1 = curl_slist_append(slist1, "*FAIL"); 7913498266Sopenharmony_ci slist2 = NULL; 8013498266Sopenharmony_ci slist2 = curl_slist_append(slist2, "NOOP 3"); 8113498266Sopenharmony_ci slist3 = NULL; 8213498266Sopenharmony_ci slist3 = curl_slist_append(slist3, "NOOP 2"); 8313498266Sopenharmony_ci slist3 = curl_slist_append(slist3, "*FAIL HARD"); 8413498266Sopenharmony_ci 8513498266Sopenharmony_ci hnd = curl_easy_init(); 8613498266Sopenharmony_ci curl_easy_setopt(hnd, CURLOPT_BUFFERSIZE, 102400L); 8713498266Sopenharmony_ci curl_easy_setopt(hnd, CURLOPT_URL, "ftp://%HOSTIP:%FTPPORT/%TESTNUMBER"); 8813498266Sopenharmony_ci curl_easy_setopt(hnd, CURLOPT_QUOTE, slist1); 8913498266Sopenharmony_ci curl_easy_setopt(hnd, CURLOPT_POSTQUOTE, slist2); 9013498266Sopenharmony_ci curl_easy_setopt(hnd, CURLOPT_PREQUOTE, slist3); 9113498266Sopenharmony_ci curl_easy_setopt(hnd, CURLOPT_VERBOSE, 1L); 9213498266Sopenharmony_ci curl_easy_setopt(hnd, CURLOPT_FTP_SKIP_PASV_IP, 1L); 9313498266Sopenharmony_ci curl_easy_setopt(hnd, CURLOPT_TCP_KEEPALIVE, 1L); 9413498266Sopenharmony_ci 9513498266Sopenharmony_ci /* Here is a list of options the curl code used that cannot get generated 9613498266Sopenharmony_ci as source easily. You may choose to either not use them or implement 9713498266Sopenharmony_ci them yourself. 9813498266Sopenharmony_ci 9913498266Sopenharmony_ci CURLOPT_WRITEDATA was set to an object pointer 10013498266Sopenharmony_ci CURLOPT_WRITEFUNCTION was set to a function pointer 10113498266Sopenharmony_ci CURLOPT_READDATA was set to an object pointer 10213498266Sopenharmony_ci CURLOPT_READFUNCTION was set to a function pointer 10313498266Sopenharmony_ci CURLOPT_SEEKDATA was set to an object pointer 10413498266Sopenharmony_ci CURLOPT_SEEKFUNCTION was set to a function pointer 10513498266Sopenharmony_ci CURLOPT_ERRORBUFFER was set to an object pointer 10613498266Sopenharmony_ci CURLOPT_STDERR was set to an object pointer 10713498266Sopenharmony_ci CURLOPT_DEBUGFUNCTION was set to a function pointer 10813498266Sopenharmony_ci CURLOPT_DEBUGDATA was set to an object pointer 10913498266Sopenharmony_ci CURLOPT_HEADERFUNCTION was set to a function pointer 11013498266Sopenharmony_ci CURLOPT_HEADERDATA was set to an object pointer 11113498266Sopenharmony_ci 11213498266Sopenharmony_ci */ 11313498266Sopenharmony_ci 11413498266Sopenharmony_ci ret = curl_easy_perform(hnd); 11513498266Sopenharmony_ci 11613498266Sopenharmony_ci curl_easy_cleanup(hnd); 11713498266Sopenharmony_ci hnd = NULL; 11813498266Sopenharmony_ci curl_slist_free_all(slist1); 11913498266Sopenharmony_ci slist1 = NULL; 12013498266Sopenharmony_ci curl_slist_free_all(slist2); 12113498266Sopenharmony_ci slist2 = NULL; 12213498266Sopenharmony_ci curl_slist_free_all(slist3); 12313498266Sopenharmony_ci slist3 = NULL; 12413498266Sopenharmony_ci 12513498266Sopenharmony_ci return (int)ret; 12613498266Sopenharmony_ci} 12713498266Sopenharmony_ci/**** End of sample code ****/ 12813498266Sopenharmony_ci</file> 12913498266Sopenharmony_ci<stripfile> 13013498266Sopenharmony_ci# CURLOPT_USERAGENT and CURLOPT_MAXREDIRS requires HTTP protocol 13113498266Sopenharmony_ci# CURLOPT_INTERLEAVEDATA requires RTSP (HTTP) protocol 13213498266Sopenharmony_ci# support, IOW depends on configuration - just ignore these. 13313498266Sopenharmony_ci$_ = '' if /CURLOPT_USERAGENT/ 13413498266Sopenharmony_ci$_ = '' if /CURLOPT_MAXREDIRS/ 13513498266Sopenharmony_ci# CURLOPT_SSL_VERIFYPEER, SSH_KNOWNHOSTS and HTTP_VERSION vary with 13613498266Sopenharmony_ci# configurations - just ignore them 13713498266Sopenharmony_ci$_ = '' if /CURLOPT_SSL_VERIFYPEER/ 13813498266Sopenharmony_ci$_ = '' if /CURLOPT_SSH_KNOWNHOSTS/ 13913498266Sopenharmony_ci$_ = '' if /CURLOPT_HTTP_VERSION/ 14013498266Sopenharmony_ci$_ = '' if /CURLOPT_HTTP09_ALLOWED/ 14113498266Sopenharmony_ci$_ = '' if /CURLOPT_INTERLEAVEDATA/ 14213498266Sopenharmony_ci</stripfile> 14313498266Sopenharmony_ci</verify> 14413498266Sopenharmony_ci</testcase> 145