Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Open sidebar
emacs
emacs
Commits
966bb6c0
Commit
966bb6c0
authored
Sep 08, 2010
by
shawn boles
Committed by
Glenn Morris
Sep 08, 2010
Browse files
* lisp/url/url-cookie.el (url-cookie-expired-p): Simplify and fix. (Bug#6957)
parent
33bd47be
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
10 additions
and
29 deletions
+10
-29
lisp/url/ChangeLog
lisp/url/ChangeLog
+4
-0
lisp/url/url-cookie.el
lisp/url/url-cookie.el
+6
-29
No files found.
lisp/url/ChangeLog
View file @
966bb6c0
2010-09-09 shawn boles <shawn.boles@gmail.com> (tiny change)
* url-cookie.el (url-cookie-expired-p): Simplify and fix. (Bug#6957)
2010-07-26 Michael Albinus <michael.albinus@gmx.de>
* url-http (url-http-parse-headers): Disable file name handlers at
...
...
lisp/url/url-cookie.el
View file @
966bb6c0
...
...
@@ -24,7 +24,6 @@
;;; Code:
(
require
'timezone
)
(
require
'url-util
)
(
require
'url-parse
)
(
eval-when-compile
(
require
'cl
))
...
...
@@ -194,34 +193,12 @@ telling Microsoft that."
(
setq
url-cookie-storage
(
list
(
list
domain
tmp
))))))))
(
defun
url-cookie-expired-p
(
cookie
)
(
let*
(
(
exp
(
url-cookie-expires
cookie
))
(
cur-date
(
and
exp
(
timezone-parse-date
(
current-time-string
))))
(
exp-date
(
and
exp
(
timezone-parse-date
exp
)))
(
cur-greg
(
and
cur-date
(
timezone-absolute-from-gregorian
(
string-to-number
(
aref
cur-date
1
))
(
string-to-number
(
aref
cur-date
2
))
(
string-to-number
(
aref
cur-date
0
)))))
(
exp-greg
(
and
exp
(
timezone-absolute-from-gregorian
(
string-to-number
(
aref
exp-date
1
))
(
string-to-number
(
aref
exp-date
2
))
(
string-to-number
(
aref
exp-date
0
)))))
(
diff-in-days
(
and
exp
(
-
cur-greg
exp-greg
)))
)
(
cond
((
not
exp
)
nil
)
; No expiry == expires at browser quit
((
<
diff-in-days
0
)
nil
)
; Expires sometime after today
((
>
diff-in-days
0
)
t
)
; Expired before today
(
t
; Expires sometime today, check times
(
let*
((
cur-time
(
timezone-parse-time
(
aref
cur-date
3
)))
(
exp-time
(
timezone-parse-time
(
aref
exp-date
3
)))
(
cur-norm
(
+
(
*
360
(
string-to-number
(
aref
cur-time
2
)))
(
*
60
(
string-to-number
(
aref
cur-time
1
)))
(
*
1
(
string-to-number
(
aref
cur-time
0
)))))
(
exp-norm
(
+
(
*
360
(
string-to-number
(
aref
exp-time
2
)))
(
*
60
(
string-to-number
(
aref
exp-time
1
)))
(
*
1
(
string-to-number
(
aref
exp-time
0
))))))
(
>
(
-
cur-norm
exp-norm
)
1
))))))
"Returns true if COOKIE is expired.
If COOKIE has an expiration date it is converted to seconds, adjusted to the client timezone and then compared against (float-time)."
(
let*
((
exp
(
url-cookie-expires
cookie
))
(
exp-time
(
and
exp
(
float-time
(
date-to-time
exp
)))))
(
if
(
not
exp
)
nil
(
>
(
float-time
)
exp-time
)))
)
(
defun
url-cookie-retrieve
(
host
&optional
localpart
secure
)
"Retrieve all the netscape-style cookies for a specified HOST and LOCALPART."
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment