test1405 3.5 KB

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