GNU bug report logs - #6957
url-cookie-expired-p

Previous Next

Package: emacs;

Reported by: shawn boles <shawn.boles <at> gmail.com>

Date: Tue, 31 Aug 2010 20:08:02 UTC

Severity: normal

Fixed in version 23.3

Done: Glenn Morris <rgm <at> gnu.org>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: shawn boles <shawn.boles <at> gmail.com>
To: Andreas Schwab <schwab <at> linux-m68k.org>
Cc: 6957 <at> debbugs.gnu.org
Subject: bug#6957: url-cookie-expired-p Redux (at last)
Date: Thu, 2 Sep 2010 10:13:39 -0700
[Message part 1 (text/plain, inline)]
On Tue, Aug 31, 2010 at 4:39 PM, Andreas Schwab <schwab <at> linux-m68k.org> wrote:
> (float-time) already gives the seconds since epoch.  No need to convert
> to string and back, or doing any time zone adjustments.

I spent yesterday laid up with a cold. Between naps I found myself
coming back to (url-cookie-expired-p) and Andreas' response to my GMT
conversion. I kept thinking that there must be kernel of wisdom for
this grasshopper to find.

I would like to suggest the following replacement for
(url-cookie-expired-p); please see attached patch.

(defun url-cookie-expired-p (cookie)
	(let* ((exp (url-cookie-expires cookie))
				 (exp-time (and exp (float-time (date-to-time exp)))))
		(if (not exp) nil
			(> (float-time) exp-time))))

If the cookie has an expiration date, (float-time (date-to-time exp))
takes care of converting this to a float time, adjusted to the
client's time zone. Then all we need to do is compare this exp-time
against (float-time).

As an added bonus, we can now remove the url-cookie dependency on timezone.

shawn
[url-cookie.el.patch (application/octet-stream, attachment)]

This bug report was last modified 14 years and 342 days ago.

Previous Next


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