|
|
@@ -102,7 +102,33 @@ class UrlBucket(Bucket):
|
|
|
LOG.debug(response)
|
|
|
LOG.debug(response.content)
|
|
|
|
|
|
- k = self.key_class(self, key_name)
|
|
|
+ response.getheader = response.headers.get
|
|
|
+ response.getheaders = lambda: response.headers
|
|
|
+
|
|
|
+ # Copy from boto2 bucket.py _get_key_internal()
|
|
|
+ if response.status_code / 100 == 2:
|
|
|
+ k = self.key_class(self)
|
|
|
+ provider = self.connection.provider
|
|
|
+ # k.metadata = boto.utils.get_aws_metadata(response.msg, provider)
|
|
|
+ for field in Key.base_fields:
|
|
|
+ k.__dict__[field.lower().replace('-', '_')] = \
|
|
|
+ response.getheader(field)
|
|
|
+ # the following machinations are a workaround to the fact that
|
|
|
+ # apache/fastcgi omits the content-length header on HEAD
|
|
|
+ # requests when the content-length is zero.
|
|
|
+ # See http://goo.gl/0Tdax for more details.
|
|
|
+ clen = response.getheader('content-length')
|
|
|
+ if clen:
|
|
|
+ k.size = int(response.getheader('content-length'))
|
|
|
+ else:
|
|
|
+ k.size = 0
|
|
|
+ k.name = key_name
|
|
|
+ k.handle_version_headers(response)
|
|
|
+ k.handle_encryption_headers(response)
|
|
|
+ k.handle_restore_headers(response)
|
|
|
+ k.handle_addl_headers(response.getheaders())
|
|
|
+ else:
|
|
|
+ k = None
|
|
|
|
|
|
return k
|
|
|
|