Function: shr--use-cookies-p
shr--use-cookies-p is a byte-compiled function defined in shr.el.gz.
Signature
(shr--use-cookies-p URL BASE)
Documentation
Say whether to use cookies when fetching URL (typically an image).
BASE is the URL of the HTML being rendered.
Source Code
;; Defined in /usr/src/emacs/lisp/net/shr.el.gz
(defun shr--use-cookies-p (url base)
"Say whether to use cookies when fetching URL (typically an image).
BASE is the URL of the HTML being rendered."
(cond
((null base)
;; Disallow cookies if we don't know what the base is.
nil)
((eq shr-cookie-policy 'same-origin)
(let ((url-host (url-host (url-generic-parse-url url)))
(base-host (split-string
(url-host (url-generic-parse-url (car base)))
"\\.")))
;; We allow cookies if it's for any of the sibling domains (that
;; we're allowed to set cookies for). Determine that by going
;; "upwards" in the base domain name.
(cl-loop while base-host
when (url-cookie-host-can-set-p
url-host (mapconcat #'identity base-host "."))
return t
do (pop base-host)
finally (return nil))))
(t
shr-cookie-policy)))