Skip to content
Snippets Groups Projects
Commit 07a207c0 authored by andreparames's avatar andreparames Committed by xmo-odoo
Browse files

[FIX] ETag value must be quote-delimited

According to RFC 7232 # 2.3, an etag must be wrapped in double quotes:

    entity-tag = [ weak ] opaque-tag
    opaque-tag = DQUOTE *etagc DQUOTE
    etagc      = %x21 / %x23-7E / obs-text
               ; VCHAR except double quotes, plus obs-text

Odoo didn't properly quote etags, which could lead to stripping or
failures when putting Odoo behind strict HTTP proxies.
parent 9a5b040f
Branches
Tags
No related merge requests found
......@@ -302,7 +302,7 @@ class ir_http(osv.AbstractModel):
# cache
etag = hasattr(request, 'httprequest') and request.httprequest.headers.get('If-None-Match')
retag = hashlib.md5(last_update).hexdigest()
retag = '"%s"' % hashlib.md5(last_update).hexdigest()
status = status or (304 if etag == retag else 200)
headers.append(('ETag', retag))
headers.append(('Cache-Control', 'max-age=%s' % (STATIC_CACHE if unique else 0)))
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment