]> git.eshelyaron.com Git - emacs.git/commitdiff
(url-cookie-retrieve, url-cookie-host-can-set-p): Deal with wildcard
authorChong Yidong <cyd@stupidchicken.com>
Sun, 1 Apr 2007 15:38:50 +0000 (15:38 +0000)
committerChong Yidong <cyd@stupidchicken.com>
Sun, 1 Apr 2007 15:38:50 +0000 (15:38 +0000)
dots in domain values.

lisp/url/url-cookie.el

index cfe4f8ecf717f0536009f6182579f3d721db56ec..8d729c923693379aae2d0720830e6db0ee22ce3d 100644 (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))))