cURL / Mailing Lists / curl-library / Single Mail

curl-library

CURLOPT_NOSIGNAL set but libcurl still raises signals in HTTPS sessions

From: <chrisenpingouin_at_free.fr>
Date: Fri, 13 Jun 2008 14:37:29 +0200

Hello All,

Sorry, I know this problem is more OpenSSL- than curl-related but I really can't
figure out how to work around it since calls to OpenSSL functions are handled by
libcurl.

My app links against libcurl.so version 7.18.1 with c-ares support version 1.5.1
and SSL support through OpenSSL 0.9.8g. All is run on a linux PC with a 2.6.13
kernel. My compiler is GCC 4.0.

Since my app is multithreaded and I don't want curl to generate extra signals, I
set the CURLOPT_NOSIGNAL option to true with the following piece of code:

----- Code begins here -----
        m_nErr = curl_easy_setopt(m_cSession, CURLOPT_NOSIGNAL, 1);
        if ( m_nErr ) {
                log_msg((SCD_LOG_ERROR,lh,"%d reported while disabling signal handling. Give
up!",
                        m_nErr));
                return 3;
        } // signalling disabled
----- Code ends here -----

Since I don't receive any error when this code is executed, I suppose libcurl to
have properly set up my CURL session. Moreover, this code is executed each time
I need a new CURL session on this newly created session.

My app often needs to exchange data with an HTTPS server with which connection
is not so good. Sometimes, probably due to server connection loss, my app still
complains it receives a SIGPIPE, (broken pipe), signal end abruptly ends.

When run through GDB, I can determine that this signal is not raised by curl but
by a function called by curl. It's "socket_write()" from libcrypto.so.0.9.8.

Sure I can prevent my app from being disturbed by such a SIGPIPE signal by
setting up a signal handler in its main code, (for instance to "ignore" it), but
is there another way to prevent it from generating this signal please?

Many thanks in advance. Have a nice day. Chris
Received on 2008-06-13