/* Instruct libcurl to use a smaller receive buffer */
CINIT(BUFFERSIZE, LONG, 98),
+
+ /* Instruct libcurl to do not use any signal/alarm handlers, even with timeouts. */
+ CINIT(NOSIGNAL, LONG, 99),
CURLOPT_LASTENTRY /* the last unusued */
} CURLoption;
/*************************************************************
* Tell signal handler to ignore SIGPIPE
*************************************************************/
- data->state.prev_signal = signal(SIGPIPE, SIG_IGN);
+ if(!data->set.no_signal)
+ data->state.prev_signal = signal(SIGPIPE, SIG_IGN);
#endif
Curl_initinfo(data); /* reset session-specific information "variables" */
{
#if defined(HAVE_SIGNAL) && defined(SIGPIPE)
/* restore the signal handler for SIGPIPE before we get back */
- signal(SIGPIPE, data->state.prev_signal);
+ if(!data->set.no_signal)
+ signal(SIGPIPE, data->state.prev_signal);
#endif
return CURLE_OK;
break;
+ case CURLOPT_NOSIGNAL:
+ /*
+ * The application asks not to set any signal() or alarm() handlers,
+ * even when using a timeout.
+ */
+ data->set.no_signal = va_arg(param, long) ? TRUE : FALSE;
+ break;
+
default:
/* unknown tag and its companion, just ignore: */
return CURLE_FAILED_INIT; /* correct this */
/*************************************************************
* Set timeout if that is being used
*************************************************************/
- if(data->set.timeout || data->set.connecttimeout) {
+ if((data->set.timeout || data->set.connecttimeout) && !data->set.no_signal) {
/*************************************************************
* Set signal handler to catch SIGALRM
* Store the old value to be able to set it back later!
}
Curl_pgrsTime(data, TIMER_NAMELOOKUP);
#ifdef HAVE_ALARM
- if(data->set.timeout || data->set.connecttimeout) {
+ if((data->set.timeout || data->set.connecttimeout) && !data->set.no_signal) {
#ifdef HAVE_SIGACTION
if(keep_copysig) {
/* we got a struct as it looked before, now put that one back nice
bool reuse_fresh; /* do not re-use an existing connection */
bool expect100header; /* TRUE if we added Expect: 100-continue */
bool ftp_use_epsv; /* if EPSV is to be attempted or not */
+ bool no_signal;
bool global_dns_cache;
};