Bug 109931 - [Soup] Leverage new soup_cookie_jar_get_cookie_list() API
Summary: [Soup] Leverage new soup_cookie_jar_get_cookie_list() API
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebCore Misc. (show other bugs)
Version: 528+ (Nightly build)
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Chris Dumez
URL: http://developer.gnome.org/libsoup/st...
Keywords:
Depends on:
Blocks:
 
Reported: 2013-02-15 05:49 PST by Chris Dumez
Modified: 2013-02-15 09:11 PST (History)
4 users (show)

See Also:


Attachments
Patch (3.52 KB, patch)
2013-02-15 05:55 PST, Chris Dumez
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Chris Dumez 2013-02-15 05:49:38 PST
In several cases, the CookieJarSoup implementation retrieves / copies ALL the cookies using soup_cookie_jar_all_cookies() and then uses soup_cookie_applies_to_uri() to filter out cookies it is not interested in. This is inefficient.

In libsoup 2.40, soup_cookie_jar_get_cookie_list(SoupCookieJar *jar, SoupURI *uri, gboolean for_http) was introduced to retrieve only the cookies that apply to a given URI. We should leverage this new API as it would be much more efficient.

libsoup internally stores cookies in a hash table using the host name as key. Therefore, it can retrieve the cookies for a given hostname in O(1). It still iterates over the list of cookies and calls soup_cookie_applies_to_uri() to do further filtering. However, it will iterate over a lot less cookies and it will NOT copy cookies we are not interested in.
Comment 1 Chris Dumez 2013-02-15 05:55:58 PST
Created attachment 188548 [details]
Patch
Comment 2 Kenneth Rohde Christiansen 2013-02-15 06:00:57 PST
Comment on attachment 188548 [details]
Patch

LGTM
Comment 3 Chris Dumez 2013-02-15 06:13:33 PST
Martin, kov, could one of you please take a quick look before we land?
Comment 4 WebKit Review Bot 2013-02-15 09:11:28 PST
Comment on attachment 188548 [details]
Patch

Clearing flags on attachment: 188548

Committed r143009: <http://trac.webkit.org/changeset/143009>
Comment 5 WebKit Review Bot 2013-02-15 09:11:32 PST
All reviewed patches have been landed.  Closing bug.