2014-03-23 20:03:41 +08:00
|
|
|
<testcase>
|
|
|
|
# Based on test800
|
|
|
|
<info>
|
|
|
|
<keywords>
|
|
|
|
IMAP
|
2014-03-30 22:09:55 +08:00
|
|
|
Clear Text
|
2014-03-23 20:03:41 +08:00
|
|
|
FETCH
|
|
|
|
--libcurl
|
|
|
|
</keywords>
|
|
|
|
</info>
|
|
|
|
|
|
|
|
#
|
|
|
|
# Server-side
|
|
|
|
<reply>
|
|
|
|
<data>
|
|
|
|
From: me@somewhere
|
|
|
|
To: fake@nowhere
|
|
|
|
|
|
|
|
body
|
|
|
|
|
|
|
|
--
|
|
|
|
yours sincerely
|
|
|
|
</data>
|
|
|
|
</reply>
|
|
|
|
|
|
|
|
#
|
|
|
|
# Client-side
|
|
|
|
<client>
|
|
|
|
<server>
|
|
|
|
imap
|
|
|
|
</server>
|
|
|
|
<name>
|
|
|
|
--libcurl for IMAP FETCH message
|
|
|
|
</name>
|
2017-03-13 05:33:56 +08:00
|
|
|
<setenv>
|
|
|
|
SSL_CERT_FILE=
|
|
|
|
</setenv>
|
|
|
|
<command>
|
2021-03-13 00:38:26 +08:00
|
|
|
'imap://%HOSTIP:%IMAPPORT/%TESTNUMBER/;MAILINDEX=1' -u user:secret --libcurl log/test%TESTNUMBER.c
|
2014-03-23 20:03:41 +08:00
|
|
|
</command>
|
|
|
|
</client>
|
|
|
|
|
|
|
|
#
|
|
|
|
# Verify data after the test has been "shot"
|
|
|
|
<verify>
|
|
|
|
<protocol>
|
|
|
|
A001 CAPABILITY
|
|
|
|
A002 LOGIN user secret
|
2021-03-13 00:38:26 +08:00
|
|
|
A003 SELECT %TESTNUMBER
|
2014-03-23 20:03:41 +08:00
|
|
|
A004 FETCH 1 BODY[]
|
|
|
|
A005 LOGOUT
|
|
|
|
</protocol>
|
2021-03-13 00:38:26 +08:00
|
|
|
<file name="log/test%TESTNUMBER.c" mode="text">
|
2014-03-23 20:03:41 +08:00
|
|
|
/********* Sample code generated by the curl command line tool **********
|
|
|
|
* All curl_easy_setopt() options are documented at:
|
2020-11-04 21:02:01 +08:00
|
|
|
* https://curl.se/libcurl/c/curl_easy_setopt.html
|
2014-03-23 20:03:41 +08:00
|
|
|
************************************************************************/
|
|
|
|
#include <curl/curl.h>
|
|
|
|
|
|
|
|
int main(int argc, char *argv[])
|
|
|
|
{
|
|
|
|
CURLcode ret;
|
|
|
|
CURL *hnd;
|
|
|
|
|
|
|
|
hnd = curl_easy_init();
|
2017-04-24 18:03:08 +08:00
|
|
|
curl_easy_setopt(hnd, CURLOPT_BUFFERSIZE, 102400L);
|
2021-03-13 00:38:26 +08:00
|
|
|
curl_easy_setopt(hnd, CURLOPT_URL, "imap://%HOSTIP:%IMAPPORT/%TESTNUMBER/;MAILINDEX=1");
|
2014-03-23 20:03:41 +08:00
|
|
|
curl_easy_setopt(hnd, CURLOPT_USERPWD, "user:secret");
|
|
|
|
curl_easy_setopt(hnd, CURLOPT_VERBOSE, 1L);
|
2020-11-24 21:56:57 +08:00
|
|
|
curl_easy_setopt(hnd, CURLOPT_FTP_SKIP_PASV_IP, 1L);
|
2014-03-23 20:03:41 +08:00
|
|
|
curl_easy_setopt(hnd, CURLOPT_TCP_KEEPALIVE, 1L);
|
|
|
|
|
|
|
|
/* Here is a list of options the curl code used that cannot get generated
|
2021-10-01 22:57:00 +08:00
|
|
|
as source easily. You may choose to either not use them or implement
|
2014-03-23 20:03:41 +08:00
|
|
|
them yourself.
|
|
|
|
|
|
|
|
CURLOPT_WRITEDATA set to a objectpointer
|
|
|
|
CURLOPT_WRITEFUNCTION set to a functionpointer
|
|
|
|
CURLOPT_READDATA set to a objectpointer
|
|
|
|
CURLOPT_READFUNCTION set to a functionpointer
|
|
|
|
CURLOPT_SEEKDATA set to a objectpointer
|
|
|
|
CURLOPT_SEEKFUNCTION set to a functionpointer
|
|
|
|
CURLOPT_ERRORBUFFER set to a objectpointer
|
|
|
|
CURLOPT_STDERR set to a objectpointer
|
|
|
|
CURLOPT_DEBUGFUNCTION set to a functionpointer
|
|
|
|
CURLOPT_DEBUGDATA set to a objectpointer
|
|
|
|
CURLOPT_HEADERFUNCTION set to a functionpointer
|
|
|
|
CURLOPT_HEADERDATA set to a objectpointer
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
ret = curl_easy_perform(hnd);
|
|
|
|
|
|
|
|
curl_easy_cleanup(hnd);
|
|
|
|
hnd = NULL;
|
|
|
|
|
|
|
|
return (int)ret;
|
|
|
|
}
|
|
|
|
/**** End of sample code ****/
|
|
|
|
</file>
|
|
|
|
<stripfile>
|
2017-03-21 04:39:27 +08:00
|
|
|
# These options vary with configurations - just ignore them
|
2019-05-27 06:24:52 +08:00
|
|
|
# CURLOPT_INTERLEAVEDATA requires RTSP (HTTP) protocol
|
2017-03-21 04:39:27 +08:00
|
|
|
$_ = '' if /CURLOPT_USERAGENT/
|
|
|
|
$_ = '' if /CURLOPT_MAXREDIRS/
|
2014-03-23 20:03:41 +08:00
|
|
|
$_ = '' if /CURLOPT_SSL_VERIFYPEER/
|
|
|
|
$_ = '' if /CURLOPT_SSH_KNOWNHOSTS/
|
2015-12-13 16:24:08 +08:00
|
|
|
$_ = '' if /CURLOPT_HTTP_VERSION/
|
2019-05-27 06:24:52 +08:00
|
|
|
$_ = '' if /CURLOPT_INTERLEAVEDATA/
|
2014-03-23 20:03:41 +08:00
|
|
|
</stripfile>
|
|
|
|
</verify>
|
|
|
|
</testcase>
|