1
Fork 0
mirror of git://git.sv.gnu.org/emacs.git synced 2025-12-15 10:30:25 -08:00

(url-cookie-retrieve, url-cookie-host-can-set-p): Deal with wildcard

dots in domain values.
This commit is contained in:
Chong Yidong 2007-04-01 15:38:50 +00:00
parent f3e30bd0ec
commit b4ddc815b7

View file

@ -272,7 +272,15 @@ telling Microsoft that."
storage (cdr storage)
cookies (cdr cur))
(if (and (car cur)
(string-match (concat "^.*" (regexp-quote (car cur)) "$") host))
(string-match
(concat "^.*"
(regexp-quote
;; Remove the dot from wildcard domains
;; before matching.
(if (eq ?. (aref (car cur) 0))
(substring (car cur) 1)
(car cur)))
"$") host))
;; The domains match - a possible hit!
(while cookies
(setq cur (car cookies)
@ -344,7 +352,13 @@ telling Microsoft that."
((>= numdots mindots) ; We have enough dots in domain name
;; Need to check and make sure the host is actually _in_ the
;; domain it wants to set a cookie for though.
(string-match (concat (regexp-quote domain) "$") host))
(string-match (concat (regexp-quote
;; Remove the dot from wildcard domains
;; before matching.
(if (eq ?. (aref domain 0))
(substring domain 1)
domain))
"$") host))
(t
nil))))