curl-users
Re: Source Code as requested (Unable to get HTTP_CODE via curl_easy_getinfo)
From: Lars Nilsson <chamaeleon_at_gmail.com>
Date: Fri, 18 Nov 2005 10:34:02 -0500
Date: Fri, 18 Nov 2005 10:34:02 -0500
On 11/18/05, jamie page <jtpage33_at_yahoo.com> wrote:
> if(curl_easy_getinfo(ctxHttps->curl,
> CURLINFO_HTTP_CODE, &lCurlResponse) != CURLE_OK)
> {
> sprintf(strError, "Error in curl_easy_getinfo: %ld", lCurlResponse);
> }
curl_easy_getinfo() return CURLE_OK when it is SUCCESSFUL in its
attempt to get the information you want. Your code will only be called
when you did NOT get the HTTP request code (i.e., more or less never).
Add another if() after this one where you explicitly check
lCurlResponse for values that make sense for your application and
create your error string when it does not have an acceptable value
(like 404).
Lars Nilsson
Received on 2005-11-18