Merge "Decode the metadata response before sending it to the VM" into stable/2025.1
This commit is contained in:
@@ -33,6 +33,8 @@ LOG = logging.getLogger(__name__)
|
||||
PROXY_SERVICE_NAME = 'haproxy'
|
||||
PROXY_SERVICE_CMD = 'haproxy'
|
||||
|
||||
CONTENT_ENCODERS = ('gzip', 'deflate')
|
||||
|
||||
|
||||
class InvalidUserOrGroupException(Exception):
|
||||
pass
|
||||
@@ -162,6 +164,12 @@ class MetadataProxyHandlerBaseSocketServer(
|
||||
status=http_response.status_code,
|
||||
content_type=http_response.headers['content-type'],
|
||||
charset=http_response.encoding)
|
||||
# The content of the response is decoded depending on the
|
||||
# "Context-Enconding" header, if present. The operation is limited to
|
||||
# ("gzip", "deflate"), as is in the ``webob.response.Response`` class.
|
||||
if _res.content_encoding in CONTENT_ENCODERS:
|
||||
_res.decode_content()
|
||||
|
||||
# NOTE(ralonsoh): there should be a better way to format the HTTP
|
||||
# response, adding the HTTP version to the ``webob.Response``
|
||||
# output string.
|
||||
|
||||
Reference in New Issue
Block a user