Oops, sorry, I clobbered my first line in that message.

You mentioned that the curl handle isn't initialized, so I added a curl_easy_init() at the top of httpConnect. So then would I also need to add a call to the cleanup at the bottom of httpConnect?

Here's what I have for the native implementation of a javascript function. It currently succeeds in returning the response to javascript, but then edbrowse segfaults on quit.

static JSBool fetchAsynchronous(JSContext * cx, unsigned int argc, jsval * vp)
{
JS::RootedString str(cx);
JS::RootedString headers(cx);
JS::RootedString payload(cx);
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
str = JS_ValueToString(cx, args[0]);
char *curl_url = JS_c_str(str);
headers = JS_ValueToString(cx, args[1]);
char *curl_headers = JS_c_str(headers);
// url, headers, payload
payload = JS_ValueToString(cx, args[2]);
char *post = JS_c_str(payload);
char *javatext;
if (httpConnect(curl_url,false,false))
{
if(hcode == 200) {
javatext = serverData;
prepareForBrowse(javatext, serverDataLen);
}
}
args.rval().set(STRING_TO_JSVAL(JS_NewStringCopyZ(cx, javatext)));
}


_______________________________________________
Edbrowse-dev mailing list
[email protected]
http://lists.the-brannons.com/mailman/listinfo/edbrowse-dev

Reply via email to