mirror of
https://github.com/signalwire/freeswitch.git
synced 2025-06-03 03:50:10 +00:00
update
git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@7226 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
parent
07bca8c341
commit
e55750a444
@ -39,6 +39,7 @@ struct curl_obj {
|
|||||||
JSContext *cx;
|
JSContext *cx;
|
||||||
JSObject *obj;
|
JSObject *obj;
|
||||||
JSFunction *function;
|
JSFunction *function;
|
||||||
|
JSObject *user_data;
|
||||||
jsrefcount saveDepth;
|
jsrefcount saveDepth;
|
||||||
jsval ret;
|
jsval ret;
|
||||||
};
|
};
|
||||||
@ -58,7 +59,9 @@ static size_t file_callback(void *ptr, size_t size, size_t nmemb, void *data)
|
|||||||
if (co->function) {
|
if (co->function) {
|
||||||
char *ret;
|
char *ret;
|
||||||
argv[argc++] = STRING_TO_JSVAL(JS_NewStringCopyZ(co->cx, (char *)ptr));
|
argv[argc++] = STRING_TO_JSVAL(JS_NewStringCopyZ(co->cx, (char *)ptr));
|
||||||
|
if (co->user_data) {
|
||||||
|
argv[argc++] = OBJECT_TO_JSVAL(co->user_data);
|
||||||
|
}
|
||||||
JS_ResumeRequest(co->cx, co->saveDepth);
|
JS_ResumeRequest(co->cx, co->saveDepth);
|
||||||
JS_CallFunction(co->cx, co->obj, co->function, argc, argv, &co->ret);
|
JS_CallFunction(co->cx, co->obj, co->function, argc, argv, &co->ret);
|
||||||
co->saveDepth = JS_SuspendRequest(co->cx);
|
co->saveDepth = JS_SuspendRequest(co->cx);
|
||||||
@ -134,7 +137,11 @@ static JSBool curl_run(JSContext *cx, JSObject *obj, uintN argc, jsval * argv, j
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (argc > 4) {
|
if (argc > 4) {
|
||||||
cred = JS_GetStringBytes(JS_ValueToString(cx, argv[4]));
|
JS_ValueToObject(cx, argv[4], &co->user_data);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (argc > 5) {
|
||||||
|
cred = JS_GetStringBytes(JS_ValueToString(cx, argv[5]));
|
||||||
if (!switch_strlen_zero(cred)) {
|
if (!switch_strlen_zero(cred)) {
|
||||||
curl_easy_setopt(co->curl_handle, CURLOPT_HTTPAUTH, CURLAUTH_ANY);
|
curl_easy_setopt(co->curl_handle, CURLOPT_HTTPAUTH, CURLAUTH_ANY);
|
||||||
curl_easy_setopt(co->curl_handle, CURLOPT_USERPWD, cred);
|
curl_easy_setopt(co->curl_handle, CURLOPT_USERPWD, cred);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user