[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

master 5d2a83e: url-http: Fix handling of redirect locations

From: Lars Ingebrigtsen
Subject: master 5d2a83e: url-http: Fix handling of redirect locations
Date: Sun, 19 Jul 2020 15:17:19 -0400 (EDT)

branch: master
commit 5d2a83ea0e79308f85d06553483001b7cb2e3a14
Author: Daniele Nicolodi <daniele@grinta.net>
Commit: Lars Ingebrigtsen <larsi@gnus.org>

    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
 lisp/url/url-http.el | 10 +---------
 1 file changed, 1 insertion(+), 9 deletions(-)

diff --git a/lisp/url/url-http.el b/lisp/url/url-http.el
index c8a2da0..8532da1 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'
         (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.

reply via email to

[Prev in Thread] Current Thread [Next in Thread]