diff options
| author | Lars Magne Ingebrigtsen | 2013-08-11 22:52:50 +0200 |
|---|---|---|
| committer | Lars Magne Ingebrigtsen | 2013-08-11 22:52:50 +0200 |
| commit | 6edea0a595d292c4d3f1a7e862195be07c874e40 (patch) | |
| tree | a549ff4fd0125216dd39280a2e742eb086aed221 | |
| parent | 99a32242b364793076b4b03310c435d4828ef6e4 (diff) | |
| download | emacs-6edea0a595d292c4d3f1a7e862195be07c874e40.tar.gz emacs-6edea0a595d292c4d3f1a7e862195be07c874e40.zip | |
Add Content-Transfer gzip support to url
* url-http.el (url-handle-content-transfer-encoding): Support
decompressing gzipped content.
* url-vars.el (url-mime-encoding-string): If we have built-in gzip
support, say that we accept gzipped content.
| -rw-r--r-- | lisp/url/ChangeLog | 8 | ||||
| -rw-r--r-- | lisp/url/url-http.el | 14 | ||||
| -rw-r--r-- | lisp/url/url-vars.el | 4 |
3 files changed, 23 insertions, 3 deletions
diff --git a/lisp/url/ChangeLog b/lisp/url/ChangeLog index 120d00002e4..9bdaff6f51a 100644 --- a/lisp/url/ChangeLog +++ b/lisp/url/ChangeLog | |||
| @@ -1,3 +1,11 @@ | |||
| 1 | 2013-08-11 Lars Magne Ingebrigtsen <larsi@gnus.org> | ||
| 2 | |||
| 3 | * url-vars.el (url-mime-encoding-string): If we have built-in gzip | ||
| 4 | support, say that we accept gzipped content. | ||
| 5 | |||
| 6 | * url-http.el (url-handle-content-transfer-encoding): Support | ||
| 7 | decompressing gzipped content. | ||
| 8 | |||
| 1 | 2013-07-31 Stefan Monnier <monnier@iro.umontreal.ca> | 9 | 2013-07-31 Stefan Monnier <monnier@iro.umontreal.ca> |
| 2 | 10 | ||
| 3 | * url-handlers.el (url-file-name-completion) | 11 | * url-handlers.el (url-file-name-completion) |
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." | |||
| 851 | (error "Unknown class of HTTP response code: %d (%d)" | 851 | (error "Unknown class of HTTP response code: %d (%d)" |
| 852 | class url-http-response-status))) | 852 | class url-http-response-status))) |
| 853 | (if (not success) | 853 | (if (not success) |
| 854 | (url-mark-buffer-as-dead buffer)) | 854 | (url-mark-buffer-as-dead buffer) |
| 855 | (url-handle-content-transfer-encoding)) | ||
| 855 | (url-http-debug "Finished parsing HTTP headers: %S" success) | 856 | (url-http-debug "Finished parsing HTTP headers: %S" success) |
| 856 | (widen) | 857 | (widen) |
| 857 | success)) | 858 | success)) |
| 858 | 859 | ||
| 860 | (defun url-handle-content-transfer-encoding () | ||
| 861 | (let ((encoding (mail-fetch-field "content-encoding"))) | ||
| 862 | (when (and encoding | ||
| 863 | (fboundp 'decompress-gzipped-region) | ||
| 864 | (equal (downcase encoding) "gzip")) | ||
| 865 | (save-restriction | ||
| 866 | (widen) | ||
| 867 | (goto-char (point-min)) | ||
| 868 | (when (search-forward "\n\n") | ||
| 869 | (decompress-gzipped-region (point) (point-max))))))) | ||
| 870 | |||
| 859 | ;; Miscellaneous | 871 | ;; Miscellaneous |
| 860 | (defun url-http-activate-callback () | 872 | (defun url-http-activate-callback () |
| 861 | "Activate callback specified when this buffer was created." | 873 | "Activate callback specified when this buffer was created." |
diff --git a/lisp/url/url-vars.el b/lisp/url/url-vars.el index 6cd0e9aec3c..a59667b57b0 100644 --- a/lisp/url/url-vars.el +++ b/lisp/url/url-vars.el | |||
| @@ -210,8 +210,8 @@ Should be an assoc list of headers/contents.") | |||
| 210 | 210 | ||
| 211 | (defvar url-request-method nil "The method to use for the next request.") | 211 | (defvar url-request-method nil "The method to use for the next request.") |
| 212 | 212 | ||
| 213 | ;; FIXME!! (RFC 2616 gives examples like `compress, gzip'.) | 213 | (defvar url-mime-encoding-string (and (fboundp 'decompress-gzipped-region) |
| 214 | (defvar url-mime-encoding-string nil | 214 | "gzip") |
| 215 | "String to send in the Accept-encoding: field in HTTP requests.") | 215 | "String to send in the Accept-encoding: field in HTTP requests.") |
| 216 | 216 | ||
| 217 | (defvar mm-mime-mule-charset-alist) | 217 | (defvar mm-mime-mule-charset-alist) |