[Sugar-devel] [Browse] Store web session cookies in SQlite database, for SL #3456

Daniel Drake dsd at laptop.org
Thu Apr 19 10:12:05 EDT 2012


Hi Manuel,

On Wed, Apr 18, 2012 at 4:01 PM, Manuel Quiñones <manuq at laptop.org> wrote:
> There was code in Browse to create a SQlite database under data
> directory in the activity profile.  This was for creating a cookie to
> authenticate the laptop in a schoolserver.
>
> I have moved the database creation to a new function, that is called
> before the one that adds the cookie for the schoolserver.
>
> The database is being attached to the WebKit session so the cookies
> are stored there, in a Mozilla compatible SQLite format.

I think a better way to do this is to let SoupCookieJarSqlite create
the sqlite DB if it doesn't already exist (I just checked - this is
how it behaves).

Then use soup_cookie_jar_get_cookies() or
soup_cookie_jar_all_cookies() to check if the XS cookie is set, and if
it isn't, add it with soup_cookie_jar_set_cookie() or
soup_cookie_jar_add_cookie().

Where you add the cookiejar to the session, it would also be worth
adding a comment explaining that by default, cookies are not stored
persistently - we have to add a cookiejar at that point so that they
get saved to disk.

Daniel


More information about the Sugar-devel mailing list