]> git.eshelyaron.com Git - emacs.git/commitdiff
Fix fetching URLs with stuff that looks like HTTP headers
authorEli Zaretskii <eliz@gnu.org>
Wed, 14 Aug 2019 14:53:14 +0000 (17:53 +0300)
committerEli Zaretskii <eliz@gnu.org>
Wed, 14 Aug 2019 14:53:14 +0000 (17:53 +0300)
* lisp/url/url-http.el (url-http-parse-headers): Narrow the
buffer to the headers at the beginning to make sure
url-handle-content-transfer-encoding uses the correct
headers.  (Bug#37023)

lisp/url/url-http.el

index 9b690778fc0f9759f8ed8413754fafc91c30d1cb..94d1ba9668b921d0987dbc7bf2244cc9abee8380 100644 (file)
@@ -949,6 +949,10 @@ should be shown to the user."
              class url-http-response-status)))
     (if (not success)
        (url-mark-buffer-as-dead buffer)
+      ;; Narrow the buffer for url-handle-content-transfer-encoding to
+      ;; find only the headers relevant to this transaction.
+      (and (not (buffer-narrowed-p)
+                (mail-narrow-to-head)))
       (url-handle-content-transfer-encoding))
     (url-http-debug "Finished parsing HTTP headers: %S" success)
     (widen)