summaryrefslogtreecommitdiff
path: root/lisp/url
diff options
context:
space:
mode:
authorDaniele Nicolodi <daniele@grinta.net>2020-07-19 21:16:55 +0200
committerLars Ingebrigtsen <larsi@gnus.org>2020-07-19 21:16:55 +0200
commit5d2a83ea0e79308f85d06553483001b7cb2e3a14 (patch)
treebe18318c697ffbe106507dd9a63764a217b0e54e /lisp/url
parentf8f3e77fa83a3a97e5a0de8a7c75092cadf82627 (diff)
downloademacs-5d2a83ea0e79308f85d06553483001b7cb2e3a14.tar.gz
emacs-5d2a83ea0e79308f85d06553483001b7cb2e3a14.tar.bz2
emacs-5d2a83ea0e79308f85d06553483001b7cb2e3a14.zip
url-http: Fix handling of redirect locations
* lisp/url/url-http.el (url-http-parse-headers): Parse redirect URIs more like other web browsers (bug#42382). RFC 7231 the Location header is defined to carry a URI-reference. According to RFC 3986 it should be percent-encoded and thus should not contain spaces. However, there are HTTP server implementation (notably nginx) that do not do that. This makes Emacs url-http.el behave like most other HTTP client implementatios. Also remove the stripping of angle bracket quotes as they are not valid according to the RFCs. Copyright-paperwork-exempt: yes
Diffstat (limited to 'lisp/url')
-rw-r--r--lisp/url/url-http.el10
1 files changed, 1 insertions, 9 deletions
diff --git a/lisp/url/url-http.el b/lisp/url/url-http.el
index c8a2da05469..8532da1d1fb 100644
--- a/lisp/url/url-http.el
+++ b/lisp/url/url-http.el
@@ -702,15 +702,7 @@ should be shown to the user."
;; Treat everything like '300'
nil))
(when redirect-uri
- ;; Clean off any whitespace and/or <...> cruft.
- (if (string-match "\\([^ \t]+\\)[ \t]" redirect-uri)
- (setq redirect-uri (match-string 1 redirect-uri)))
- (if (string-match "^<\\(.*\\)>$" redirect-uri)
- (setq redirect-uri (match-string 1 redirect-uri)))
-
- ;; Some stupid sites (like sourceforge) send a
- ;; non-fully-qualified URL (ie: /), which royally confuses
- ;; the URL library.
+ ;; Handle relative redirect URIs.
(if (not (string-match url-nonrelative-link redirect-uri))
;; Be careful to use the real target URL, otherwise we may
;; compute the redirection relative to the URL of the proxy.