emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] emacs-25 a98aa02: Error on multibyte characters in HTTP re


From: Dmitry Gutov
Subject: [Emacs-diffs] emacs-25 a98aa02: Error on multibyte characters in HTTP request
Date: Wed, 22 Jun 2016 18:20:46 +0000 (UTC)

branch: emacs-25
commit a98aa02a5dbf079f7b4f3be5487a2f2b741d103d
Author: Dmitry Gutov <address@hidden>
Commit: Dmitry Gutov <address@hidden>

    Error on multibyte characters in HTTP request
    
    * lisp/url/url-http.el (url-http-create-request): Check the
    constructed request in the end to verify that it does not contain
    multibyte characters (bug#23750).
---
 lisp/url/url-http.el |   19 +++++--------------
 1 file changed, 5 insertions(+), 14 deletions(-)

diff --git a/lisp/url/url-http.el b/lisp/url/url-http.el
index 5832e92..7156e6f 100644
--- a/lisp/url/url-http.el
+++ b/lisp/url/url-http.el
@@ -275,19 +275,7 @@ request.")
     ;; allows us to elide null lines directly, at the cost of making
     ;; the layout less clear.
     (setq request
-          ;; We used to concat directly, but if one of the strings happens
-          ;; to being multibyte (even if it only contains pure ASCII) then
-          ;; every string gets converted with `string-MAKE-multibyte' which
-          ;; turns the 127-255 codes into things like latin-1 accented chars
-          ;; (it would work right if it used `string-TO-multibyte' instead).
-          ;; So to avoid the problem we force every string to be unibyte.
-          (mapconcat
-           ;; FIXME: Instead of `string-AS-unibyte' we'd want
-           ;; `string-to-unibyte', so as to properly signal an error if one
-           ;; of the strings contains a multibyte char.
-           'string-as-unibyte
-           (delq nil
-            (list
+          (concat
              ;; The request
              (or url-http-method "GET") " "
              (if using-proxy (url-recreate-url url-http-target-url) real-fname)
@@ -365,7 +353,10 @@ request.")
              "\r\n"
              ;; Any data
              url-http-data))
-           ""))
+    ;; Bug#23750
+    (unless (= (string-bytes request)
+               (length request))
+      (error "Multibyte text in HTTP request: %s" request))
     (url-http-debug "Request is: \n%s" request)
     request))
 



reply via email to

[Prev in Thread] Current Thread [Next in Thread]