Commit c773edcf authored by Michael Albinus's avatar Michael Albinus

* 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.
parent 8032fc16
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>
* subr.el (sit-for): Tweak docstring (bug#19381).
......
......@@ -195,11 +195,12 @@ instead of the host name declared in TARGET-VEC."
(setq tramp-gw-gw-proc
(funcall
socks-function
(tramp-get-connection-name gw-vec)
(tramp-get-connection-buffer gw-vec)
(let ((tramp-verbose 0)) (tramp-get-connection-name gw-vec))
(let ((tramp-verbose 0)) (tramp-get-connection-buffer gw-vec))
(tramp-file-name-real-host target-vec)
(tramp-file-name-port target-vec)))
(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-message
vec 4 "Opened %s process `%s'"
......@@ -260,6 +261,10 @@ authentication is requested from proxy server, provide it."
(200 (setq found t))
;; We need basic authentication.
(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.
(404 (tramp-error-with-buffer
(current-buffer) tramp-gw-vector 'file-error
......
......@@ -4470,7 +4470,8 @@ Gateway hops are already opened."
;; Therefore, we must remember the gateway vector. But we
;; cannot do it as connection property, because it shouldn't
;; 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.
(when (cdr target-alist)
......@@ -4646,7 +4647,8 @@ connection if a previous connection has died for some reason."
l-method 'tramp-connection-timeout))
(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-user (and gw (tramp-file-name-user 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)))
;; Add gateway arguments if necessary.
(when (and gw gw-args)
(setq login-args (append gw-args login-args)))
(when gw
(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
;; need for handling like method, user, host.
......
......@@ -1610,7 +1610,7 @@ an input event arrives. The other arguments are passed to `tramp-error'."
(let ((enable-recursive-minibuffers t))
;; `tramp-error' does not show messages. So we must do it
;; ourselves.
(message fmt-string arguments)
(apply 'message fmt-string arguments)
;; Show buffer.
(pop-to-buffer buf)
(discard-input)
......@@ -3609,15 +3609,19 @@ connection buffer."
This is needed in order to hide `last-coding-system-used', which is set
for process communication also."
(with-current-buffer (process-buffer proc)
(tramp-message proc 10 "%s %s" proc (process-status proc))
(let (buffer-read-only last-coding-system-used)
;; FIXME: If there is a gateway process, we need communication
;; 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
;; sometimes. So we add an additional timeout.
(with-timeout ((or timeout 1))
(if (featurep 'xemacs)
(accept-process-output proc timeout timeout-msecs)
(accept-process-output proc timeout timeout-msecs (and proc t)))))
(tramp-message proc 10 "\n%s" (buffer-string))))
(accept-process-output p timeout timeout-msecs)
(accept-process-output p timeout timeout-msecs (and proc t))))
(tramp-message proc 10 "%s %s %s\n%s"
proc (process-status proc) p (buffer-string)))))
(defun tramp-check-for-regexp (proc regexp)
"Check, whether REGEXP is contained in process buffer of PROC.
......
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