[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] master e310843: Don't double-decompress cached HTTP respon
From: |
Eli Zaretskii |
Subject: |
[Emacs-diffs] master e310843: Don't double-decompress cached HTTP responses (bug#36773) |
Date: |
Sat, 27 Jul 2019 06:58:14 -0400 (EDT) |
branch: master
commit e310843d9dc106187d0e45ef7f0b9cd90a881eec
Author: Pip Cet <address@hidden>
Commit: Eli Zaretskii <address@hidden>
Don't double-decompress cached HTTP responses (bug#36773)
* lisp/url/url-http.el (url-handle-content-transfer-encoding): Modify
the message headers as well as the message body to reflect
decompression.
* lisp/mail/mail-utils.el (mail-fetch-field): Add DELETE argument, to
delete header lines included in the result.
---
lisp/mail/mail-utils.el | 13 ++++++++++---
lisp/url/url-http.el | 2 +-
2 files changed, 11 insertions(+), 4 deletions(-)
diff --git a/lisp/mail/mail-utils.el b/lisp/mail/mail-utils.el
index cbcbdfa..fd00dd1 100644
--- a/lisp/mail/mail-utils.el
+++ b/lisp/mail/mail-utils.el
@@ -284,11 +284,13 @@ comma-separated list, and return the pruned list."
;;;###autoload
-(defun mail-fetch-field (field-name &optional last all list)
+(defun mail-fetch-field (field-name &optional last all list delete)
"Return the value of the header field whose type is FIELD-NAME.
If second arg LAST is non-nil, use the last field of type FIELD-NAME.
If third arg ALL is non-nil, concatenate all such fields with commas between.
If 4th arg LIST is non-nil, return a list of all such fields.
+If 5th arg DELETE is non-nil, delete all header lines that are
+included in the result.
The buffer should be narrowed to just the header, else false
matches may be returned from the message body."
(save-excursion
@@ -311,7 +313,9 @@ matches may be returned from the message body."
(setq value (concat value
(if (string= value "") "" ", ")
(buffer-substring-no-properties
- opoint (point)))))))
+ opoint (point)))))
+ (if delete
+ (delete-region (point-at-bol) (point)))))
(if list
value
(and (not (string= value "")) value)))
@@ -324,7 +328,10 @@ matches may be returned from the message body."
;; Back up over newline, then trailing spaces or tabs
(forward-char -1)
(skip-chars-backward " \t" opoint)
- (buffer-substring-no-properties opoint (point)))))))))
+ (prog1
+ (buffer-substring-no-properties opoint (point))
+ (if delete
+ (delete-region (point-at-bol) (1+ (point))))))))))))
;; Parse a list of tokens separated by commas.
;; It runs from point to the end of the visible part of the buffer.
diff --git a/lisp/url/url-http.el b/lisp/url/url-http.el
index f7f2f3d..838f0a3 100644
--- a/lisp/url/url-http.el
+++ b/lisp/url/url-http.el
@@ -959,7 +959,7 @@ should be shown to the user."
(start end &optional allow-partial))
(defun url-handle-content-transfer-encoding ()
- (let ((encoding (mail-fetch-field "content-encoding")))
+ (let ((encoding (mail-fetch-field "content-encoding" nil nil nil t)))
(when (and encoding
(fboundp 'zlib-available-p)
(zlib-available-p)
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Emacs-diffs] master e310843: Don't double-decompress cached HTTP responses (bug#36773),
Eli Zaretskii <=