cURL / Mailing Lists / curl-library / Single Mail

curl-library

RE: IMAP not working reliably on Win32/VS2012

From: Steve Holme <steve_holme_at_hotmail.com>
Date: Wed, 4 Sep 2013 22:48:57 +0100

Hi Jirí

On Wed, 4 Sep 2013, Jirí Hru¹ka wrote:

> it's been a long time since we hacked on the CURL IMAP support
> together :-) I hope you are doing well.

All pretty good here - thank you. I hope all is well with yourself.

As you know I've spent quite a bit of time in February, March and April
doing curl work in my spare time... so I took a few of months off - what
with the warmer weather I've been out on the motorbike rather than being sat
in my stuffy computer room ;-) However, I'm starting to work on a few things
now!

> First, let's talk about 'bytecount', 'maxdownload' and the handling
> of the received excess data.
>
> So this line "size -= chunk" should IMHO be removed.

That seems to solve problem 1, although I think that the check that decides
whether to initiate a transfer or not at line 1488 then needs to become
if(data->req.bytecount == size) rather than if(!size).

> OK, that might solve the weird excess messages with negative
> values, but how to solve the main problem then? (Which is that
> extra data is read when it should stay in the socket till PP code
> goes to read the final FETCH response.)

As such I've been debugging this evening and can report the following:

After the transfer in Multi.c:1714 the call to "result =
multi_runsingle(multi, now, data);" is called again, as it loops round the
loop there, which then goes into the "CURLM_STATE_DONE" state at line 1562
and imap_done() is ultimately called as we would expect ;-)

As we know, this has to deal with the FETCH_FINAL state so
imap_block_statemach() is called. It then calls Curl_pp_statemach() which in
turn calls Curl_socket_ready() but unfortunately the return value "rc"
contains zero afterwards indicating that the connection has been closed as
has just called select() ???

If I modify the size of the transfer to contain a "a little bit more" then I
get ")<CR><LF>" which terminates the FETCH and after that the first few
characters of the "A004 FETCH Complete" - which is what I expect to be in
the socket layer waiting to be read. However, I don't understand why when
Curl_socket_ready() is called after the transfer we get zero back :(

As such I'm still confused a little as to what is going on.

Steve

-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette: http://curl.haxx.se/mail/etiquette.html
Received on 2013-09-04