cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: curl_multi_info_read() returning result of CURLE_RECV_ERROR

From: KS Lee <kslee_at_soft-skills.com.my>
Date: Tue, 27 Oct 2015 13:30:07 +0800

Hi
Thanks so much for reviewing this issue, Daniel.

We did the wireshark trace for the Non-proxy and Proxy case to
compare. The same EXE was used for both the test, differing only in
the parameter to enable a proxy connection.

As a recap, I'm setting the stage for this again.

1. The CURL options used for Non-Proxy:

curl_easy_setopt(m_pCurl, CURLOPT_AUTOREFERER, 1);
curl_easy_setopt(m_pCurl, CURLOPT_UNRESTRICTED_AUTH, 1);
curl_easy_setopt(m_pCurl, CURLOPT_HEADER, 1);
curl_easy_setopt(m_pCurl, CURLOPT_SSL_VERIFYPEER, 0);
curl_easy_setopt(m_pCurl, CURLOPT_SSL_VERIFYHOST, 0);
curl_easy_setopt(m_pCurl, CURLOPT_IGNORE_CONTENT_LENGTH, 1);
curl_easy_setopt(m_pCurl, CURLOPT_COOKIEFILE, "");
curl_easy_setopt(m_pCurl, CURLOPT_COOKIESESSION , 1);
curl_easy_setopt(m_pCurl, CURLOPT_FOLLOWLOCATION, 1);
curl_easy_setopt(m_pCurl, CURLOPT_ACCEPT_ENCODING, "deflate, gzip");
curl_easy_setopt(m_pCurl, CURLOPT_INTERFACE, "<ip address>");

2. The CURL options used for Proxy:

curl_easy_setopt(m_pCurl, CURLOPT_AUTOREFERER, 1);
curl_easy_setopt(m_pCurl, CURLOPT_UNRESTRICTED_AUTH, 1);
curl_easy_setopt(m_pCurl, CURLOPT_HEADER, 1);
curl_easy_setopt(m_pCurl, CURLOPT_SSL_VERIFYPEER, 0);
curl_easy_setopt(m_pCurl, CURLOPT_SSL_VERIFYHOST, 0);
curl_easy_setopt(m_pCurl, CURLOPT_IGNORE_CONTENT_LENGTH, 1);
curl_easy_setopt(m_pCurl, CURLOPT_COOKIEFILE, "");
curl_easy_setopt(m_pCurl, CURLOPT_COOKIESESSION , 1);
curl_easy_setopt(m_pCurl, CURLOPT_FOLLOWLOCATION, 1);
curl_easy_setopt(m_pCurl, CURLOPT_ACCEPT_ENCODING, "deflate, gzip");
curl_easy_setopt(m_pCurl, CURLOPT_PROXY, "<ipaddress:port>");
curl_easy_setopt(m_pCurl, CURLOPT_INTERFACE, "<ip address>");

3. For the proxy case, libcurl debugging displayed this additional
connection with the header item Proxy-Connection set to Keep-Alive,
but no such equivalent in the non-proxy case. We are beginning to
have a hunch that the Keep-Alive may be a problem.

CONNECT xxxx.com:443 HTTP/1.1
Host: xxxx.com:443
User-Agent: Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML,
like Gecko) Chrome/45.0.2454.101 Safari/537.36
Proxy-Connection: Keep-Alive

4. Wireshark traces for the non-proxy scenario, it is showing a TCP
disconnecting from libcurl, and then reconnecting at every HTTP
interaction with the web server. This is normal behaviour, since
keep-alive was not set.

However, after a few of this connect-reconnect pairs, the web server
abruptly issued a TCP RST after sending a few chunks of data to us.

When this TCP RST was received, libcurl logged the following error message:
SSL read: error:00000000:lib(0):func(0):reason(0), errno 10054

We only received a partial reply from the HTML.

5. We repeated the same test using a proxy connection (same program,
same data, etc). All data was sent and received completely and
successfully. The wireshark traces did not show libcurl
disconnection/reconnecting, except right at the end when the program
was brought down.

So, gurus, please help us think this through:

a. Will setting a keep-alive for the non-proxy configuration sort this
out, since the proxy option seemed to have included a
Proxy-Connection: Keep-Alive option automatically?

b. We are unable to see anything out of the ordinary why the Web
Server would disconnect the TCP connection abruptly, but not do so
under a proxy situation. Had this anything to do with a firewall
along the path resetting a long-lived connection? [please note that
the web-server is a third party]

Thanking you in advance, & best regards
KS

-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette: http://curl.haxx.se/mail/etiquette.html
Received on 2015-10-27