]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
FS-2936 stage 1
authorAnthony Minessale <anthm@freeswitch.org>
Tue, 29 Nov 2011 17:13:11 +0000 (11:13 -0600)
committerAnthony Minessale <anthm@freeswitch.org>
Tue, 29 Nov 2011 17:13:11 +0000 (11:13 -0600)
src/mod/applications/mod_cidlookup/mod_cidlookup.c
src/mod/applications/mod_curl/mod_curl.c
src/mod/applications/mod_http_cache/mod_http_cache.c
src/mod/event_handlers/mod_json_cdr/mod_json_cdr.c
src/mod/languages/mod_spidermonkey/mod_spidermonkey.c
src/mod/languages/mod_spidermonkey/mod_spidermonkey_curl.c
src/mod/xml_int/mod_xml_cdr/mod_xml_cdr.c
src/switch_core.c

index ba69f6fb6b7ae6086ac2a69222e31917e741cb57..19364429ba4c7a2dcd2b45d8b2f3a1152d4a92f6 100755 (executable)
@@ -30,7 +30,7 @@
  */
 
 #include <switch.h>
-#include <curl/curl.h>
+#include <switch_curl.h>
 
 #define SWITCH_REWIND_STREAM(s) s.end = s.data
 
@@ -839,6 +839,8 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_cidlookup_load)
                return SWITCH_STATUS_TERM;
        }
 
+       switch_curl_init();
+
        SWITCH_ADD_API(api_interface, "cidlookup", "cidlookup API", cidlookup_function, SYNTAX);
        SWITCH_ADD_APP(app_interface, "cidlookup", "Perform a CID lookup", "Perform a CID lookup",
                                   cidlookup_app_function, "[number [skipurl]]", SAF_SUPPORT_NOMEDIA | SAF_ROUTING_EXEC);
@@ -852,7 +854,7 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_cidlookup_load)
   Macro expands to: switch_status_t mod_cidlookup_shutdown() */
 SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_cidlookup_shutdown)
 {
-
+       switch_curl_destroy();
        switch_event_unbind(&reload_xml_event);
        return SWITCH_STATUS_SUCCESS;
 }
index adcfe453deacb26e1457653b7a66d910dd2240ac..e8e5e6f400f6aec4938feb76e3186782db37c44c 100644 (file)
@@ -30,7 +30,7 @@
  */
 
 #include <switch.h>
-#include <curl/curl.h>
+#include <switch_curl.h>
 #include <json.h>
 
 /* Prototypes */
@@ -412,6 +412,8 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_curl_load)
 
        globals.pool = pool;
 
+       switch_curl_init();
+
        SWITCH_ADD_API(api_interface, "curl", "curl API", curl_function, SYNTAX);
        SWITCH_ADD_APP(app_interface, "curl", "Perform a http request", "Perform a http request",
                                   curl_app_function, SYNTAX, SAF_SUPPORT_NOMEDIA | SAF_ROUTING_EXEC);
@@ -426,7 +428,7 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_curl_load)
 SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_curl_shutdown)
 {
        /* Cleanup dynamically allocated config settings */
-
+       switch_curl_destroy();
        return SWITCH_STATUS_SUCCESS;
 }
 
index 99bd9ca6e8e493b7384515eb5d64de1efeae9772..5ac7251023cda19fb9ae564746a290e293a2019b 100644 (file)
@@ -30,7 +30,7 @@
  *
  */
 #include <switch.h>
-#include <curl/curl.h>
+#include <switch_curl.h>
 
 /* Defines module interface to FreeSWITCH */
 SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_http_cache_shutdown);
@@ -205,6 +205,7 @@ static switch_status_t http_put(switch_core_session_t *session, const char *url,
        }
        curl_easy_setopt(curl_handle, CURLOPT_UPLOAD, 1);
        curl_easy_setopt(curl_handle, CURLOPT_PUT, 1);
+       curl_easy_setopt(curl_handle, CURLOPT_NOSIGNAL, 1);
        curl_easy_setopt(curl_handle, CURLOPT_URL, url);
        curl_easy_setopt(curl_handle, CURLOPT_READDATA, file_to_put);
        curl_easy_setopt(curl_handle, CURLOPT_INFILESIZE_LARGE, (curl_off_t)file_info.st_size);
@@ -1011,7 +1012,7 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_http_cache_load)
        setup_dir(&gcache);
 
        /* init CURL */
-       curl_global_init(CURL_GLOBAL_ALL);
+       switch_curl_init();
 
        /* indicate that the module should continue to be loaded */
        return SWITCH_STATUS_SUCCESS;
@@ -1022,6 +1023,7 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_http_cache_load)
  */
 SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_http_cache_shutdown)
 {
+       switch_curl_destroy();
        url_cache_clear(&gcache, NULL);
        switch_core_hash_destroy(&gcache.map);
        switch_mutex_destroy(gcache.mutex);
index 0600607e3a7433bd7b302aa803becb17e1302dcd..9cdecfca1be456a339465ba85f1898a8e0614d64 100644 (file)
@@ -32,7 +32,7 @@
  */
 #include <sys/stat.h>
 #include <switch.h>
-#include <curl/curl.h>
+#include <switch_curl.h>
 #include <json.h>
 
 #define MAX_URLS 20
@@ -724,6 +724,7 @@ static switch_status_t my_on_reporting(switch_core_session_t *session)
 
                curl_easy_setopt(curl_handle, CURLOPT_HTTPHEADER, headers);
                curl_easy_setopt(curl_handle, CURLOPT_POST, 1);
+               curl_easy_setopt(curl_handle, CURLOPT_NOSIGNAL, 1);
                curl_easy_setopt(curl_handle, CURLOPT_POSTFIELDS, curl_json_text);
                curl_easy_setopt(curl_handle, CURLOPT_USERAGENT, "freeswitch-json/1.0");
                curl_easy_setopt(curl_handle, CURLOPT_WRITEFUNCTION, httpCallBack);
@@ -1040,6 +1041,7 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_json_cdr_load)
 
        globals.retries++;
 
+       switch_curl_init();
        set_json_cdr_log_dirs();
 
        switch_xml_free(xml);
@@ -1052,6 +1054,7 @@ SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_json_cdr_shutdown)
 
        globals.shutdown = 1;
 
+       switch_curl_destroy();
        switch_safe_free(globals.log_dir);
        
        for (;err_dir_index < globals.err_dir_count; err_dir_index++) {
index a09cfdf02a559fa1943a12bc66d26fbdb59cfa32..825273c1aa8d91026c33a51829728101bd2e0825 100644 (file)
@@ -2520,6 +2520,7 @@ static JSBool js_fetchurl_hash(JSContext * cx, JSObject * obj, uintN argc, jsval
                }
                curl_easy_setopt(curl_handle, CURLOPT_URL, url);
                curl_easy_setopt(curl_handle, CURLOPT_FOLLOWLOCATION, 1);
+               curl_easy_setopt(curl_handle, CURLOPT_NOSIGNAL, 1);
                curl_easy_setopt(curl_handle, CURLOPT_MAXREDIRS, 10);
                curl_easy_setopt(curl_handle, CURLOPT_WRITEFUNCTION, hash_callback);
                curl_easy_setopt(curl_handle, CURLOPT_WRITEDATA, (void *) &config_data);
index c2e64ee0aa5426aebd13b6605b3e431e319f76e9..42402e13689ce150564af204dc1921f3d906cfb7 100644 (file)
@@ -183,6 +183,7 @@ static JSBool curl_run(JSContext * cx, JSObject * obj, uintN argc, jsval * argv,
                                          method, url_p, data, switch_str_nil(cred), co->function ? "yes" : "no");
 
        curl_easy_setopt(co->curl_handle, CURLOPT_URL, url_p);
+       curl_easy_setopt(co->curl_handle, CURLOPT_NOSIGNAL, 1);
        curl_easy_setopt(co->curl_handle, CURLOPT_WRITEFUNCTION, file_callback);
        curl_easy_setopt(co->curl_handle, CURLOPT_WRITEDATA, (void *) co);
 
index 7cfd3592bb84fdeaf9c504d79bd8d6a690896660..59e8ec642775d352f136595a23a5dff1a0ae7b4e 100644 (file)
@@ -297,6 +297,7 @@ static switch_status_t my_on_reporting(switch_core_session_t *session)
 
                curl_easy_setopt(curl_handle, CURLOPT_HTTPHEADER, headers);
                curl_easy_setopt(curl_handle, CURLOPT_POST, 1);
+               curl_easy_setopt(curl_handle, CURLOPT_NOSIGNAL, 1);
                curl_easy_setopt(curl_handle, CURLOPT_POSTFIELDS, curl_xml_text);
                curl_easy_setopt(curl_handle, CURLOPT_USERAGENT, "freeswitch-xml/1.0");
                curl_easy_setopt(curl_handle, CURLOPT_WRITEFUNCTION, httpCallBack);
index 8a97de13a9c3bceb9c0d3ca1bd56b383deb96ac7..0f3bc36455788dacec972bd7a36583a8f42891c6 100644 (file)
@@ -1377,6 +1377,8 @@ SWITCH_DECLARE(switch_status_t) switch_core_init(switch_core_flag_t flags, switc
        memset(&runtime, 0, sizeof(runtime));
        gethostname(runtime.hostname, sizeof(runtime.hostname));
 
+       switch_ssl_init_ssl_locks();
+       
        runtime.max_db_handles = 50;
        runtime.db_handle_timeout = 5000000;;
        
@@ -1512,7 +1514,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_init(switch_core_flag_t flags, switc
 
        switch_uuid_get(&uuid);
        switch_uuid_format(runtime.uuid_str, &uuid);
-       switch_ssl_init_ssl_locks();
+
 
        return SWITCH_STATUS_SUCCESS;
 }