Commit 033535de authored by Chong Yidong's avatar Chong Yidong
Browse files

(url-cookie-retrieve): Handle null localpart.

parent 26343c7f
...@@ -223,7 +223,7 @@ telling Microsoft that." ...@@ -223,7 +223,7 @@ telling Microsoft that."
(* 1 (string-to-number (aref exp-time 0)))))) (* 1 (string-to-number (aref exp-time 0))))))
(> (- cur-norm exp-norm) 1)))))) (> (- cur-norm exp-norm) 1))))))
(defun url-cookie-retrieve (host localpart &optional secure) (defun url-cookie-retrieve (host &optional localpart secure)
"Retrieve all the netscape-style cookies for a specified HOST and LOCALPART." "Retrieve all the netscape-style cookies for a specified HOST and LOCALPART."
(let ((storage (if secure (let ((storage (if secure
(append url-cookie-secure-storage url-cookie-storage) (append url-cookie-secure-storage url-cookie-storage)
...@@ -232,7 +232,7 @@ telling Microsoft that." ...@@ -232,7 +232,7 @@ telling Microsoft that."
(cookies nil) (cookies nil)
(cur nil) (cur nil)
(retval nil) (retval nil)
(localpart-regexp nil)) (localpart-match nil))
(while storage (while storage
(setq cur (car storage) (setq cur (car storage)
storage (cdr storage) storage (cdr storage)
...@@ -251,9 +251,10 @@ telling Microsoft that." ...@@ -251,9 +251,10 @@ telling Microsoft that."
(while cookies (while cookies
(setq cur (car cookies) (setq cur (car cookies)
cookies (cdr cookies) cookies (cdr cookies)
localpart-regexp (concat "^" (regexp-quote localpart-match (let ((lp (url-cookie-localpart cur)))
(url-cookie-localpart cur)))) (when lp
(if (and (string-match localpart-regexp localpart) (concat "^" (regexp-quote lp)))))
(if (and (equal localpart localpart-match)
(not (url-cookie-expired-p cur))) (not (url-cookie-expired-p cur)))
(setq retval (cons cur retval)))))) (setq retval (cons cur retval))))))
retval)) retval))
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment