Skip to content

Commit d233075

Browse files
authored
Ssh session flags (#224)
* Added libssh2 session flag constants. * Added Session.flag function for adding flags. * Updated changelog. * Added tests for session flags. * Added CI integration test for executing with session compression enabled. * Updated embedded zlib to latest version. * Updated appveyor zlib build script.
1 parent 3b880a0 commit d233075

File tree

299 files changed

+85612
-70314
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

299 files changed

+85612
-70314
lines changed

Changelog.rst

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,16 @@
11
Change Log
22
=============
33

4+
1.2.0
5+
++++++
6+
7+
Changes
8+
--------
9+
10+
* Added constants for session related flags under `ssh2.session`.
11+
* Added `ssh2.session.Session.flag` function for enabling/disabling session flags like compression support.
12+
13+
414
1.1.2
515
++++++
616

ci/appveyor/build_zlib.bat

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ IF "%PYTHON_VERSION%" == "2.7" (exit 0)
22

33
mkdir zlib_build && cd zlib_build
44

5-
cmake ..\zlib-1.2.11 ^
5+
cmake ..\zlib-1.3.1 ^
66
-A x64 ^
77
-DCMAKE_INSTALL_PREFIX="C:\zlib" ^
88
-DCMAKE_BUILD_TYPE=Release ^

ci/integration_tests/test_channel.py

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,13 @@
11
import os
2+
import socket
23
from subprocess import check_output
34
from unittest import skipUnless
45

6+
7+
from ssh2.session import Session
58
from ssh2.channel import Channel
69
from ssh2.exceptions import SocketSendError
10+
from ssh2.session import LIBSSH2_METHOD_COMP_CS, LIBSSH2_FLAG_COMPRESS
711

812
from .base_test import SSH2TestCase
913

@@ -193,3 +197,20 @@ def test_multi_execute(self):
193197
self.assertTrue(chan.execute(self.cmd) == 0)
194198
size, data = chan.read()
195199
self.assertTrue(size > 0)
200+
201+
def test_execute_with_session_compression(self):
202+
sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
203+
sock.connect((self.host, self.port))
204+
session = Session()
205+
session.flag(LIBSSH2_FLAG_COMPRESS)
206+
algs = session.supported_algs(LIBSSH2_METHOD_COMP_CS)
207+
self.assertTrue('zlib' in algs)
208+
session.handshake(sock)
209+
session.userauth_publickey_fromfile(
210+
self.user, self.user_key)
211+
chan = session.open_session()
212+
self.assertTrue(chan is not None)
213+
self.assertTrue(chan.execute(self.cmd) == 0)
214+
size, data = chan.read()
215+
lines = [line.decode('utf-8') for line in data.splitlines()]
216+
self.assertTrue(lines, [self.resp])

setup.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -99,9 +99,10 @@
9999
version=versioneer.get_version(),
100100
cmdclass=cmdclass,
101101
url='https://github.com/ParallelSSH/ssh2-python',
102-
license='LGPLv2',
102+
license='LGPL-2.1-only',
103+
license_files=['LICENSE', 'COPYING'],
103104
author='Panos Kittenis',
104-
author_email='22e889d8@opayq.com',
105+
author_email='danst@tutanota.com',
105106
description='Bindings for libssh2 C library',
106107
long_description=open('README.rst').read(),
107108
packages=find_packages(
@@ -113,7 +114,6 @@
113114
platforms='any',
114115
classifiers=[
115116
'Development Status :: 5 - Production/Stable',
116-
'License :: OSI Approved :: GNU Lesser General Public License v2 (LGPLv2)',
117117
'Intended Audience :: Developers',
118118
'Operating System :: OS Independent',
119119
'Programming Language :: C',
@@ -124,6 +124,7 @@
124124
'Programming Language :: Python :: 3.10',
125125
'Programming Language :: Python :: 3.11',
126126
'Programming Language :: Python :: 3.12',
127+
'Programming Language :: Python :: 3.13',
127128
'Topic :: System :: Shells',
128129
'Topic :: System :: Networking',
129130
'Topic :: Software Development :: Libraries',

0 commit comments

Comments
 (0)