Uploaded image for project: 'Libcloud'
  1. Libcloud
  2. LIBCLOUD-939

libcloud.common.base.Connection accepts gzip but doesn't decode gzip



    • Type: Bug
    • Status: Open
    • Priority: Major
    • Resolution: Unresolved
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: Storage
    • Labels:


      (The drop-down didn't let me select version 1.1.0).

      The `Connection` class adds `Accept-Encoding` for `gzip,deflate` to the header, but it doesn't do anything if it actually receives a `Content-Encoding` of those types. I noticed this when using the Generic S3 interface to NetApp StorageGRID. It had previously worked, but the server was updated and started gzipping responses. The server also indicated this by setting `Content-Encoding` to `gzip` in the response header.

      Here's the part of the routine that sets the header:

          def request(self, action, params=None, data=None, headers=None,
                      method='GET', raw=False):
              headers.update({'Accept-Encoding': 'gzip,deflate'})

      I verified this was the problem by commenting out that line. The StorageGRID no longer sent gzipped responses

      I noticed that 2.0.0 there was a curious comment in `libcloud.http`:

       def getheaders(self):
              # urlib decoded response body, libcloud has a bug
              # and will not check if content is gzipped, so let's
              # remove headers indicating compressed content.
              if 'content-encoding' in self.response.headers:
                  del self.response.headers['content-encoding']
              return self.response.headers

      I'm not entirely sure what that accomplishes because if the `Accept-Encoding` was set, then deleting the `Content-Encoding` on the response doesn't change that it was, in fact, gzipped. I freely admit I have not looked at 2.0.0 beyond this and my observation may be worth less than nothing.




            • Assignee:
              chris@infinite.io Chris
            • Votes:
              0 Vote for this issue
              1 Start watching this issue


              • Created: