summaryrefslogtreecommitdiff
path: root/lisp/url/url-http.el
diff options
context:
space:
mode:
Diffstat (limited to 'lisp/url/url-http.el')
-rw-r--r--lisp/url/url-http.el14
1 files changed, 13 insertions, 1 deletions
diff --git a/lisp/url/url-http.el b/lisp/url/url-http.el
index 7f21a38c535..beffbe1f79b 100644
--- a/lisp/url/url-http.el
+++ b/lisp/url/url-http.el
@@ -851,11 +851,23 @@ should be shown to the user."
(error "Unknown class of HTTP response code: %d (%d)"
class url-http-response-status)))
(if (not success)
- (url-mark-buffer-as-dead buffer))
+ (url-mark-buffer-as-dead buffer)
+ (url-handle-content-transfer-encoding))
(url-http-debug "Finished parsing HTTP headers: %S" success)
(widen)
success))
+(defun url-handle-content-transfer-encoding ()
+ (let ((encoding (mail-fetch-field "content-encoding")))
+ (when (and encoding
+ (fboundp 'decompress-gzipped-region)
+ (equal (downcase encoding) "gzip"))
+ (save-restriction
+ (widen)
+ (goto-char (point-min))
+ (when (search-forward "\n\n")
+ (decompress-gzipped-region (point) (point-max)))))))
+
;; Miscellaneous
(defun url-http-activate-callback ()
"Activate callback specified when this buffer was created."