aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRobert Pluim2025-06-10 09:52:39 +0200
committerRobert Pluim2025-06-11 17:10:46 +0200
commit7e62c2cf3aadb52397bcff8439d00084cd36afa0 (patch)
tree40b6a66b582fddd5370b3ec8c7c70ab530ad3d5b
parent8be65cf6e02ffdc6396af61a13413c7065c832d9 (diff)
downloademacs-7e62c2cf3aadb52397bcff8439d00084cd36afa0.tar.gz
emacs-7e62c2cf3aadb52397bcff8439d00084cd36afa0.zip
Normalize URL path correctly for http
* lisp/url/url-http.el (url-http-create-request): Prepend "/" if it's missing from the filename. (Bug#78640)
-rw-r--r--lisp/url/url-http.el6
1 files changed, 4 insertions, 2 deletions
diff --git a/lisp/url/url-http.el b/lisp/url/url-http.el
index 4258da33a33..eb5d5c13722 100644
--- a/lisp/url/url-http.el
+++ b/lisp/url/url-http.el
@@ -325,8 +325,10 @@ Use `url-http-referer' as the Referer-header (subject to `url-privacy-level')."
325 url-http-target-url) 325 url-http-target-url)
326 nil 'any nil))) 326 nil 'any nil)))
327 (ref-url (url-http--encode-string url-http-referer))) 327 (ref-url (url-http--encode-string url-http-referer)))
328 (if (equal "" real-fname) 328 ;; RFC 3986 section 6.2.3 says an empty path should be normalized to
329 (setq real-fname "/")) 329 ;; "/", even if the filename is non-empty. (Bug#78640)
330 (unless (string-match-p "\\`/" real-fname)
331 (setq real-fname (concat "/" real-fname)))
330 (setq no-cache (and no-cache (string-match "no-cache" no-cache))) 332 (setq no-cache (and no-cache (string-match "no-cache" no-cache)))
331 (if auth 333 (if auth
332 (setq auth (concat "Authorization: " auth "\r\n"))) 334 (setq auth (concat "Authorization: " auth "\r\n")))