patch from Michele Bertoldi to allow compression to be turned on in the client constructor.

This commit is contained in:
Robey Pointer 2010-04-25 13:36:19 -07:00
parent 3242df7f09
commit 188c82eede
1 changed files with 5 additions and 2 deletions

View File

@ -226,7 +226,8 @@ class SSHClient (object):
self._policy = policy self._policy = policy
def connect(self, hostname, port=SSH_PORT, username=None, password=None, pkey=None, def connect(self, hostname, port=SSH_PORT, username=None, password=None, pkey=None,
key_filename=None, timeout=None, allow_agent=True, look_for_keys=True): key_filename=None, timeout=None, allow_agent=True, look_for_keys=True,
compress=False):
""" """
Connect to an SSH server and authenticate to it. The server's host key Connect to an SSH server and authenticate to it. The server's host key
is checked against the system host keys (see L{load_system_host_keys}) is checked against the system host keys (see L{load_system_host_keys})
@ -267,6 +268,8 @@ class SSHClient (object):
@param look_for_keys: set to False to disable searching for discoverable @param look_for_keys: set to False to disable searching for discoverable
private key files in C{~/.ssh/} private key files in C{~/.ssh/}
@type look_for_keys: bool @type look_for_keys: bool
@param compress: set to True to turn on compression
@type compress: bool
@raise BadHostKeyException: if the server's host key could not be @raise BadHostKeyException: if the server's host key could not be
verified verified
@ -291,7 +294,7 @@ class SSHClient (object):
pass pass
sock.connect(addr) sock.connect(addr)
t = self._transport = Transport(sock) t = self._transport = Transport(sock)
t.use_compression(compress=compress)
if self._log_channel is not None: if self._log_channel is not None:
t.set_log_channel(self._log_channel) t.set_log_channel(self._log_channel)
t.start_client() t.start_client()