curl-library
RE: IMAP not working reliably on Win32/VS2012
Date: Tue, 20 Aug 2013 18:06:56 +0000
Hello Steve-
> Is it reliably the same size when you see the problem and what sizes are you having issues with?
It seems like the issue is if the data comes in multiple calls to the CURLOPT_WRITEFUNCTION. The full email I am attempting to read is 1636 bytes. If I get a callback with anything less than 1636 bytes it will fail with a CURLE_OUT_OF_MEMORY. If the first callback is for 1636 bytes I'm able to read the entire email without an issue.
> Sorry but I got a little confused... You mentioned it was a timeout but then mention an out of memory issue. Are these two separate issues?
Sorry about that. When I run my program I get three possible outcomes
1. Works without an issue
2. CURLE_OUT_OF_MEMORY with a partial read
3. timeout after 10 second with 0 bytes read
> Are you able to reproduce the problem with a imap connection as opposed to a imaps connection?
Right now I only have gmail to test against which I think only supports imaps.
> Additionally have you tried the curl command line utility to see if the same thing happens with that?
Yes, it appears to have the same issue. It's interesting that it's read 1374 bytes out of 1636 which means there is 262 bytes left. 262 - 1374 = -1112 which is the incorrect bytes remaining to be read.
Here's a verbose output of a partial read that results in an error
C:\bin>curl -v -k --user XXXXXXXXXXX --url imaps://imap.gmail.com:993/INBOX/;UID=1
* Adding handle: conn: 0x1f88908
* Adding handle: send: 0
* Adding handle: recv: 0
* Curl_addHandleToPipeline: length: 1
* - Conn 0 (0x1f88908) send_pipe: 1, recv_pipe: 0
* About to connect() to imap.gmail.com port 993 (#0)
* Trying 173.194.77.108...
* Connected to imap.gmail.com (173.194.77.108) port 993 (#0)
* SSLv3, TLS handshake, Client hello (1):
* SSLv3, TLS handshake, Server hello (2):
* SSLv3, TLS handshake, CERT (11):
* SSLv3, TLS handshake, Server key exchange (12):
* SSLv3, TLS handshake, Server finished (14):
* SSLv3, TLS handshake, Client key exchange (16):
* SSLv3, TLS change cipher, Client hello (1):
* SSLv3, TLS handshake, Finished (20):
* SSLv3, TLS change cipher, Client hello (1):
* SSLv3, TLS handshake, Finished (20):
* SSL connection using ECDHE-RSA-RC4-SHA
* Server certificate:
* subject: C=US; ST=California; L=Mountain View; O=Google Inc; CN=imap.gmail.com
* start date: 2013-04-15 08:44:00 GMT
* expire date: 2013-12-31 15:58:50 GMT
* issuer: C=US; O=Google Inc; CN=Google Internet Authority
* SSL certificate verify result: unable to get local issuer certificate (20), continuing anyway.
< * OK Gimap ready for requests from 74.220.39.139 t8if283734oai.283
> A001 CAPABILITY
< * CAPABILITY IMAP4rev1 UNSELECT IDLE NAMESPACE QUOTA ID XLIST CHILDREN X-GM-EXT-1 XYZZY SASL-IR AUTH=XOAUTH AUTH=XOAUTH2 AUTH=PLAIN AUTH=PLAIN-CLIENTTOKEN
< A001 OK Thats all she wrote! t8if283734oai.283
> A002 AUTHENTICATE PLAIN cXNjLmpvaG4uZHVubgBxc2Muam9obi5kdW5uACEhYXN0bGFm
< * CAPABILITY IMAP4rev1 UNSELECT IDLE NAMESPACE QUOTA ID XLIST CHILDREN X-GM-EXT-1 UIDPLUS COMPRESS=DEFLATE ENABLE MOVE CONDSTORE ESEARCH
< A002 OK XXXXXXXXXXX authenticated (Success)
> A003 SELECT INBOX
< * FLAGS (\Answered \Flagged \Draft \Deleted \Seen)
< * OK [PERMANENTFLAGS (\Answered \Flagged \Draft \Deleted \Seen \*)] Flags permitted.
< * OK [UIDVALIDITY 1] UIDs valid.
< * 1 EXISTS
< * 0 RECENT
< * OK [UIDNEXT 7] Predicted next UID.
< * OK [HIGHESTMODSEQ 2174]
< A003 OK [READ-WRITE] INBOX selected. (Success)
> A004 FETCH 1 BODY[]
< * 1 FETCH (BODY[] {1636}
* Found 1636 bytes to download
Delivered-To: XXXXXXXXXXX
Received: by 10.68.233.38 with SMTP id tt6csp100479pbc;
Fri, 16 Aug 2013 13:20:44 -0700 (PDT)
X-Received: by 10.68.113.99 with SMTP id ix3mr3247490pbb.180.1376684443982;
Fri, 16 Aug 2013 13:20:43 -0700 (PDT)
Return-Path: <XXXXXXXXXXX>
Received: from XXXXXXXXXXX
by mx.google.com with ESMTPS id xx2si2854357pac.198.1969.12.31.16.00.00
(version=TLSv1 cipher=RC4-SHA bits=128/128);
Fri, 16 Aug 2013 13:20:43 -0700 (PDT)
Received-SPF: pass (google.com: best guess record for domain of XXXXXXXXXXX) client-ip=XXXXXXXXXXX;
Authentication-Results: mx.google.com;
spf=pass (google.com: best guess record for domain of XXXXXXXXXXX) smtp.mail=XXXXXXXXXXX
Received: from XXXXXXXXXXX
([192.168.1.8]) with mapi id 14.02.0318.004; Fri, 16 Aug 2013 13:21:56 -0700
From: XXXXXXXXXXX
To: XXXXXXXXXXX
Subject: simple
Thread-Topic: simple
Thread-Index: Ac6avZ+be+MZAW7qS0KGYk0eVcoe/wAAHUBA
Date: Fri, 16 Aug 2013 20:21:55 +0000
Message-ID: <F5CC0DDCC5377141A6D549A5DEB66A9CA45A31_at_XXXXXXXXXXX.* Written 1374 bytes, 262 bytes are left for transfer
* Excess found in a non pipelined read: excess = 1394, size = 262, maxdownload = 262, bytecount = 1374
* transfer closed with -1112 bytes remaining to read
> A005 LOGOUT
< * BYE LOGOUT Requested
< A005 OK 73 good day (Success)
* Closing connection 0
* SSLv3, TLS alert, Client hello (1):
curl: (18) transfer closed with -1112 bytes remaining to read
-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette: http://curl.haxx.se/mail/etiquette.html
Received on 2013-08-20