summaryrefslogtreecommitdiff
path: root/lisp
diff options
context:
space:
mode:
authorEli Zaretskii <eliz@gnu.org>2019-08-14 17:53:14 +0300
committerEli Zaretskii <eliz@gnu.org>2019-08-14 17:53:14 +0300
commit629068a89d1b2a7babbed7d3f5778834a970de16 (patch)
tree2fa8bdf886ee6dce0ea9cd9a8349f6017fd620cb /lisp
parentf4974d6fe6137f436763998be27afafea9866098 (diff)
downloademacs-629068a89d1b2a7babbed7d3f5778834a970de16.tar.gz
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)
Diffstat (limited to 'lisp')
-rw-r--r--lisp/url/url-http.el4
1 files changed, 4 insertions, 0 deletions
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)