[Freeswitch-svn] [commit] r9072 - freeswitch/trunk/src/mod/languages/mod_spidermonkey_curl

Freeswitch SVN mikej at freeswitch.org
Thu Jul 17 12:27:26 EDT 2008


Author: mikej
Date: Thu Jul 17 12:27:25 2008
New Revision: 9072

Modified:
   freeswitch/trunk/src/mod/languages/mod_spidermonkey_curl/mod_spidermonkey_curl.c

Log:
add timeout to curl run in js

Modified: freeswitch/trunk/src/mod/languages/mod_spidermonkey_curl/mod_spidermonkey_curl.c
==============================================================================
--- freeswitch/trunk/src/mod/languages/mod_spidermonkey_curl/mod_spidermonkey_curl.c	(original)
+++ freeswitch/trunk/src/mod/languages/mod_spidermonkey_curl/mod_spidermonkey_curl.c	Thu Jul 17 12:27:25 2008
@@ -112,6 +112,7 @@
 	char *url_p = NULL, *data = NULL, *durl = NULL;
 	long httpRes = 0;
 	struct curl_slist *headers = NULL;
+	int32 timeout = 0;
 
 	if (argc < 2 || !co) {
 		return JS_FALSE;
@@ -148,6 +149,14 @@
 		}
 	}
 
+	if (argc > 6) {
+		JS_ValueToInt32(cx, argv[6], &timeout);
+		if (timeout > 0) {
+			curl_easy_setopt(co->curl_handle, CURLOPT_TIMEOUT, timeout);
+		}
+	}
+
+
 
 	curl_easy_setopt(co->curl_handle, CURLOPT_HTTPHEADER, headers);
 



More information about the Freeswitch-svn mailing list