diff options
Diffstat (limited to 'lisp/url')
-rw-r--r-- | lisp/url/ChangeLog | 17 | ||||
-rw-r--r-- | lisp/url/url-cookie.el | 63 | ||||
-rw-r--r-- | lisp/url/url.el | 3 |
3 files changed, 34 insertions, 49 deletions
diff --git a/lisp/url/ChangeLog b/lisp/url/ChangeLog index ef18be7403d..8bf3ca4aead 100644 --- a/lisp/url/ChangeLog +++ b/lisp/url/ChangeLog @@ -2,11 +2,26 @@ * Relicense all FSF files to GPLv3 or later. +2007-06-12 Tom Tromey <tromey@redhat.com> + + * url.el (url-configuration-directory): Use user-emacs-directory. + +2007-06-12 Stefan Monnier <monnier@iro.umontreal.ca> + + * url-cookie.el (url-cookie-name, url-cookie-value) + (url-cookie-expires, url-cookie-localpart, url-cookie-domain) + (url-cookie-secure, url-cookie-set-name, url-cookie-set-value) + (url-cookie-set-expires, url-cookie-set-localpart) + (url-cookie-set-domain, url-cookie-set-secure) + (url-cookie-retrieve-arg, url-cookie-create, url-cookie-p): Remove. + (url-cookie): New struct. + (url-cookie-store): Use setf instead of url-cookie-set-*. + 2007-05-29 Chong Yidong <cyd@stupidchicken.com> * url-mailto.el (url-mailto): Insert body after mail-header-separator if present, so that it is before signature. - Bug reported by Leo <sdl.web@gmail.com>. + Suggested by Leo <sdl.web@gmail.com>. 2007-04-15 Chong Yidong <cyd@stupidchicken.com> diff --git a/lisp/url/url-cookie.el b/lisp/url/url-cookie.el index cdca65104ad..368c34e32a8 100644 --- a/lisp/url/url-cookie.el +++ b/lisp/url/url-cookie.el @@ -33,51 +33,6 @@ ;; See http://home.netscape.com/newsref/std/cookie_spec.html for the ;; 'open standard' defining this crap. -;; -;; A cookie is stored internally as a vector of 7 slots -;; [ cookie NAME VALUE EXPIRES LOCALPART DOMAIN SECURE ] - -(defsubst url-cookie-name (cookie) (aref cookie 1)) -(defsubst url-cookie-value (cookie) (aref cookie 2)) -(defsubst url-cookie-expires (cookie) (aref cookie 3)) -(defsubst url-cookie-localpart (cookie) (aref cookie 4)) -(defsubst url-cookie-domain (cookie) (aref cookie 5)) -(defsubst url-cookie-secure (cookie) (aref cookie 6)) - -(defsubst url-cookie-set-name (cookie val) (aset cookie 1 val)) -(defsubst url-cookie-set-value (cookie val) (aset cookie 2 val)) -(defsubst url-cookie-set-expires (cookie val) (aset cookie 3 val)) -(defsubst url-cookie-set-localpart (cookie val) (aset cookie 4 val)) -(defsubst url-cookie-set-domain (cookie val) (aset cookie 5 val)) -(defsubst url-cookie-set-secure (cookie val) (aset cookie 6 val)) -(defsubst url-cookie-retrieve-arg (key args) (nth 1 (memq key args))) - -(defsubst url-cookie-create (&rest args) - "Create a cookie vector object from keyword-value pairs ARGS. -The keywords allowed are - :name NAME - :value VALUE - :expires TIME - :localpart LOCALPAR - :domain DOMAIN - :secure ??? -Could someone fill in more information?" - (let ((retval (make-vector 7 nil))) - (aset retval 0 'cookie) - (url-cookie-set-name retval (url-cookie-retrieve-arg :name args)) - (url-cookie-set-value retval (url-cookie-retrieve-arg :value args)) - (url-cookie-set-expires retval (url-cookie-retrieve-arg :expires args)) - (url-cookie-set-localpart retval (url-cookie-retrieve-arg :localpart args)) - (url-cookie-set-domain retval (url-cookie-retrieve-arg :domain args)) - (url-cookie-set-secure retval (url-cookie-retrieve-arg :secure args)) - retval)) - -(defun url-cookie-p (obj) - "Return non-nil if OBJ is a cookie vector object. -These objects represent cookies in the URL package. -A cookie vector object is a vector of 7 slots: - [cookie NAME VALUE EXPIRES LOCALPART DOMAIN SECURE]." - (and (vectorp obj) (= (length obj) 7) (eq (aref obj 0) 'cookie))) (defgroup url-cookie nil "URL cookies." @@ -85,6 +40,20 @@ A cookie vector object is a vector of 7 slots: :prefix "url-cookie-" :group 'url) +;; A cookie is stored internally as a vector of 7 slots +;; [ cookie NAME VALUE EXPIRES LOCALPART DOMAIN SECURE ] + +(defstruct (url-cookie + (:constructor url-cookie-create) + (:copier nil) + ;; For compatibility with a previous version which did not use + ;; defstruct, and also in order to make sure that the printed + ;; representation does not depend on CL internals, we use an + ;; explicitly managed tag. + (:type vector)) + (tag 'cookie :read-only t) + name value expires localpart domain secure) + (defvar url-cookie-storage nil "Where cookies are stored.") (defvar url-cookie-secure-storage nil "Where secure cookies are stored.") (defcustom url-cookie-file nil @@ -199,8 +168,8 @@ telling Microsoft that." (if (and (equal localpart (url-cookie-localpart cur)) (equal name (url-cookie-name cur))) (progn - (url-cookie-set-expires cur expires) - (url-cookie-set-value cur value) + (setf (url-cookie-expires cur) expires) + (setf (url-cookie-value cur) value) (setq tmp t)))) (if (not tmp) ;; New cookie diff --git a/lisp/url/url.el b/lisp/url/url.el index 1af016ff0ba..3b292b4452d 100644 --- a/lisp/url/url.el +++ b/lisp/url/url.el @@ -50,7 +50,8 @@ (defvar url-configuration-directory (cond ((file-directory-p "~/.url") "~/.url") - ((file-directory-p "~/.emacs.d") "~/.emacs.d/url") + ((file-directory-p user-emacs-directory) + (concat user-emacs-directory "url")) (t "~/.url"))) (defun url-do-setup () |