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