![]() |
![]() |
![]() |
libsoup Reference Manual | ![]() |
---|---|---|---|---|
SoupCookieJarSoupCookieJar — Automatic cookie handling for SoupSession |
SoupCookieJar; SoupCookieJar* soup_cookie_jar_new (void); void soup_cookie_jar_save (SoupCookieJar *jar); char* soup_cookie_jar_get_cookies (SoupCookieJar *jar, SoupURI *uri, gboolean for_http); void soup_cookie_jar_set_cookie (SoupCookieJar *jar, SoupURI *uri, const char *cookie);
A SoupCookieJar stores SoupCookies and arrange for them
to be sent with the appropriate SoupMessages.
SoupCookieJar implements SoupSessionFeature, so you can add a
cookie jar to a session with soup_session_add_feature()
or
soup_session_add_feature_by_type()
.
Note that the base SoupCookieJar class does not support any form of long-term cookie persistence.
SoupCookieJar* soup_cookie_jar_new (void);
Creates a new SoupCookieJar.
Returns : | a new SoupCookieJar |
void soup_cookie_jar_save (SoupCookieJar *jar);
Tells jar
to save the state of its (non-session) cookies to some
sort of permanent storage.
jar : |
a SoupCookieJar |
char* soup_cookie_jar_get_cookies (SoupCookieJar *jar, SoupURI *uri, gboolean for_http);
Retrieves (in Cookie-header form) the list of cookies that would
be sent with a request to uri
.
If for_http
is TRUE
, the return value will include cookies marked
"HttpOnly" (that is, cookies that the server wishes to keep hidden
from client-side scripting operations such as the JavaScript
document.cookies property). Since SoupCookieJar sets the Cookie
header itself when making the actual HTTP request, you should
almost certainly be setting for_http
to FALSE
if you are calling
this.
jar : |
a SoupCookieJar |
uri : |
a SoupURI |
for_http : |
whether or not the return value is being passed directly to an HTTP operation |
Returns : | the cookies, in string form, or NULL if there are no
cookies for uri .
|
void soup_cookie_jar_set_cookie (SoupCookieJar *jar, SoupURI *uri, const char *cookie);
Adds cookie
to jar
, exactly as though it had appeared in a
Set-Cookie header returned from a request to uri
.
jar : |
a SoupCookieJar |
uri : |
the URI setting the cookie |
cookie : |
the stringified cookie to set |