You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@libcloud.apache.org by an...@apache.org on 2017/04/06 02:33:08 UTC

[2/4] libcloud git commit: add fix by removing inline decoding in the library

add fix by removing inline decoding in the library


Project: http://git-wip-us.apache.org/repos/asf/libcloud/repo
Commit: http://git-wip-us.apache.org/repos/asf/libcloud/commit/a4830d2d
Tree: http://git-wip-us.apache.org/repos/asf/libcloud/tree/a4830d2d
Diff: http://git-wip-us.apache.org/repos/asf/libcloud/diff/a4830d2d

Branch: refs/heads/trunk
Commit: a4830d2d34ea1d08e0c715ec9ea50733e4a8a78a
Parents: 4e5ddfb
Author: Anthony Shaw <an...@apache.org>
Authored: Thu Apr 6 11:35:50 2017 +1000
Committer: Anthony Shaw <an...@apache.org>
Committed: Thu Apr 6 11:35:50 2017 +1000

----------------------------------------------------------------------
 libcloud/test/test_logging_connection.py | 4 ++--
 libcloud/utils/loggingconnection.py      | 6 ------
 2 files changed, 2 insertions(+), 8 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/libcloud/blob/a4830d2d/libcloud/test/test_logging_connection.py
----------------------------------------------------------------------
diff --git a/libcloud/test/test_logging_connection.py b/libcloud/test/test_logging_connection.py
index ed1fc5a..c1dbee6 100644
--- a/libcloud/test/test_logging_connection.py
+++ b/libcloud/test/test_logging_connection.py
@@ -52,19 +52,19 @@ class TestLoggingConnection(unittest.TestCase):
         self.assertIn('data', log)
 
     def test_debug_log_class_handles_request_with_compression(self):
+        request = zlib.compress(b'data')
         with StringIO() as fh:
             libcloud.enable_debug(fh)
             conn = Connection(url='http://test.com/')
             conn.connect()
             self.assertEqual(conn.connection.host, 'http://test.com')
             with requests_mock.mock() as m:
-                m.get('http://test.com/test', content=zlib.compress(b'test'),
+                m.get('http://test.com/test', content=request,
                       headers={'content-encoding': 'zlib'})
                 conn.request('/test')
             log = fh.getvalue()
         self.assertTrue(isinstance(conn.connection, LoggingConnection))
         self.assertIn('-i -X GET', log)
-        self.assertIn('data', log)
 
 if __name__ == '__main__':
     sys.exit(unittest.main())

http://git-wip-us.apache.org/repos/asf/libcloud/blob/a4830d2d/libcloud/utils/loggingconnection.py
----------------------------------------------------------------------
diff --git a/libcloud/utils/loggingconnection.py b/libcloud/utils/loggingconnection.py
index 1e3ff41..7756b13 100644
--- a/libcloud/utils/loggingconnection.py
+++ b/libcloud/utils/loggingconnection.py
@@ -62,14 +62,8 @@ class LoggingConnection(LibcloudConnection):
 
         headers = lowercase_keys(dict(r.getheaders()))
 
-        encoding = headers.get('content-encoding', None)
         content_type = headers.get('content-type', None)
 
-        if encoding in ['zlib', 'deflate']:
-            body = decompress_data('zlib', body)
-        elif encoding in ['gzip', 'x-gzip']:
-            body = decompress_data('gzip', body)
-
         pretty_print = os.environ.get('LIBCLOUD_DEBUG_PRETTY_PRINT_RESPONSE',
                                       False)