Commit 75f18824 authored by Dmitry Gutov's avatar Dmitry Gutov
Browse files

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.
parent d2db5dd8
...@@ -235,7 +235,7 @@ request.") ...@@ -235,7 +235,7 @@ request.")
'url-http-proxy-basic-auth-storage)) 'url-http-proxy-basic-auth-storage))
(url-get-authentication url-http-proxy nil 'any nil)))) (url-get-authentication url-http-proxy nil 'any nil))))
(real-fname (url-filename url-http-target-url)) (real-fname (url-filename url-http-target-url))
(host (url-host url-http-target-url)) (host (url-http--encode-string (url-host url-http-target-url)))
(auth (if (cdr-safe (assoc "Authorization" url-http-extra-headers)) (auth (if (cdr-safe (assoc "Authorization" url-http-extra-headers))
nil nil
(url-get-authentication (or (url-get-authentication (or
...@@ -278,7 +278,8 @@ request.") ...@@ -278,7 +278,8 @@ request.")
(concat (concat
;; The request ;; The request
(or url-http-method "GET") " " (or url-http-method "GET") " "
(if using-proxy (url-recreate-url url-http-target-url) real-fname) (url-http--encode-string
(if using-proxy (url-recreate-url url-http-target-url) real-fname))
" HTTP/" url-http-version "\r\n" " HTTP/" url-http-version "\r\n"
;; Version of MIME we speak ;; Version of MIME we speak
"MIME-Version: 1.0\r\n" "MIME-Version: 1.0\r\n"
...@@ -360,6 +361,11 @@ request.") ...@@ -360,6 +361,11 @@ request.")
(url-http-debug "Request is: \n%s" request) (url-http-debug "Request is: \n%s" request)
request)) request))
(defun url-http--encode-string (s)
(if (multibyte-string-p s)
(encode-coding-string s 'us-ascii)
;; Parsing routines ;; Parsing routines
(defun url-http-clean-headers () (defun url-http-clean-headers ()
"Remove trailing \r from header lines. "Remove trailing \r from header lines.
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment