1
0
mirror of https://git.savannah.gnu.org/git/emacs.git synced 2024-11-26 07:33:47 +00:00

* net/tramp-gw.el (tramp-gw-open-connection): Suppress traces in

wrong debug buffer.
(tramp-gw-open-connection): Set process coding system 'binary.
(tramp-gw-open-network-stream): Handle HTTP error 403.

* net/tramp-sh.el (tramp-compute-multi-hops): Suppress traces in
wrong debug buffer.
(tramp-maybe-open-connection): Set connection property "gateway".

* net/tramp.el (tramp-error-with-buffer): Call `message' properly.
(tramp-accept-process-output): Use nil as argument for
`accept-process-output', when there is a gateway prepended.
This commit is contained in:
Michael Albinus 2014-12-17 22:08:30 +01:00
parent 8032fc16db
commit c773edcf56
4 changed files with 40 additions and 12 deletions

View File

@ -1,3 +1,18 @@
2014-12-17 Michael Albinus <michael.albinus@gmx.de>
* net/tramp.el (tramp-error-with-buffer): Call `message' properly.
(tramp-accept-process-output): Use nil as argument for
`accept-process-output', when there is a gateway prepended.
* net/tramp-gw.el (tramp-gw-open-connection): Suppress traces in
wrong debug buffer.
(tramp-gw-open-connection): Set process coding system 'binary.
(tramp-gw-open-network-stream): Handle HTTP error 403.
* net/tramp-sh.el (tramp-compute-multi-hops): Suppress traces in
wrong debug buffer.
(tramp-maybe-open-connection): Set connection property "gateway".
2014-12-15 Stefan Monnier <monnier@iro.umontreal.ca> 2014-12-15 Stefan Monnier <monnier@iro.umontreal.ca>
* subr.el (sit-for): Tweak docstring (bug#19381). * subr.el (sit-for): Tweak docstring (bug#19381).

View File

@ -195,11 +195,12 @@ instead of the host name declared in TARGET-VEC."
(setq tramp-gw-gw-proc (setq tramp-gw-gw-proc
(funcall (funcall
socks-function socks-function
(tramp-get-connection-name gw-vec) (let ((tramp-verbose 0)) (tramp-get-connection-name gw-vec))
(tramp-get-connection-buffer gw-vec) (let ((tramp-verbose 0)) (tramp-get-connection-buffer gw-vec))
(tramp-file-name-real-host target-vec) (tramp-file-name-real-host target-vec)
(tramp-file-name-port target-vec))) (tramp-file-name-port target-vec)))
(set-process-sentinel tramp-gw-gw-proc 'tramp-gw-gw-proc-sentinel) (set-process-sentinel tramp-gw-gw-proc 'tramp-gw-gw-proc-sentinel)
(set-process-coding-system tramp-gw-gw-proc 'binary 'binary)
(tramp-compat-set-process-query-on-exit-flag tramp-gw-gw-proc nil) (tramp-compat-set-process-query-on-exit-flag tramp-gw-gw-proc nil)
(tramp-message (tramp-message
vec 4 "Opened %s process `%s'" vec 4 "Opened %s process `%s'"
@ -260,6 +261,10 @@ authentication is requested from proxy server, provide it."
(200 (setq found t)) (200 (setq found t))
;; We need basic authentication. ;; We need basic authentication.
(401 (setq authentication (tramp-gw-basic-authentication nil first))) (401 (setq authentication (tramp-gw-basic-authentication nil first)))
;; Access forbidden.
(403 (tramp-error-with-buffer
(current-buffer) tramp-gw-vector 'file-error
"Connection to %s:%d forbidden." host service))
;; Target host not found. ;; Target host not found.
(404 (tramp-error-with-buffer (404 (tramp-error-with-buffer
(current-buffer) tramp-gw-vector 'file-error (current-buffer) tramp-gw-vector 'file-error

View File

@ -4470,7 +4470,8 @@ Gateway hops are already opened."
;; Therefore, we must remember the gateway vector. But we ;; Therefore, we must remember the gateway vector. But we
;; cannot do it as connection property, because it shouldn't ;; cannot do it as connection property, because it shouldn't
;; be persistent. And we have no started process yet either. ;; be persistent. And we have no started process yet either.
(tramp-set-file-property (car target-alist) "" "gateway" hop))) (let ((tramp-verbose 0))
(tramp-set-file-property (car target-alist) "" "gateway" hop))))
;; Foreign and out-of-band methods are not supported for multi-hops. ;; Foreign and out-of-band methods are not supported for multi-hops.
(when (cdr target-alist) (when (cdr target-alist)
@ -4646,7 +4647,8 @@ connection if a previous connection has died for some reason."
l-method 'tramp-connection-timeout)) l-method 'tramp-connection-timeout))
(gw-args (gw-args
(tramp-get-method-parameter l-method 'tramp-gw-args)) (tramp-get-method-parameter l-method 'tramp-gw-args))
(gw (tramp-get-file-property hop "" "gateway" nil)) (gw (let ((tramp-verbose 0))
(tramp-get-file-property hop "" "gateway" nil)))
(g-method (and gw (tramp-file-name-method gw))) (g-method (and gw (tramp-file-name-method gw)))
(g-user (and gw (tramp-file-name-user gw))) (g-user (and gw (tramp-file-name-user gw)))
(g-host (and gw (tramp-file-name-real-host gw))) (g-host (and gw (tramp-file-name-real-host gw)))
@ -4674,8 +4676,10 @@ connection if a previous connection has died for some reason."
(setq login-args (append async-args login-args))) (setq login-args (append async-args login-args)))
;; Add gateway arguments if necessary. ;; Add gateway arguments if necessary.
(when (and gw gw-args) (when gw
(setq login-args (append gw-args login-args))) (tramp-set-connection-property p "gateway" t)
(when gw-args
(setq login-args (append gw-args login-args))))
;; Check for port number. Until now, there's no ;; Check for port number. Until now, there's no
;; need for handling like method, user, host. ;; need for handling like method, user, host.

View File

@ -1610,7 +1610,7 @@ an input event arrives. The other arguments are passed to `tramp-error'."
(let ((enable-recursive-minibuffers t)) (let ((enable-recursive-minibuffers t))
;; `tramp-error' does not show messages. So we must do it ;; `tramp-error' does not show messages. So we must do it
;; ourselves. ;; ourselves.
(message fmt-string arguments) (apply 'message fmt-string arguments)
;; Show buffer. ;; Show buffer.
(pop-to-buffer buf) (pop-to-buffer buf)
(discard-input) (discard-input)
@ -3609,15 +3609,19 @@ connection buffer."
This is needed in order to hide `last-coding-system-used', which is set This is needed in order to hide `last-coding-system-used', which is set
for process communication also." for process communication also."
(with-current-buffer (process-buffer proc) (with-current-buffer (process-buffer proc)
(tramp-message proc 10 "%s %s" proc (process-status proc)) ;; FIXME: If there is a gateway process, we need communication
(let (buffer-read-only last-coding-system-used) ;; between several processes. Too complicate to implement, so we
;; read output from all proceeses.
(let ((p (if (tramp-get-connection-property proc "gateway" nil) nil proc))
buffer-read-only last-coding-system-used)
;; Under Windows XP, accept-process-output doesn't return ;; Under Windows XP, accept-process-output doesn't return
;; sometimes. So we add an additional timeout. ;; sometimes. So we add an additional timeout.
(with-timeout ((or timeout 1)) (with-timeout ((or timeout 1))
(if (featurep 'xemacs) (if (featurep 'xemacs)
(accept-process-output proc timeout timeout-msecs) (accept-process-output p timeout timeout-msecs)
(accept-process-output proc timeout timeout-msecs (and proc t))))) (accept-process-output p timeout timeout-msecs (and proc t))))
(tramp-message proc 10 "\n%s" (buffer-string)))) (tramp-message proc 10 "%s %s %s\n%s"
proc (process-status proc) p (buffer-string)))))
(defun tramp-check-for-regexp (proc regexp) (defun tramp-check-for-regexp (proc regexp)
"Check, whether REGEXP is contained in process buffer of PROC. "Check, whether REGEXP is contained in process buffer of PROC.