test1406 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130
  1. <testcase>
  2. # Based on test900
  3. # N.B. --libcurl output not sufficient to deal with uploaded files.
  4. <info>
  5. <keywords>
  6. SMTP
  7. --libcurl
  8. </keywords>
  9. </info>
  10. #
  11. # Server-side
  12. <reply>
  13. <servercmd>
  14. CAPA SIZE
  15. </servercmd>
  16. </reply>
  17. #
  18. # Client-side
  19. <client>
  20. <server>
  21. smtp
  22. </server>
  23. <name>
  24. --libcurl for SMTP
  25. </name>
  26. <setenv>
  27. SSL_CERT_FILE=
  28. </setenv>
  29. <file name="log/test%TESTNUMBER.eml">
  30. From: different
  31. To: another
  32. body
  33. </file>
  34. <command>
  35. smtp://%HOSTIP:%SMTPPORT/%TESTNUMBER --mail-rcpt recipient.one@example.com --mail-rcpt recipient.two@example.com --mail-from sender@example.com -T log/test%TESTNUMBER.eml --libcurl log/test%TESTNUMBER.c
  36. </command>
  37. </client>
  38. #
  39. # Verify data after the test has been "shot"
  40. <verify>
  41. <protocol>
  42. EHLO %TESTNUMBER
  43. MAIL FROM:<sender@example.com> SIZE=38
  44. RCPT TO:<recipient.one@example.com>
  45. RCPT TO:<recipient.two@example.com>
  46. DATA
  47. QUIT
  48. </protocol>
  49. <upload>
  50. From: different
  51. To: another
  52. body
  53. .
  54. </upload>
  55. <file name="log/test%TESTNUMBER.c" mode="text">
  56. /********* Sample code generated by the curl command line tool **********
  57. * All curl_easy_setopt() options are documented at:
  58. * https://curl.se/libcurl/c/curl_easy_setopt.html
  59. ************************************************************************/
  60. #include <curl/curl.h>
  61. int main(int argc, char *argv[])
  62. {
  63. CURLcode ret;
  64. CURL *hnd;
  65. struct curl_slist *slist1;
  66. slist1 = NULL;
  67. slist1 = curl_slist_append(slist1, "recipient.one@example.com");
  68. slist1 = curl_slist_append(slist1, "recipient.two@example.com");
  69. hnd = curl_easy_init();
  70. curl_easy_setopt(hnd, CURLOPT_BUFFERSIZE, 102400L);
  71. curl_easy_setopt(hnd, CURLOPT_URL, "smtp://%HOSTIP:%SMTPPORT/%TESTNUMBER");
  72. curl_easy_setopt(hnd, CURLOPT_UPLOAD, 1L);
  73. curl_easy_setopt(hnd, CURLOPT_VERBOSE, 1L);
  74. curl_easy_setopt(hnd, CURLOPT_FTP_SKIP_PASV_IP, 1L);
  75. curl_easy_setopt(hnd, CURLOPT_TCP_KEEPALIVE, 1L);
  76. curl_easy_setopt(hnd, CURLOPT_MAIL_FROM, "sender@example.com");
  77. curl_easy_setopt(hnd, CURLOPT_MAIL_RCPT, slist1);
  78. curl_easy_setopt(hnd, CURLOPT_INFILESIZE_LARGE, (curl_off_t)38);
  79. /* Here is a list of options the curl code used that cannot get generated
  80. as source easily. You may choose to either not use them or implement
  81. them yourself.
  82. CURLOPT_WRITEDATA set to a objectpointer
  83. CURLOPT_WRITEFUNCTION set to a functionpointer
  84. CURLOPT_READDATA set to a objectpointer
  85. CURLOPT_READFUNCTION set to a functionpointer
  86. CURLOPT_SEEKDATA set to a objectpointer
  87. CURLOPT_SEEKFUNCTION set to a functionpointer
  88. CURLOPT_ERRORBUFFER set to a objectpointer
  89. CURLOPT_STDERR set to a objectpointer
  90. CURLOPT_DEBUGFUNCTION set to a functionpointer
  91. CURLOPT_DEBUGDATA set to a objectpointer
  92. CURLOPT_HEADERFUNCTION set to a functionpointer
  93. CURLOPT_HEADERDATA set to a objectpointer
  94. */
  95. ret = curl_easy_perform(hnd);
  96. curl_easy_cleanup(hnd);
  97. hnd = NULL;
  98. curl_slist_free_all(slist1);
  99. slist1 = NULL;
  100. return (int)ret;
  101. }
  102. /**** End of sample code ****/
  103. </file>
  104. <stripfile>
  105. # These options vary with configurations - just ignore them
  106. # CURLOPT_INTERLEAVEDATA requires RTSP (HTTP) protocol
  107. $_ = '' if /CURLOPT_USERAGENT/
  108. $_ = '' if /CURLOPT_MAXREDIRS/
  109. $_ = '' if /CURLOPT_SSL_VERIFYPEER/
  110. $_ = '' if /CURLOPT_SSH_KNOWNHOSTS/
  111. $_ = '' if /CURLOPT_HTTP_VERSION/
  112. $_ = '' if /CURLOPT_HTTP09_ALLOWED/
  113. $_ = '' if /CURLOPT_INTERLEAVEDATA/
  114. </stripfile>
  115. </verify>
  116. </testcase>