kpumuk commented on code in PR #3408:
URL: https://github.com/apache/thrift/pull/3408#discussion_r3107418821


##########
lib/py/src/transport/THeaderTransport.py:
##########
@@ -276,8 +282,17 @@ def _parse_header_format(self, buffer):
 
         payload = buffer.read()
         for transform_id in transforms:
-            transform_fn = READ_TRANSFORMS_BY_ID[transform_id]
-            payload = transform_fn(payload)
+            if transform_id == THeaderTransformID.ZLIB:
+                decompressor = zlib.decompressobj()
+                payload = decompressor.decompress(payload, 
self._max_decompressed_size)

Review Comment:
   Feels like the logic of hanlding zip files is spread across the file. We 
define a function to unzip the paload in READ_TRANSFORMS_BY_ID (method 
pointer), and then have custom implementation here. Maybe it is possible to 
define something like `handler_transform_zlib(payload)` and then point at it in 
`READ_TRANSFORMS_BY_ID`? this logic can move there and we will have zlib 
handler localized in a single method.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to