How do I check for HTTP status inside libcurl callback? How do I check for HTTP status inside libcurl callback? curl curl

How do I check for HTTP status inside libcurl callback?


Yes, Ctk and user1643723 are correct.

With

curl_easy_setopt( handle, CURLOPT_WRITEDATA, handle );

before curl_easy_perform() and the following in my callback,

long code = -1;curl_easy_getinfo( handle, CURLINFO_RESPONSE_CODE, &code );/* superfluous printf() */printf( "HTTP Response Code: %ld\n", code );

I have the HTTP status inside it.

I would be more comfortable if the libcurl documentation explicitly said this was OK.