diff options
| author | Lars Ingebrigtsen | 2015-12-29 00:11:06 +0100 |
|---|---|---|
| committer | Lars Ingebrigtsen | 2015-12-29 00:11:06 +0100 |
| commit | 8b61c22ea1a53167dae2e39eb318ceeb326cdff5 (patch) | |
| tree | c7cb2237f598b7aa478a97ac04af8f5ca9df18f7 | |
| parent | fc3965ed9b19bdd167a466a06181c88ad59a57de (diff) | |
| download | emacs-8b61c22ea1a53167dae2e39eb318ceeb326cdff5.tar.gz emacs-8b61c22ea1a53167dae2e39eb318ceeb326cdff5.zip | |
IDNA-related fixes for the URL library
* 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.
| -rw-r--r-- | lisp/url/url-http.el | 6 | ||||
| -rw-r--r-- | lisp/url/url-util.el | 2 |
2 files changed, 5 insertions, 3 deletions
diff --git a/lisp/url/url-http.el b/lisp/url/url-http.el index 916f263e4fe..258f8025662 100644 --- a/lisp/url/url-http.el +++ b/lisp/url/url-http.el | |||
| @@ -26,6 +26,7 @@ | |||
| 26 | ;;; Code: | 26 | ;;; Code: |
| 27 | 27 | ||
| 28 | (require 'cl-lib) | 28 | (require 'cl-lib) |
| 29 | (require 'puny) | ||
| 29 | (eval-when-compile | 30 | (eval-when-compile |
| 30 | (require 'subr-x)) | 31 | (require 'subr-x)) |
| 31 | 32 | ||
| @@ -318,8 +319,9 @@ request.") | |||
| 318 | (url-scheme-get-property | 319 | (url-scheme-get-property |
| 319 | (url-type url-http-target-url) 'default-port)) | 320 | (url-type url-http-target-url) 'default-port)) |
| 320 | (format | 321 | (format |
| 321 | "Host: %s:%d\r\n" host (url-port url-http-target-url)) | 322 | "Host: %s:%d\r\n" (puny-encode-domain host) |
| 322 | (format "Host: %s\r\n" host)) | 323 | (url-port url-http-target-url)) |
| 324 | (format "Host: %s\r\n" (puny-encode-domain host))) | ||
| 323 | ;; Who its from | 325 | ;; Who its from |
| 324 | (if url-personal-mail-address | 326 | (if url-personal-mail-address |
| 325 | (concat | 327 | (concat |
diff --git a/lisp/url/url-util.el b/lisp/url/url-util.el index e011b96ada2..54b02e98c97 100644 --- a/lisp/url/url-util.el +++ b/lisp/url/url-util.el | |||
| @@ -468,7 +468,7 @@ should return it unchanged." | |||
| 468 | (and host | 468 | (and host |
| 469 | (not (string-match "\\`\\[.*\\]\\'" host)) | 469 | (not (string-match "\\`\\[.*\\]\\'" host)) |
| 470 | (setf (url-host obj) | 470 | (setf (url-host obj) |
| 471 | (url-hexify-string host url-host-allowed-chars))) | 471 | (decode-coding-string (url-host obj) 'utf-8))) |
| 472 | 472 | ||
| 473 | (if path | 473 | (if path |
| 474 | (setq path (url-hexify-string path url-path-allowed-chars))) | 474 | (setq path (url-hexify-string path url-path-allowed-chars))) |