cURL / Mailing Lists / curl-library / Single Mail

curl-library

libcurl POST - console message issue on server connection error

From: Nirav Vora <reach.nsv_at_gmail.com>
Date: Wed, 22 Apr 2015 22:20:11 -0700

Hi,
I am facing strange issue with libcurl and would appreciate guidance in
resolving.
I am using libcurl with C++ application on CentOS 7.0 to POST the request
to HTTP server.
I have configured following options for CURL library:

CURLOPT_TIMEOUT
CURLOPT_WRITEFUNCTION
CURLOPT_WRITEDATA
CURLOPT_HEADERFUNCTION
CURLOPT_DEBUGFUNCTION
CURLOPT_VERBOSE
CURLOPT_HTTPHEADER to set ("Content-type","application/json");
I am using libcurl multi interface for performing above operation.

Here is the behavior that i am observing in my application:

case 1) When server is reachable and URL is correct:
I am getting appropriate response and header (using callbacks that i have
registered with CURL).
"cout" statements following the callback method are printed on console

case 2) When server is reachable and URL is not correct:
I am getting appropriate failure response and header (using callbacks that
i have registered with CURL).
"cout" statements following the callback method are printed on console

case 3) When server is not reachable:
I am not getting any response (as expected) - however all subsequent "cout"
statements are not printed on console.
(Lines of code following callback are being executed but console messages
are suppressed- as verified by testing)

I am seeing following return code after reading information from "
curl_multi_info_read" :

Return code: 28 - Timeout was reached

Any ideas on why "cout" statements are suppressed following "server
connection error" as noted in case (3) above ?

Regards,
nv

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