-;;; url-cookie.el --- URL cookie support
+;;; url-cookie.el --- URL cookie support -*- lexical-binding:t -*-
;; Copyright (C) 1996-1999, 2004-2017 Free Software Foundation, Inc.
:group 'url-cookie)
(defun url-cookie-host-can-set-p (host domain)
- (let ((last nil)
- (case-fold-search t))
- (cond
- ((string= host domain) ; Apparently netscape lets you do this
- t)
- ((zerop (length domain))
- nil)
- (t
- ;; Remove the dot from wildcard domains before matching.
- (when (eq ?. (aref domain 0))
- (setq domain (substring domain 1)))
- (and (url-domsuf-cookie-allowed-p domain)
- ;; 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))))))
+ (cond
+ ((string= host domain) ; Apparently netscape lets you do this
+ t)
+ ((zerop (length domain))
+ nil)
+ (t
+ ;; Remove the dot from wildcard domains before matching.
+ (when (eq ?. (aref domain 0))
+ (setq domain (substring domain 1)))
+ (and (url-domsuf-cookie-allowed-p domain)
+ (string-suffix-p domain host 'ignore-case)))))
(defun url-cookie-handle-set-cookie (str)
(setq url-cookies-changed-since-last-save t)
"Display a buffer listing the current URL cookies, if there are any.
Use \\<url-cookie-mode-map>\\[url-cookie-delete] to remove cookies."
(interactive)
- (when (and (null url-cookie-secure-storage)
- (null url-cookie-storage))
+ (unless (or url-cookie-secure-storage
+ url-cookie-storage)
(error "No cookies are defined"))
(pop-to-buffer "*url cookies*")
(forward-line 1)
(point)))))
-(defun url-cookie-quit ()
- "Kill the current buffer."
- (interactive)
- (kill-buffer (current-buffer)))
-
(defvar url-cookie-mode-map
(let ((map (make-sparse-keymap)))
- (suppress-keymap map)
- (define-key map "q" 'url-cookie-quit)
(define-key map [delete] 'url-cookie-delete)
(define-key map [(control k)] 'url-cookie-delete)
map))
-(define-derived-mode url-cookie-mode nil "URL Cookie"
+(define-derived-mode url-cookie-mode special-mode "URL Cookie"
"Mode for listing cookies.
\\{url-cookie-mode-map}"