Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix a hang in imap fetch #5961

Closed
wants to merge 1 commit into from
Closed

Fix a hang in imap fetch #5961

wants to merge 1 commit into from

Conversation

@ansingh
Copy link
Contributor

@ansingh ansingh commented Sep 14, 2020

I was testing imap downloads on windows and I noticed that curl hangs on fetch for a particular sized file on a SSL connection. The library was built against schannel, and I was testing against Outlook's imap server.

Upon debugging I saw that the size of the file was small enough that the entirety of the transfer happened in a single go and schannel buffers held entire data. However, it wasn't completely read in Curl_pp_readresp since a line break was found before that could happen. So, by the time we are in imap_state_fetch_resp - there's data in buffers that needs to be read via Curl_read but nothing to read from the socket. After we setup a transfer (Curl_setup_transfer), curl just waits on the socket state to change - which doesn't happen since no new data ever comes.

I saw CURL_CSELECT_IN was used to mark that the socket is readable, so made that change before transfer setup and it seems to fix the issue.

… FETCH response

(cherry picked from commit deb3aac)
@bagder
bagder approved these changes Sep 14, 2020
Copy link
Member

@bagder bagder left a comment

Seems reasonable and innocuous enough to me!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

2 participants
You can’t perform that action at this time.