Re: segfaults calling soup_cookie_new with cookie domain = NULL



Jérémy Lal wrote:
> On 27/03/2009 16:45, Dan Winship wrote:
>> Why are you creating your own cookies by hand, btw?
> good question, as i'm having troubles here :
> in a small program, i'm using webkit to load a php page which is served
> on localhost,
> so i call webkit_web_view_load_uri function.
> i want to populate the http headers with a Cookie: field
> so that the php page gets the cookie.
> The only object i found exposed by webkit was SoupSession
> (webkit_get_default_session).
> The following code hangs, and i don't get why. I'm new to gtk and stuff.
> What's weird is that it does not hang if i set domain != "localhost"
> But in that case the php page won't get the cookie, so it's useless.
> 
> 
> SoupSession* fSession = webkit_get_default_session();
> SoupCookieJar* fCookieJar = soup_cookie_jar_new();
> soup_session_add_feature(fSession, SOUP_SESSION_FEATURE(fCookieJar));
> SoupCookie* fCookie = soup_cookie_new(cookiename, cookievalue,
> "localhost", "/", 1);
> soup_cookie_jar_add_cookie(fCookieJar, fCookie);
> 
> (then, i call
> webkit_web_view_load_uri(webview, gURL);
> gtk_main();)
> 
> i know i'm probably wrong doing this, but i'm a bit short of examples. 

I'm not totally sure. You could try asking on the webkit mailing list.

The webkit session already has its own cookie jar, and maybe adding a
second one is causing problems? Instead of doing:

> SoupCookieJar* fCookieJar = soup_cookie_jar_new();
> soup_session_add_feature(fSession, SOUP_SESSION_FEATURE(fCookieJar));

you should be able to just do

  SoupCookieJar* fCookieJar = soup_session_get_feature(fSession,
SOUP_TYPE_COOKIE_JAR);

and then add the cookie to that. But if that doesn't work, I'm not sure
what to look at next.

-- Dan


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]