cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: libcurl POST - console message issue on server connection error

From: Dan Fandrich <dan_at_coneharvesters.com>
Date: Thu, 23 Apr 2015 23:04:05 +0200

On Wed, Apr 22, 2015 at 10:20:11PM -0700, Nirav Vora wrote:
> 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 ?

Could it be that something has closed the wrong file handle and therefore
closed stdout after the error?

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