Re: segfaults calling soup_cookie_new with cookie domain = NULL



Jérémy Lal wrote:
> Hi,
> using libsoup2.4 (2.25) and libsoup2.4 (2.26.0)
> i just got a segfault doing that :
> 
> const char* fDomain = NULL;
> const char* fPath = NULL;
> SoupCookie* fCookie = soup_cookie_new(cookieName, cookieValue, fDomain,
> fPath, SOUP_COOKIE_MAX_AGE_ONE_HOUR);
> soup_cookie_jar_add_cookie(fCookieJar, fCookie);
> 
> no segfault with
> fDomain = "";

Yeah... the documentation is wrong. You're not really allowed to have a
cookie with a NULL domain. soup_cookie_new() lets you do this, but as
you noticed, other methods assume all cookies have a domain set. Note
that the cookie "domain" is not completely equivalent to the "domain"
attribute in a Set-Cookie header; even if the Set-Cookie had no domain
attribute, the cookie still needs to have a domain value set, containing
the hostname that the cookie came from.

Why are you creating your own cookies by hand, btw?

-- Dan


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