]> git.eshelyaron.com Git - emacs.git/commitdiff
IDNA-related fixes for the URL library
authorLars Ingebrigtsen <larsi@gnus.org>
Mon, 28 Dec 2015 23:11:06 +0000 (00:11 +0100)
committerLars Ingebrigtsen <larsi@gnus.org>
Mon, 28 Dec 2015 23:11:06 +0000 (00:11 +0100)
* lisp/url/url-http.el (url-http-create-request): IDNA-encode
the Host: header.

* lisp/url/url-util.el (url-encode-url): Don't hex-encode
domain names, but leave them as UTF-8, so that they can be
IDNA-encoded later when contacting the host.

lisp/url/url-http.el
lisp/url/url-util.el

index 916f263e4fee797c1ec328318ae03619feabf777..258f8025662ae5342e26bdd84d051095f98652bc 100644 (file)
@@ -26,6 +26,7 @@
 ;;; Code:
 
 (require 'cl-lib)
+(require 'puny)
 (eval-when-compile
   (require 'subr-x))
 
@@ -318,8 +319,9 @@ request.")
                      (url-scheme-get-property
                       (url-type url-http-target-url) 'default-port))
                  (format
-                  "Host: %s:%d\r\n" host (url-port url-http-target-url))
-               (format "Host: %s\r\n" host))
+                  "Host: %s:%d\r\n" (puny-encode-domain host)
+                  (url-port url-http-target-url))
+               (format "Host: %s\r\n" (puny-encode-domain host)))
              ;; Who its from
              (if url-personal-mail-address
                  (concat
index e011b96ada236d5fe320120fa24656ab914bdd13..54b02e98c97f0eae6ad664f5aa718f0037f6138c 100644 (file)
@@ -468,7 +468,7 @@ should return it unchanged."
     (and host
         (not (string-match "\\`\\[.*\\]\\'" host))
         (setf (url-host obj)
-              (url-hexify-string host url-host-allowed-chars)))
+               (decode-coding-string (url-host obj) 'utf-8)))
 
     (if path
        (setq path (url-hexify-string path url-path-allowed-chars)))