Merge "py3: Make etag-quoter work"

This commit is contained in:
Zuul 2020-04-29 19:45:56 +00:00 committed by Gerrit Code Review
commit 7bff34c5d3

View File

@ -105,11 +105,11 @@ class EtagQuoterMiddleware(object):
status, headers, resp_iter = req.call_application(self.app) status, headers, resp_iter = req.call_application(self.app)
for i, (header, value) in enumerate(headers): headers = [
if header.lower() == 'etag': (header, value) if header.lower() != 'etag' or (
if not value.startswith(('"', 'W/"')) or \ value.startswith(('"', 'W/"')) and value.endswith('"'))
not value.endswith('"'): else (header, '"%s"' % value)
headers[i] = (header, '"%s"' % value) for header, value in headers]
start_response(status, headers) start_response(status, headers)
return resp_iter return resp_iter