Skip to content

Commit

Permalink
patch from Michele Bertoldi to allow compression to be turned on in t…
Browse files Browse the repository at this point in the history
…he client constructor.
  • Loading branch information
Robey Pointer committed Apr 25, 2010
1 parent 3242df7 commit 188c82e
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions paramiko/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,8 @@ def set_missing_host_key_policy(self, policy):
self._policy = policy

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
is checked against the system host keys (see L{load_system_host_keys})
Expand Down Expand Up @@ -267,6 +268,8 @@ def connect(self, hostname, port=SSH_PORT, username=None, password=None, pkey=No
@param look_for_keys: set to False to disable searching for discoverable
private key files in C{~/.ssh/}
@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
verified
Expand All @@ -291,7 +294,7 @@ def connect(self, hostname, port=SSH_PORT, username=None, password=None, pkey=No
pass
sock.connect(addr)
t = self._transport = Transport(sock)

t.use_compression(compress=compress)
if self._log_channel is not None:
t.set_log_channel(self._log_channel)
t.start_client()
Expand Down

0 comments on commit 188c82e

Please sign in to comment.