libcloud-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Chris (JIRA)" <>
Subject [jira] [Created] (LIBCLOUD-939) libcloud.common.base.Connection accepts gzip but doesn't decode gzip
Date Wed, 16 Aug 2017 19:20:00 GMT
Chris created LIBCLOUD-939:

             Summary: libcloud.common.base.Connection accepts gzip but doesn't decode gzip
                 Key: LIBCLOUD-939
             Project: Libcloud
          Issue Type: Bug
          Components: Storage
            Reporter: Chris

(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.

This message was sent by Atlassian JIRA

View raw message