[Fedora-suds-list] Gzip compression

Daniel Rodriguez danjrod at gmail.com
Sat Apr 3 00:14:40 UTC 2010


Hi Jeff et al,

If I am not wrong (I may have missed a configuration option), suds is not
using or requesting gzip compression.

I have added a few lines and tested at least requesting and accepting gzip
compression. My changes have been trivial and this could be possibly added
as an option to suds.

The changes I have made (against 3.9):

*File*: suds/transport/http.py:
*
*
*Extra imports*:

import gzip
import StringIO

*Class*: HttpTransport
*Method*: send

*Added:*

After:

   - headers = request.headers

added the following line

   - headers.update([('Accept-Encoding', 'gzip')])

*Changed:*

   - result = Reply(200, fp.headers.dict, fp.read())

to

   - replydata = fp.read()
   - for header in fp.headers.dict.keys():
   -      if header.lower() == 'content-encoding' and
   fp.headers.dict[header] == 'gzip':
   -          replydatacompressedstream = StringIO.StringIO(replydata)
   -          gzipper = gzip.GzipFile(fileobj=replydatacompressedstream)
   -          replydata = gzipper.read()
   - result = Reply(200, fp.headers.dict, replydata)

Best regards

Daniel
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.fedoraproject.org/pipermail/suds/attachments/20100403/124fcafa/attachment.html 


More information about the suds mailing list