diff options
author | Daniel Stenberg <daniel@haxx.se> | 2002-08-08 22:52:50 +0000 |
---|---|---|
committer | Daniel Stenberg <daniel@haxx.se> | 2002-08-08 22:52:50 +0000 |
commit | 4cf953678d06346de07d3d64fe5bc650cbc01bf6 (patch) | |
tree | b4f64e7b2bdcf1fc2f13f97db2c81595fd202ace /lib | |
parent | ca5678c8c112bb31b3f4074a6526905027b57e38 (diff) |
Markus F.X.J. Oberhumer's CURLOPT_NOSIGNAL patch
Diffstat (limited to 'lib')
-rw-r--r-- | lib/transfer.c | 6 | ||||
-rw-r--r-- | lib/url.c | 12 | ||||
-rw-r--r-- | lib/urldata.h | 1 |
3 files changed, 15 insertions, 4 deletions
diff --git a/lib/transfer.c b/lib/transfer.c index ae9d621c8..0b0563f41 100644 --- a/lib/transfer.c +++ b/lib/transfer.c @@ -1130,7 +1130,8 @@ CURLcode Curl_pretransfer(struct SessionHandle *data) /************************************************************* * 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" */ @@ -1143,7 +1144,8 @@ CURLcode Curl_posttransfer(struct SessionHandle *data) { #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; @@ -1024,6 +1024,14 @@ CURLcode Curl_setopt(struct SessionHandle *data, CURLoption option, ...) 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 */ @@ -2281,7 +2289,7 @@ static CURLcode CreateConnection(struct SessionHandle *data, /************************************************************* * 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! @@ -2358,7 +2366,7 @@ static CURLcode CreateConnection(struct SessionHandle *data, } 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 diff --git a/lib/urldata.h b/lib/urldata.h index 57ac15529..9c7b18b1b 100644 --- a/lib/urldata.h +++ b/lib/urldata.h @@ -668,6 +668,7 @@ struct UserDefined { 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; }; |