diff options
| author | Chong Yidong | 2007-04-01 15:38:50 +0000 |
|---|---|---|
| committer | Chong Yidong | 2007-04-01 15:38:50 +0000 |
| commit | b4ddc815b77785e93fd6a0654888da2ea63d647b (patch) | |
| tree | de98e10851e2eb436942bb6229832e738e2e3d7f | |
| parent | f3e30bd0ec2a5358b74b51f2a1eac7c7ae7ad438 (diff) | |
| download | emacs-b4ddc815b77785e93fd6a0654888da2ea63d647b.tar.gz emacs-b4ddc815b77785e93fd6a0654888da2ea63d647b.zip | |
(url-cookie-retrieve, url-cookie-host-can-set-p): Deal with wildcard
dots in domain values.
| -rw-r--r-- | lisp/url/url-cookie.el | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/lisp/url/url-cookie.el b/lisp/url/url-cookie.el index cfe4f8ecf71..8d729c92369 100644 --- a/lisp/url/url-cookie.el +++ b/lisp/url/url-cookie.el | |||
| @@ -272,7 +272,15 @@ telling Microsoft that." | |||
| 272 | storage (cdr storage) | 272 | storage (cdr storage) |
| 273 | cookies (cdr cur)) | 273 | cookies (cdr cur)) |
| 274 | (if (and (car cur) | 274 | (if (and (car cur) |
| 275 | (string-match (concat "^.*" (regexp-quote (car cur)) "$") host)) | 275 | (string-match |
| 276 | (concat "^.*" | ||
| 277 | (regexp-quote | ||
| 278 | ;; Remove the dot from wildcard domains | ||
| 279 | ;; before matching. | ||
| 280 | (if (eq ?. (aref (car cur) 0)) | ||
| 281 | (substring (car cur) 1) | ||
| 282 | (car cur))) | ||
| 283 | "$") host)) | ||
| 276 | ;; The domains match - a possible hit! | 284 | ;; The domains match - a possible hit! |
| 277 | (while cookies | 285 | (while cookies |
| 278 | (setq cur (car cookies) | 286 | (setq cur (car cookies) |
| @@ -344,7 +352,13 @@ telling Microsoft that." | |||
| 344 | ((>= numdots mindots) ; We have enough dots in domain name | 352 | ((>= numdots mindots) ; We have enough dots in domain name |
| 345 | ;; Need to check and make sure the host is actually _in_ the | 353 | ;; Need to check and make sure the host is actually _in_ the |
| 346 | ;; domain it wants to set a cookie for though. | 354 | ;; domain it wants to set a cookie for though. |
| 347 | (string-match (concat (regexp-quote domain) "$") host)) | 355 | (string-match (concat (regexp-quote |
| 356 | ;; Remove the dot from wildcard domains | ||
| 357 | ;; before matching. | ||
| 358 | (if (eq ?. (aref domain 0)) | ||
| 359 | (substring domain 1) | ||
| 360 | domain)) | ||
| 361 | "$") host)) | ||
| 348 | (t | 362 | (t |
| 349 | nil)))) | 363 | nil)))) |
| 350 | 364 | ||