I was able to reproduce this issue using VS2010 both with a static and dll libcurl as well so it's not related to VS2012.
-----Original Message----- From: curl-library [mailto:curl-library-boun...@cool.haxx.se] On Behalf Of John Dunn Sent: Monday, August 19, 2013 4:01 PM To: curl-library@cool.haxx.se Subject: IMAP not working reliably on Win32/VS2012 I'm attempting to use the IMAP support in libcurl 7.32.0 and it doesn't seem very reliable. I'm using a static version of libcurl built with Makefile.vc and VS2012. There seems to be an issue with transfers past a given size. If my url is imaps://imap.gmail.com:993/INBOX/;UID=1;SECTION=TEXT the request seems to be relatively reliable but I do see an occasional timeout. If I attempt to get the entire message without specifying a section with a url like imaps://imap.gmail.com:993/INBOX/;UID=1 I will get a CURLE_OUT_OF_MEMORY error. I've reproduced this behavior using the 7.32 prebuilt WIN32 binaries downloaded from the curl site. Here's the code I'm using in my app - #include <curl/curl.h> #include <stdio.h> static char data[1024*1024]; static char* write_data; static void check(CURLcode code) { if( code != CURLE_OK ) { printf("unexpected error before IMAP get\r\n"); exit(-1); } } size_t curl_write_function( void *ptr, size_t size, size_t nmemb, void *userptr ) { printf("curl_write_function %i %i\r\n", size, nmemb); size_t length = size*nmemb; memcpy(write_data, ptr, length); write_data += length; return length; } int curl_progress_function(void *clientp, double dltotal, double dlnow, double ultotal, double ulnow) { return 0; } int main(int argc, char** argv) { if( argc < 3 ) { printf( "usage <url> <user>:<pass>\r\n"); exit(0); } curl_global_init (CURL_GLOBAL_ALL); memset( data, 0, sizeof(data)); write_data = data; char error_buffer[1024]; const char* url = argv[1]; CURL* easy = curl_easy_init(); check( curl_easy_setopt( easy, CURLOPT_FRESH_CONNECT, 1 ) ); check( curl_easy_setopt( easy, CURLOPT_URL, url ) ); check( curl_easy_setopt( easy, CURLOPT_TIMEOUT, 10 ) ); check( curl_easy_setopt( easy, CURLOPT_WRITEFUNCTION, curl_write_function ) ); check( curl_easy_setopt( easy, CURLOPT_WRITEDATA, write_data ) ); check( curl_easy_setopt( easy, CURLOPT_NOSIGNAL, 1 ) ); check( curl_easy_setopt( easy, CURLOPT_FAILONERROR, 1 ) ); check( curl_easy_setopt( easy, CURLOPT_FOLLOWLOCATION, 1 ) ); // enable progress so we can cancel check( curl_easy_setopt( easy, CURLOPT_PROGRESSFUNCTION, curl_progress_function ) ); check( curl_easy_setopt( easy, CURLOPT_NOPROGRESS, 0 ) ); curl_easy_setopt(easy, CURLOPT_USE_SSL, (long)CURLUSESSL_ALL); check( curl_easy_setopt( easy, CURLOPT_SSL_VERIFYPEER, 0 ) ); check( curl_easy_setopt( easy, CURLOPT_SSL_VERIFYHOST, 0 ) ); check( curl_easy_setopt( easy, CURLOPT_ERRORBUFFER, error_buffer ) ); char* credentials = argv[2]; check( curl_easy_setopt( easy, CURLOPT_USERPWD, credentials )); CURLcode cc = curl_easy_perform(easy); if( cc != CURLE_OK ) { printf( "error %s", error_buffer); } else { printf( "data %s", data); } return 0; } ------------------------------------------------------------------- List admin: http://cool.haxx.se/list/listinfo/curl-library Etiquette: http://curl.haxx.se/mail/etiquette.html ------------------------------------------------------------------- List admin: http://cool.haxx.se/list/listinfo/curl-library Etiquette: http://curl.haxx.se/mail/etiquette.html