38 #define FROM "<sender@example.com>" 39 #define TO "<recipient@example.com>" 40 #define CC "<info@example.com>" 42 #define MULTI_PERFORM_HANG_TIMEOUT 60 * 1000 45 "Date: Mon, 29 Nov 2010 21:54:29 +1100\r\n",
47 "From: " FROM " (Example User)\r\n",
48 "Cc: " CC " (Another example User)\r\n",
49 "Message-ID: <dcd7cb36-11db-487a-9f3a-e652a9458efd@" 50 "rfcpedant.example.org>\r\n",
51 "Subject: SMTP multi example message\r\n",
53 "The body of the message starts here.\r\n",
55 "It could be a lot of lines, could be MIME encoded, whatever.\r\n",
69 if((size == 0) || (nmemb == 0) || ((size*nmemb) < 1)) {
76 size_t len = strlen(data);
91 now.
tv_sec = (long)time(NULL);
107 int still_running = 1;
158 while(still_running) {
167 long curl_timeo = -1;
179 if(curl_timeo >= 0) {
180 timeout.
tv_sec = curl_timeo / 1000;
184 timeout.
tv_usec = (curl_timeo % 1000) * 1000;
191 fprintf(stderr,
"curl_multi_fdset() failed, code %d.\n", mc);
207 struct timeval wait = { 0, 100 * 1000 };
208 rc = select(0, NULL, NULL, NULL, &wait);
214 rc = select(maxfd + 1, &fdread, &fdwrite, &fdexcep, &timeout);
219 "ABORTING: Since it seems that we would have run forever.\n");
CURL_EXTERN CURLMcode curl_multi_fdset(CURLM *multi_handle, fd_set *read_fd_set, fd_set *write_fd_set, fd_set *exc_fd_set, int *max_fd)
static struct timeval tvnow(void)
CURL_EXTERN CURLMcode curl_multi_add_handle(CURLM *multi_handle, CURL *curl_handle)
CURL_EXTERN CURLMcode curl_multi_perform(CURLM *multi_handle, int *running_handles)
CURL_EXTERN CURLMcode curl_multi_timeout(CURLM *multi_handle, long *milliseconds)
UNITTEST_START char * ptr
#define curl_easy_setopt(handle, option, value)
CURL_EXTERN CURLM * curl_multi_init(void)
memcpy(filename, filename1, strlen(filename1))
CURL_EXTERN struct curl_slist * curl_slist_append(struct curl_slist *, const char *)
#define CURL_GLOBAL_DEFAULT
CURL_EXTERN CURL * curl_easy_init(void)
UNITTEST_START struct Curl_easy data
static const char * payload_text[]
CURL_EXTERN void curl_easy_cleanup(CURL *curl)
#define MULTI_PERFORM_HANG_TIMEOUT
CURL_EXTERN CURLMcode curl_multi_remove_handle(CURLM *multi_handle, CURL *curl_handle)
CURL_EXTERN CURLcode curl_global_init(long flags)
curl_global_init() globally initializes curl given a bitwise set of the different features of what to...
static size_t payload_source(void *ptr, size_t size, size_t nmemb, void *userp)
CURL_EXTERN void curl_global_cleanup(void)
curl_global_cleanup() globally cleanups curl, uses the value of "init_flags" to determine what needs ...
CURL_EXTERN void curl_slist_free_all(struct curl_slist *)
static long tvdiff(struct timeval newer, struct timeval older)
CURL_EXTERN CURLMcode curl_multi_cleanup(CURLM *multi_handle)