The generic timeout code must not check easy handles that are already completed. Going to completed (again) within there risked decreasing the number of alive handles again and thus it could go negative. This regression bug was added in 7.21.2 in commit ca10e28
ossl_connect_common() now checks whether or not 'struct connectdata->state' is equal 'ssl_connection_complete' and if so, will return CURLE_OK with 'done' set to 'TRUE'. This check prevents ossl_connect_common() from creating a new ssl connection on an existing ssl session which causes openssl to fail when it tries to parse an encrypted TLS packet since the cipher data was effectively thrown away when the new ssl connection was created. Bug: http://curl.haxx.se/mail/lib-2010-11/0169.html
It helps to prevent a hangup with some FTP servers in case idle session timeout has exceeded. But it may be useful also for other protocols that send any quit message on disconnect. Currently used by FTP, POP3, IMAP and SMTP.
When looping in this function and checking for the timeout being expired, it was not updating the reference time when calculating the timediff since previous round which made it think each subsequent loop to have taken longer than it actually did. I also modified the function to use the generic Curl_timeleft() function instead of the custom logic. Bug: http://curl.haxx.se/bug/view.cgi?id=3112579
- Show address string from proper buffer in case of connection failure. - Try next address when inet_ntop() fails.
Reinstate IPV6 build variable that got removed.
Failed to commit this file changes along with the others.