# HG changeset patch # User Chong Yidong # Date 1175441930 0 # Node ID 8fca90acf555934f2aa8d5a0ef2bcf756cc27913 # Parent 620a57a4ccd41df39465a89b059856be626446e7 (url-cookie-retrieve, url-cookie-host-can-set-p): Deal with wildcard dots in domain values. diff -r 620a57a4ccd4 -r 8fca90acf555 lisp/url/url-cookie.el --- a/lisp/url/url-cookie.el Sun Apr 01 15:38:35 2007 +0000 +++ b/lisp/url/url-cookie.el Sun Apr 01 15:38:50 2007 +0000 @@ -272,7 +272,15 @@ 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 @@ ((>= 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))))