diff options
| author | Dmitry Gutov | 2016-08-11 21:06:49 +0300 |
|---|---|---|
| committer | Dmitry Gutov | 2016-08-11 21:06:49 +0300 |
| commit | 75f1882479cc62f8795bb652a0853a3f395420a2 (patch) | |
| tree | 8d17f455be4a66937b74aed90ca5d62daf11cd23 | |
| parent | d2db5dd8358f132252c8d11d40b1457615c43a57 (diff) | |
| download | emacs-75f1882479cc62f8795bb652a0853a3f395420a2.tar.gz emacs-75f1882479cc62f8795bb652a0853a3f395420a2.zip | |
Convert the remaining strings to unibyte before concatenating
* lisp/url/url-http.el (url-http--encode-string): New function.
(url-http-create-request): Use it to convert ASCII to unibyte.
(Bug#24117)
| -rw-r--r-- | lisp/url/url-http.el | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/lisp/url/url-http.el b/lisp/url/url-http.el index 7156e6fa4ea..860e6529365 100644 --- a/lisp/url/url-http.el +++ b/lisp/url/url-http.el | |||
| @@ -235,7 +235,7 @@ request.") | |||
| 235 | 'url-http-proxy-basic-auth-storage)) | 235 | 'url-http-proxy-basic-auth-storage)) |
| 236 | (url-get-authentication url-http-proxy nil 'any nil)))) | 236 | (url-get-authentication url-http-proxy nil 'any nil)))) |
| 237 | (real-fname (url-filename url-http-target-url)) | 237 | (real-fname (url-filename url-http-target-url)) |
| 238 | (host (url-host url-http-target-url)) | 238 | (host (url-http--encode-string (url-host url-http-target-url))) |
| 239 | (auth (if (cdr-safe (assoc "Authorization" url-http-extra-headers)) | 239 | (auth (if (cdr-safe (assoc "Authorization" url-http-extra-headers)) |
| 240 | nil | 240 | nil |
| 241 | (url-get-authentication (or | 241 | (url-get-authentication (or |
| @@ -278,7 +278,8 @@ request.") | |||
| 278 | (concat | 278 | (concat |
| 279 | ;; The request | 279 | ;; The request |
| 280 | (or url-http-method "GET") " " | 280 | (or url-http-method "GET") " " |
| 281 | (if using-proxy (url-recreate-url url-http-target-url) real-fname) | 281 | (url-http--encode-string |
| 282 | (if using-proxy (url-recreate-url url-http-target-url) real-fname)) | ||
| 282 | " HTTP/" url-http-version "\r\n" | 283 | " HTTP/" url-http-version "\r\n" |
| 283 | ;; Version of MIME we speak | 284 | ;; Version of MIME we speak |
| 284 | "MIME-Version: 1.0\r\n" | 285 | "MIME-Version: 1.0\r\n" |
| @@ -360,6 +361,11 @@ request.") | |||
| 360 | (url-http-debug "Request is: \n%s" request) | 361 | (url-http-debug "Request is: \n%s" request) |
| 361 | request)) | 362 | request)) |
| 362 | 363 | ||
| 364 | (defun url-http--encode-string (s) | ||
| 365 | (if (multibyte-string-p s) | ||
| 366 | (encode-coding-string s 'us-ascii) | ||
| 367 | s)) | ||
| 368 | |||
| 363 | ;; Parsing routines | 369 | ;; Parsing routines |
| 364 | (defun url-http-clean-headers () | 370 | (defun url-http-clean-headers () |
| 365 | "Remove trailing \r from header lines. | 371 | "Remove trailing \r from header lines. |