summaryrefslogtreecommitdiff
path: root/lisp/url/url-http.el
diff options
context:
space:
mode:
authorPo Lu <luangruo@yahoo.com>2022-08-04 15:52:03 +0800
committerPo Lu <luangruo@yahoo.com>2022-08-04 15:52:03 +0800
commitb49c1740105dd3715315aa433674c95f44aaeac4 (patch)
treef6820c9378e814dce219dcb62b9bd7d64daf8f60 /lisp/url/url-http.el
parent78129dcf53ab2b1ce49eab28dba89dea9f687284 (diff)
downloademacs-b49c1740105dd3715315aa433674c95f44aaeac4.tar.gz
emacs-b49c1740105dd3715315aa433674c95f44aaeac4.tar.bz2
emacs-b49c1740105dd3715315aa433674c95f44aaeac4.zip
Fix about:protocols in EWW
* lisp/net/eww.el (eww--dwim-expand-url): Handle `about: ' URLs. (bug#56885) * lisp/url/url-about.el (url-about): Return correct content type for HTML data. * lisp/url/url-http.el (url-http--get-referer): Refrain from looking for a referrer if the lastloc had no host.
Diffstat (limited to 'lisp/url/url-http.el')
-rw-r--r--lisp/url/url-http.el48
1 files changed, 26 insertions, 22 deletions
diff --git a/lisp/url/url-http.el b/lisp/url/url-http.el
index 125f8436f68..e2d28974b66 100644
--- a/lisp/url/url-http.el
+++ b/lisp/url/url-http.el
@@ -237,28 +237,32 @@ request.")
(if (not (url-p url-current-lastloc))
(setq url-current-lastloc (url-generic-parse-url url-current-lastloc)))
(let ((referer (copy-sequence url-current-lastloc)))
- (setf (url-host referer) (puny-encode-domain (url-host referer)))
- (let ((referer-string (url-recreate-url referer)))
- (when (and (not (memq url-privacy-level '(low high paranoid)))
- (not (and (listp url-privacy-level)
- (memq 'lastloc url-privacy-level))))
- ;; url-privacy-level allows referer. But url-lastloc-privacy-level
- ;; may restrict who we send it to.
- (cl-case url-lastloc-privacy-level
- (host-match
- (let ((referer-host (url-host referer))
- (url-host (url-host url)))
- (when (string= referer-host url-host)
- referer-string)))
- (domain-match
- (let ((referer-domain (url-domain referer))
- (url-domain (url-domain url)))
- (when (and referer-domain
- url-domain
- (string= referer-domain url-domain))
- referer-string)))
- (otherwise
- referer-string)))))))
+ ;; In the case of `url-about', there is actually no host.
+ (if (url-host referer)
+ (progn
+ (setf (url-host referer) (puny-encode-domain (url-host referer)))
+ (let ((referer-string (url-recreate-url referer)))
+ (when (and (not (memq url-privacy-level '(low high paranoid)))
+ (not (and (listp url-privacy-level)
+ (memq 'lastloc url-privacy-level))))
+ ;; url-privacy-level allows referer. But url-lastloc-privacy-level
+ ;; may restrict who we send it to.
+ (cl-case url-lastloc-privacy-level
+ (host-match
+ (let ((referer-host (url-host referer))
+ (url-host (url-host url)))
+ (when (string= referer-host url-host)
+ referer-string)))
+ (domain-match
+ (let ((referer-domain (url-domain referer))
+ (url-domain (url-domain url)))
+ (when (and referer-domain
+ url-domain
+ (string= referer-domain url-domain))
+ referer-string)))
+ (otherwise
+ referer-string)))))
+ nil))))
;; Building an HTTP request
(defun url-http-user-agent-string ()