From: Eli Zaretskii Date: Wed, 14 Aug 2019 14:53:14 +0000 (+0300) Subject: Fix fetching URLs with stuff that looks like HTTP headers X-Git-Tag: emacs-27.0.90~1631 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=629068a89d1b2a7babbed7d3f5778834a970de16;p=emacs.git Fix fetching URLs with stuff that looks like HTTP headers * 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) --- diff --git a/lisp/url/url-http.el b/lisp/url/url-http.el index 9b690778fc0..94d1ba9668b 100644 --- a/lisp/url/url-http.el +++ b/lisp/url/url-http.el @@ -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)