test1406 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122
  1. <testcase>
  2. # Based on test802
  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. </reply>
  14. #
  15. # Client-side
  16. <client>
  17. <server>
  18. smtp
  19. </server>
  20. <name>
  21. SMTP
  22. </name>
  23. <file name="log/test1406.eml">
  24. From: different
  25. To: another
  26. body
  27. </file>
  28. <command>
  29. smtp://%HOSTIP:%SMTPPORT/user --mail-rcpt 1406@foo --mail-rcpt 1406@foobar.example --mail-from 1406@from -T log/test1406.eml --libcurl log/test1406.c
  30. </command>
  31. </client>
  32. #
  33. # Verify data after the test has been "shot"
  34. <verify>
  35. <protocol>
  36. EHLO user
  37. MAIL FROM:<1406@from> SIZE=38
  38. RCPT TO:<1406@foo>
  39. RCPT TO:<1406@foobar.example>
  40. DATA
  41. QUIT
  42. </protocol>
  43. <upload>
  44. From: different
  45. To: another
  46. body
  47. .
  48. </upload>
  49. <file name="log/test1406.c" mode="text">
  50. /********* Sample code generated by the curl command line tool **********
  51. * All curl_easy_setopt() options are documented at:
  52. * http://curl.haxx.se/libcurl/c/curl_easy_setopt.html
  53. ************************************************************************/
  54. #include <curl/curl.h>
  55. int main(int argc, char *argv[])
  56. {
  57. CURLcode ret;
  58. CURL *hnd;
  59. struct curl_slist *slist1;
  60. slist1 = NULL;
  61. slist1 = curl_slist_append(slist1, "1406@foo");
  62. slist1 = curl_slist_append(slist1, "1406@foobar.example");
  63. hnd = curl_easy_init();
  64. curl_easy_setopt(hnd, CURLOPT_INFILESIZE_LARGE, (curl_off_t)38);
  65. curl_easy_setopt(hnd, CURLOPT_URL, "smtp://%HOSTIP:%SMTPPORT/user");
  66. curl_easy_setopt(hnd, CURLOPT_HEADER, 1L);
  67. curl_easy_setopt(hnd, CURLOPT_UPLOAD, 1L);
  68. curl_easy_setopt(hnd, CURLOPT_USERAGENT, "stripped");
  69. curl_easy_setopt(hnd, CURLOPT_MAXREDIRS, 50L);
  70. curl_easy_setopt(hnd, CURLOPT_VERBOSE, 1L);
  71. curl_easy_setopt(hnd, CURLOPT_TCP_KEEPALIVE, 1L);
  72. curl_easy_setopt(hnd, CURLOPT_MAIL_FROM, "1406@from");
  73. curl_easy_setopt(hnd, CURLOPT_MAIL_RCPT, slist1);
  74. /* Here is a list of options the curl code used that cannot get generated
  75. as source easily. You may select to either not use them or implement
  76. them yourself.
  77. CURLOPT_WRITEDATA set to a objectpointer
  78. CURLOPT_WRITEFUNCTION set to a functionpointer
  79. CURLOPT_READDATA set to a objectpointer
  80. CURLOPT_READFUNCTION set to a functionpointer
  81. CURLOPT_SEEKDATA set to a objectpointer
  82. CURLOPT_SEEKFUNCTION set to a functionpointer
  83. CURLOPT_ERRORBUFFER set to a objectpointer
  84. CURLOPT_STDERR set to a objectpointer
  85. CURLOPT_DEBUGFUNCTION set to a functionpointer
  86. CURLOPT_DEBUGDATA set to a objectpointer
  87. CURLOPT_HEADERFUNCTION set to a functionpointer
  88. CURLOPT_HEADERDATA set to a objectpointer
  89. */
  90. ret = curl_easy_perform(hnd);
  91. curl_easy_cleanup(hnd);
  92. hnd = NULL;
  93. curl_slist_free_all(slist1);
  94. slist1 = NULL;
  95. return (int)ret;
  96. }
  97. /**** End of sample code ****/
  98. </file>
  99. <stripfile>
  100. # curl's default user-agent varies with version, libraries etc.
  101. s/(USERAGENT, \")[^\"]+/${1}stripped/
  102. # CURLOPT_SSL_VERIFYPEER and SSH_KNOWNHOSTS vary with configurations - just
  103. # ignore them
  104. $_ = '' if /CURLOPT_SSL_VERIFYPEER/
  105. $_ = '' if /CURLOPT_SSH_KNOWNHOSTS/
  106. </stripfile>
  107. </verify>
  108. </testcase>