diff options
author | Daniel Silverstone <dsilvers@digital-scurf.org> | 2020-05-23 20:34:04 +0100 |
---|---|---|
committer | Daniel Silverstone <dsilvers@digital-scurf.org> | 2020-05-23 20:34:04 +0100 |
commit | 7d8ed91a7c1153d3c4c8c5a1199a7ebb9b4612b2 (patch) | |
tree | c3b6b140cb9089975a600611c0fa62d24f6dca7b /desktop/browser_window.c | |
parent | eae3756c557e1481f6c4e1be896e5070e63d4b34 (diff) | |
download | netsurf-7d8ed91a7c1153d3c4c8c5a1199a7ebb9b4612b2.tar.gz netsurf-7d8ed91a7c1153d3c4c8c5a1199a7ebb9b4612b2.tar.bz2 |
browser_window: Implement cookie counter
This is a fairly inefficient approach to counting the cookies
in use by a page, but it'll do for now.
Signed-off-by: Daniel Silverstone <dsilvers@digital-scurf.org>
Diffstat (limited to 'desktop/browser_window.c')
-rw-r--r-- | desktop/browser_window.c | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/desktop/browser_window.c b/desktop/browser_window.c index 74d79eabe..ea84e195e 100644 --- a/desktop/browser_window.c +++ b/desktop/browser_window.c @@ -4780,8 +4780,17 @@ browser_window_get_ssl_chain(struct browser_window *bw, int browser_window_get_cookie_count( const struct browser_window *bw) { - /** \todo Implement cookie count */ - return 0; + char *cookies = urldb_get_cookie(browser_window_access_url(bw), true); + int count = 0; + + for (char *c = cookies; *c != '\0'; c++) { + if (*c == ';') + count++; + } + + free(cookies); + + return count; } /* Exported interface, documented in browser_window.h */ |