Skip to content

Commit e8709e7

Browse files
committed
Handle subdomains in Tramp ad-hoc proxies
* lisp/net/tramp-sh.el (tramp-compute-multi-hops): Add proper regexps to `tramp-default-proxies-alist'.
1 parent 510aa75 commit e8709e7

File tree

1 file changed

+12
-14
lines changed

1 file changed

+12
-14
lines changed

lisp/net/tramp-sh.el

Lines changed: 12 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -4622,21 +4622,19 @@ Goes through the list `tramp-inline-compress-commands'."
46224622

46234623
;; Ad-hoc proxy definitions.
46244624
(dolist (proxy (reverse (split-string hops tramp-postfix-hop-regexp 'omit)))
4625-
(let ((user-domain (tramp-file-name-user-domain item))
4626-
(host-port (tramp-file-name-host-port item))
4627-
(proxy (concat
4628-
tramp-prefix-format proxy tramp-postfix-host-format)))
4629-
(tramp-message
4630-
vec 5 "Add proxy (\"%s\" \"%s\" \"%s\")"
4631-
(and (stringp host-port) (regexp-quote host-port))
4632-
(and (stringp user-domain) (regexp-quote user-domain))
4633-
proxy)
4625+
(let* ((host-port (tramp-file-name-host-port item))
4626+
(user-domain (tramp-file-name-user-domain item))
4627+
(proxy (concat
4628+
tramp-prefix-format proxy tramp-postfix-host-format))
4629+
(entry
4630+
(list (and (stringp host-port)
4631+
(concat "^" (regexp-quote host-port) "$"))
4632+
(and (stringp user-domain)
4633+
(concat "^" (regexp-quote user-domain) "$"))
4634+
(propertize proxy 'tramp-ad-hoc t))))
4635+
(tramp-message vec 5 "Add %S to `tramp-default-proxies-alist'" entry)
46344636
;; Add the hop.
4635-
(add-to-list
4636-
'tramp-default-proxies-alist
4637-
(list (and (stringp host-port) (regexp-quote host-port))
4638-
(and (stringp user-domain) (regexp-quote user-domain))
4639-
(propertize proxy 'tramp-ad-hoc t)))
4637+
(add-to-list 'tramp-default-proxies-alist entry)
46404638
(setq item (tramp-dissect-file-name proxy))))
46414639
;; Save the new value.
46424640
(when (and hops tramp-save-ad-hoc-proxies)

0 commit comments

Comments
 (0)