From: Glenn Morris Date: Mon, 16 Sep 2013 21:28:11 +0000 (-0400) Subject: * lisp/url/url-misc.el (url-data): Avoid match-data mix-up with base64 case. X-Git-Tag: emacs-24.3.90~173^2^2~42^2~45^2~387^2~1598 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=a19f6c6396b17d3c9cc54076b7965855ad6851e9;p=emacs.git * lisp/url/url-misc.el (url-data): Avoid match-data mix-up with base64 case. Use Content-Transfer-Encoding rather than Content-Encoding. Fixes: debbugs:15285 --- diff --git a/lisp/url/ChangeLog b/lisp/url/ChangeLog index 3f48b8ff431..817130c5184 100644 --- a/lisp/url/ChangeLog +++ b/lisp/url/ChangeLog @@ -1,3 +1,8 @@ +2013-09-16 Glenn Morris + + * url-misc.el (url-data): Avoid match-data mix-up with base64 case. + Use Content-Transfer-Encoding rather than Content-Encoding. (Bug#15285) + 2013-09-13 Glenn Morris * url-http.el (url-handle-content-transfer-encoding): diff --git a/lisp/url/url-misc.el b/lisp/url/url-misc.el index c8e9b591790..ecc602940f3 100644 --- a/lisp/url/url-misc.el +++ b/lisp/url/url-misc.el @@ -1,7 +1,6 @@ ;;; url-misc.el --- Misc Uniform Resource Locator retrieval code -;; Copyright (C) 1996-1999, 2002, 2004-2013 Free Software Foundation, -;; Inc. +;; Copyright (C) 1996-1999, 2002, 2004-2013 Free Software Foundation, Inc. ;; Keywords: comm, data, processes @@ -89,19 +88,19 @@ (save-excursion (if (not (string-match "\\([^,]*\\)?," desc)) (error "Malformed data URL: %s" desc) - (setq mediatype (match-string 1 desc)) + (setq mediatype (match-string 1 desc) + data (url-unhex-string (substring desc (match-end 0)))) (if (and mediatype (string-match ";base64\\'" mediatype)) (setq mediatype (substring mediatype 0 (match-beginning 0)) encoding "base64")) (if (or (null mediatype) (eq ?\; (aref mediatype 0))) - (setq mediatype (concat "text/plain" mediatype))) - (setq data (url-unhex-string (substring desc (match-end 0))))) + (setq mediatype (concat "text/plain" mediatype)))) (set-buffer (generate-new-buffer " *url-data*")) (mm-disable-multibyte) (insert (format "Content-Length: %d\n" (length data)) "Content-Type: " mediatype "\n" - "Content-Encoding: " encoding "\n" + "Content-Transfer-Encoding: " encoding "\n" "\n") (if data (insert data)) (current-buffer))))