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