GNU bug report logs - #22720
25.0.91; url/eww: add function to delete all cookies

Previous Next

Package: emacs;

Reported by: Michael Heerdegen <michael_heerdegen <at> web.de>

Date: Wed, 17 Feb 2016 14:34:02 UTC

Severity: wishlist

Tags: fixed

Found in version 25.0.91

Fixed in version 26.1

Done: Lars Ingebrigtsen <larsi <at> gnus.org>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 22720 in the body.
You can then email your comments to 22720 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#22720; Package emacs. (Wed, 17 Feb 2016 14:34:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Michael Heerdegen <michael_heerdegen <at> web.de>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Wed, 17 Feb 2016 14:34:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Michael Heerdegen <michael_heerdegen <at> web.de>
To: bug-gnu-emacs <at> gnu.org
Cc: Lars Ingebrigtsen <larsi <at> gnus.org>
Subject: 25.0.91; url/eww: add function to delete all cookies
Date: Wed, 17 Feb 2016 15:32:20 +0100
Hello!

as for any popular browser, it would be cool if eww users had a mean to
delete all cookies - in a command, or by adding a function to a hook.
And probably also something to do this selectively for only some cookies
etc.

AFAIK, eww uses the cookie mechanism from url, so the command should
probably be added there.

But AFAICT, direct cookie manipulation is not really possible yet, so I
need the following hack currently:

--8<---------------cut here---------------start------------->8---
(defun my-url-delete-all-cookies ()
  "Delete all cookies"
  (interactive)
  (require 'url)
  (cl-letf (((symbol-function 'url-cookie-expired-p) (lambda (&rest _args) t)))
    (url-cookie-write-file)))
--8<---------------cut here---------------end--------------->8---

Of course we should not do it like this.


Regards,

Michael.




In GNU Emacs 25.0.91.1 (x86_64-pc-linux-gnu, GTK+ Version 3.18.7)
 of 2016-02-14 built on drachen
Repository revision: 23ca48d3d867cfff9f49ef600e2aad7a26c7a870
Windowing system distributor 'The X.Org Foundation', version 11.0.11800000
System Description:	Debian GNU/Linux testing (stretch)

Configured features:
XPM JPEG TIFF GIF PNG RSVG IMAGEMAGICK SOUND DBUS GSETTINGS NOTIFY
LIBXML2 FREETYPE XFT ZLIB TOOLKIT_SCROLL_BARS GTK3 X11

Important settings:
  value of $LC_ALL: de_DE.utf8
  value of $LC_COLLATE: C
  value of $LC_TIME: C
  value of $LANG: de_DE.utf8
  locale-coding-system: utf-8-unix

Major mode: Emacs-Lisp





Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#22720; Package emacs. (Fri, 19 Feb 2016 05:44:02 GMT) Full text and rfc822 format available.

Message #8 received at 22720 <at> debbugs.gnu.org (full text, mbox):

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: Michael Heerdegen <michael_heerdegen <at> web.de>
Cc: 22720 <at> debbugs.gnu.org
Subject: Re: bug#22720: 25.0.91; url/eww: add function to delete all cookies
Date: Fri, 19 Feb 2016 16:42:42 +1100
Michael Heerdegen <michael_heerdegen <at> web.de> writes:

> AFAIK, eww uses the cookie mechanism from url, so the command should
> probably be added there.

There's `M-x url-cookie-list' that will list all the cookies and allow
you to delete any (or all by holding down the `C-k' key).  Does that do
what you want to?

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#22720; Package emacs. (Fri, 19 Feb 2016 11:49:02 GMT) Full text and rfc822 format available.

Message #11 received at 22720 <at> debbugs.gnu.org (full text, mbox):

From: Michael Heerdegen <michael_heerdegen <at> web.de>
To: Lars Ingebrigtsen <larsi <at> gnus.org>
Cc: 22720 <at> debbugs.gnu.org
Subject: Re: bug#22720: 25.0.91; url/eww: add function to delete all cookies
Date: Fri, 19 Feb 2016 12:48:03 +0100
Lars Ingebrigtsen <larsi <at> gnus.org> writes:

> There's `M-x url-cookie-list' that will list all the cookies and allow
> you to delete any (or all by holding down the `C-k' key).  Does that
> do what you want to?

I know that feature, but it's interactive, so that's not what I mean.
With that, you can't e.g. make Emacs delete all cookies when closing,
like you can in internet browsers.


Regards,

Michael.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#22720; Package emacs. (Sun, 21 Feb 2016 05:59:02 GMT) Full text and rfc822 format available.

Message #14 received at 22720 <at> debbugs.gnu.org (full text, mbox):

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: Michael Heerdegen <michael_heerdegen <at> web.de>
Cc: 22720 <at> debbugs.gnu.org
Subject: Re: bug#22720: 25.0.91; url/eww: add function to delete all cookies
Date: Sun, 21 Feb 2016 16:57:27 +1100
Michael Heerdegen <michael_heerdegen <at> web.de> writes:

> I know that feature, but it's interactive, so that's not what I mean.
> With that, you can't e.g. make Emacs delete all cookies when closing,
> like you can in internet browsers.

Oh, I see.  I've now added this to the trunk: `url-cookie-delete-cookies'.

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no




Added tag(s) fixed. Request was from Lars Ingebrigtsen <larsi <at> gnus.org> to control <at> debbugs.gnu.org. (Sun, 21 Feb 2016 05:59:02 GMT) Full text and rfc822 format available.

bug marked as fixed in version 25.2, send any further explanations to 22720 <at> debbugs.gnu.org and Michael Heerdegen <michael_heerdegen <at> web.de> Request was from Lars Ingebrigtsen <larsi <at> gnus.org> to control <at> debbugs.gnu.org. (Sun, 21 Feb 2016 05:59:02 GMT) Full text and rfc822 format available.

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#22720; Package emacs. (Mon, 22 Feb 2016 12:53:02 GMT) Full text and rfc822 format available.

Message #21 received at 22720 <at> debbugs.gnu.org (full text, mbox):

From: Michael Heerdegen <michael_heerdegen <at> web.de>
To: Lars Ingebrigtsen <larsi <at> gnus.org>
Cc: 22720 <at> debbugs.gnu.org
Subject: Re: bug#22720: 25.0.91; url/eww: add function to delete all cookies
Date: Mon, 22 Feb 2016 13:52:21 +0100
Lars Ingebrigtsen <larsi <at> gnus.org> writes:

> Oh, I see.  I've now added this to the trunk:
> `url-cookie-delete-cookies'.

Thanks!

I guess it would also make sense to be able to keep cookies with
matching domain name.  I tweaked your defun a bit:


#+begin_src emacs-lisp
(defun url-cookie-delete-cookies (&optional regexp keep)
  "Delete all cookies from the cookie store where the domain matches REGEXP.
If REGEXP is nil, all cookies are deleted.
If KEEP is non-nil, delete all cookies where the domain does not
match REGEXP."
  (dolist (variable '(url-cookie-secure-storage url-cookie-storage))
    (if (not regexp)
        (set variable nil)
      (let ((cookies (symbol-value variable))
            (pred (if keep
                      (lambda (cookie) (not (string-match-p regexp (car cookie))))
                    (lambda (cookie) (string-match-p regexp (car cookie))))))
        (dolist (elem cookies)
          (when (funcall pred elem)
            (setq cookies (delq elem cookies))))
        (set variable cookies))))
  (setq url-cookies-changed-since-last-save t)
  (url-cookie-write-file))
#+end_src

WDYT?


Regards,

Michael.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#22720; Package emacs. (Tue, 23 Feb 2016 01:53:01 GMT) Full text and rfc822 format available.

Message #24 received at 22720 <at> debbugs.gnu.org (full text, mbox):

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: Michael Heerdegen <michael_heerdegen <at> web.de>
Cc: 22720 <at> debbugs.gnu.org
Subject: Re: bug#22720: 25.0.91; url/eww: add function to delete all cookies
Date: Tue, 23 Feb 2016 12:52:21 +1100
Michael Heerdegen <michael_heerdegen <at> web.de> writes:

> I guess it would also make sense to be able to keep cookies with
> matching domain name.  I tweaked your defun a bit:

Yeah, that seems like a good idea.  Then you can have an exit hook that
deletes all cookies except a few that you want to have around.

I've now done this change (slightly different from your version).

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Tue, 22 Mar 2016 11:24:03 GMT) Full text and rfc822 format available.

bug unarchived. Request was from Glenn Morris <rgm <at> gnu.org> to control <at> debbugs.gnu.org. (Sun, 04 Dec 2016 02:50:10 GMT) Full text and rfc822 format available.

bug Marked as fixed in versions 26.1. Request was from Glenn Morris <rgm <at> gnu.org> to control <at> debbugs.gnu.org. (Sun, 04 Dec 2016 02:50:10 GMT) Full text and rfc822 format available.

bug No longer marked as fixed in versions 25.2. Request was from Glenn Morris <rgm <at> gnu.org> to control <at> debbugs.gnu.org. (Sun, 04 Dec 2016 02:50:10 GMT) Full text and rfc822 format available.

bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Sun, 01 Jan 2017 12:24:09 GMT) Full text and rfc822 format available.

This bug report was last modified 8 years and 227 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.