summaryrefslogtreecommitdiff
path: root/lisp/url
diff options
context:
space:
mode:
authorSatoshi Nakagawa <ghnacker@gmail.com>2020-07-19 21:12:08 +0200
committerLars Ingebrigtsen <larsi@gnus.org>2020-07-19 21:12:17 +0200
commitf8f3e77fa83a3a97e5a0de8a7c75092cadf82627 (patch)
tree1e5f6ff247d62cdb9a74a0a80ffa157cb60d26d6 /lisp/url
parent13ca719a68e02fa0901546f1de7b0a4331a75f9e (diff)
downloademacs-f8f3e77fa83a3a97e5a0de8a7c75092cadf82627.tar.gz
Support Proxy-Authorization in HTTPS CONNECT proxies
* lisp/url/url-http.el (url-https-proxy-connect): Support CONNECT with Proxy-Authorization header (bug#42422). Copyright-paperwork-exempt: yes
Diffstat (limited to 'lisp/url')
-rw-r--r--lisp/url/url-http.el23
1 files changed, 16 insertions, 7 deletions
diff --git a/lisp/url/url-http.el b/lisp/url/url-http.el
index 669c24571f9..c8a2da05469 100644
--- a/lisp/url/url-http.el
+++ b/lisp/url/url-http.el
@@ -1404,13 +1404,22 @@ The return value of this function is the retrieval buffer."
(defun url-https-proxy-connect (connection)
(setq url-http-after-change-function 'url-https-proxy-after-change-function)
- (process-send-string connection (format (concat "CONNECT %s:%d HTTP/1.1\r\n"
- "Host: %s\r\n"
- "\r\n")
- (url-host url-current-object)
- (or (url-port url-current-object)
- url-https-default-port)
- (url-host url-current-object))))
+ (process-send-string
+ connection
+ (format
+ (concat "CONNECT %s:%d HTTP/1.1\r\n"
+ "Host: %s\r\n"
+ (let ((proxy-auth (let ((url-basic-auth-storage
+ 'url-http-proxy-basic-auth-storage))
+ (url-get-authentication url-http-proxy nil
+ 'any nil))))
+ (and proxy-auth
+ (concat "Proxy-Authorization: " proxy-auth "\r\n")))
+ "\r\n")
+ (url-host url-current-object)
+ (or (url-port url-current-object)
+ url-https-default-port)
+ (url-host url-current-object))))
(defun url-https-proxy-after-change-function (_st _nd _length)
(let* ((process-buffer (current-buffer))