]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
Add missing CURLOPT_NOSIGNAL options
authorTravis Cross <tc@traviscross.com>
Mon, 22 Sep 2014 23:41:47 +0000 (23:41 +0000)
committerTravis Cross <tc@traviscross.com>
Tue, 23 Sep 2014 00:04:21 +0000 (00:04 +0000)
To work correctly in a multi-threaded environment, curl needs to be
used with CURLOPT_NOSIGNAL set to 1.  If it's left at zero, the
default, then curl will use signals to deal with timeouts which will
often result in a crash.

ref: http://curl.haxx.se/libcurl/c/libcurl-tutorial.html#Multi-threading
ref: http://curl.haxx.se/libcurl/c/CURLOPT_NOSIGNAL.html
ref: http://stackoverflow.com/questions/9191668/error-longjmp-causes-uninitialized-stack-frame
ref: https://bugzilla.redhat.com/show_bug.cgi?id=539809
ref: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=570436

src/mod/applications/mod_snom/mod_snom.c
src/mod/languages/mod_v8/src/fsglobal.cpp

index 89a29af00a91d978469f9ef56aff7db2136304ac..81e51a7688dc26609ca685a0b8d21c759e8f47ea 100644 (file)
@@ -192,6 +192,7 @@ SWITCH_STANDARD_API(snom_command_api_function)
        curl_easy_setopt(curl_handle, CURLOPT_USERAGENT, "freeswitch-curl/1.0");
        curl_easy_setopt(curl_handle, CURLOPT_FOLLOWLOCATION, 1);
        curl_easy_setopt(curl_handle, CURLOPT_MAXREDIRS, 15);
+       curl_easy_setopt(curl_handle, CURLOPT_NOSIGNAL, 1);
 
        if (argc == 5) {
                userpwd = switch_mprintf("%s:%s",argv[3],argv[4]);
index 5fbc04c2beb5c93272e64ad59d1bbff396520a98..38948c1843060f3db2d4c8b4535578b15f15d1df 100644 (file)
@@ -237,6 +237,7 @@ JS_GLOBAL_FUNCTION_IMPL_STATIC(FetchURLFile)
                if ((config_data.fileHandle = open(filename, O_CREAT | O_RDWR | O_TRUNC, S_IRUSR | S_IWUSR)) > -1) {
                        switch_curl_easy_setopt(curl_handle, CURLOPT_URL, url);
                        switch_curl_easy_setopt(curl_handle, CURLOPT_FOLLOWLOCATION, 1);
+                       switch_curl_easy_setopt(curl_handle, CURLOPT_NOSIGNAL, 1);
                        switch_curl_easy_setopt(curl_handle, CURLOPT_MAXREDIRS, 10);
                        switch_curl_easy_setopt(curl_handle, CURLOPT_WRITEFUNCTION, FSGlobal::FileCallback);
                        switch_curl_easy_setopt(curl_handle, CURLOPT_WRITEDATA, (void *) &config_data);
@@ -293,6 +294,7 @@ JS_GLOBAL_FUNCTION_IMPL_STATIC(FetchURL)
 
                switch_curl_easy_setopt(curl_handle, CURLOPT_URL, url);
                switch_curl_easy_setopt(curl_handle, CURLOPT_FOLLOWLOCATION, 1);
+               switch_curl_easy_setopt(curl_handle, CURLOPT_NOSIGNAL, 1);
                switch_curl_easy_setopt(curl_handle, CURLOPT_MAXREDIRS, 10);
                switch_curl_easy_setopt(curl_handle, CURLOPT_WRITEFUNCTION, FSGlobal::FetchUrlCallback);
                switch_curl_easy_setopt(curl_handle, CURLOPT_WRITEDATA, (void *) &config_data);