[
https://issues.apache.org/jira/browse/LIBCLOUD-598?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14066242#comment-14066242
]
ASF GitHub Bot commented on LIBCLOUD-598:
-----------------------------------------
GitHub user JuanCarlosM opened a pull request:
https://github.com/apache/libcloud/pull/342
[LIBCLOUD-598] IOError, 'Not a gzipped file' on LINODE driver
You can merge this pull request into a Git repository by running:
$ git pull https://github.com/ecmanaged/libcloud trunk
Alternatively you can review and apply these changes as the patch at:
https://github.com/apache/libcloud/pull/342.patch
To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:
This closes #342
----
commit 2964a267ae85c3606f1090f62a702cacdd530b58
Author: Juan Carlos Moreno <[email protected]>
Date: 2014-07-18T10:32:43Z
[LIBCLOUD-598] IOError, 'Not a gzipped file' on LINODE driver
----
> IOError, 'Not a gzipped file' on LINODE driver
> ----------------------------------------------
>
> Key: LIBCLOUD-598
> URL: https://issues.apache.org/jira/browse/LIBCLOUD-598
> Project: Libcloud
> Issue Type: Bug
> Components: Compute
> Reporter: Juan Carlos Moreno
>
> Linode response has "Content-Encoding: gzip" but plain text body is returned:
> Request:
> curl -i -X GET -H 'Host: api.linode.com' -H 'Accept-Encoding: gzip,deflate'
> --compress
> 'https://api.linode.com:443/?api_key=*********&api_responseFormat=json&api_action=avail.datacenters'
> Response:
> HTTP/1.1 200 OK
> Server: nginx/1.1.19
> Date: Fri, 18 Jul 2014 09:47:34 GMT
> Content-Type: application/json;charset=UTF-8
> Transfer-Encoding: chunked
> Connection: keep-alive
> X-Powered-By: Tiger Blood
> Vary: Accept-Encoding
> Content-Encoding: gzip
> Strict-Transport-Security: max-age=31536000
> {"ERRORARRAY":[],"DATA":[{"LOCATION":"Dallas, TX,
> USA","DATACENTERID":2,"ABBR":"dallas"},{"LOCATION":"Fremont, CA,
> USA","DATACENTERID":3,"ABBR":"fremont"},{"LOCATION":"Atlanta, GA,
> USA","DATACENTERID":4,"ABBR":"atlanta"},{"LOCATION":"Newark, NJ,
> USA","DATACENTERID":6,"ABBR":"newark"},{"LOCATION":"London, England,
> UK","DATACENTERID":7,"ABBR":"london"},{"LOCATION":"Tokyo,
> JP","DATACENTERID":8,"ABBR":"tokyo"}],"ACTION":"avail.datacenters"}
> Exception:
> File ".libcloud/compute/drivers/ecm_linode.py", line 119, in list_nodes
> data = self.connection.request(API_ROOT, params=params).objects[0]
> File ".libcloud/common/base.py", line 687, in request
> response = responseCls(**kwargs)
> File ".libcloud/common/linode.py", line 91, in __init__
> headers=self.headers)
> File ".libcloud/common/base.py", line 172, in _decompress_response
> body = decompress_data('gzip', body)
> File ".libcloud/utils/compression.py", line 39, in decompress_data
> return gzip.GzipFile(fileobj=cls(data)).read()
> File "/usr/lib/python2.6/gzip.py", line 212, in read
> self._read(readsize)
> File "/usr/lib/python2.6/gzip.py", line 255, in _read
> self._read_gzip_header()
> File "/usr/lib/python2.6/gzip.py", line 156, in _read_gzip_header
> raise IOError, 'Not a gzipped file'
> Proposed solution (caught IOError exception and continue)
> libcloud/common/linode.py
> < self.body = self._decompress_response(body=response.read(),
> ---
> > # ECmanaged: Linode hack
> > # sends "Content-Encoding: gzip" header but a plain/text response
> >
> > response_read = response.read()
> >
> > try:
> > self.body = self._decompress_response(body=response_read,
> 91a97,98
> > except IOError:
> > self.body = response_read.strip()
--
This message was sent by Atlassian JIRA
(v6.2#6252)