cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: How to retrieve connection error code

From: Daniel Stenberg <daniel-curl_at_haxx.se>
Date: Wed, 22 Dec 2004 14:16:16 +0100 (CET)

On Wed, 22 Dec 2004, Pavel Orehov wrote:

> I am trying to open the SSL tunnel with proxy (CONNECT method) and the proxy
> response with 405 error message. When I am using curl_get_info function to
> retrieve CURLINFO_RESPONSE_CODE, I get 0 as response code. How can I
> retrieve the real error code that occurred?

First, the 405 response code from the proxy is not considered to be a
"connection error code" with libcurl.

The CURLINFO_RESPONSE_CODE is the last response code from a FTP or HTTP
request. But since in the case of CONNECT, you may get two response codes (one
from the proxy and one from the remote server), you can get the CONNECT one
with CURLINFO_HTTP_CONNECTCODE.

> The same problem I have when some problem occurs on TCP layer,
> CURLINFO_RESPONSE_CODE is 0.

The CURLINFO_RESPONSE_CODE doesn't change meaning when errors occur, it is
still the response code from the server. If no response has been received,
you get zero back.

> How can I get the TCP layer error code?

CURLINFO_OS_ERRNO might be what you want.

-- 
      Daniel Stenberg -- http://curl.haxx.se -- http://daniel.haxx.se
       Dedicated custom curl help for hire: http://haxx.se/curl.html
Received on 2004-12-22