Skip to content

Commit

Permalink
[FIX] web: /web/image: conforming HTTP status line
Browse files Browse the repository at this point in the history
HTTP status lines are required to have both
a status code *and* a "reason phrase".

Some stricter HTTP clients / proxies choke
on status lines without "reason".

Technically, setting `response.status` is supposed
to set both at the same time, so we need to provide
both, or to set `status_code` only and let werkzeug
add the reason.  This patch does the latter.

Fixes odoo#8924
  • Loading branch information
odony committed Oct 22, 2015
1 parent 6c8e53a commit 807e776
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion addons/web/controllers/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -1088,7 +1088,7 @@ def content_image(self, xmlid=None, model='ir.attachment', id=None, field='datas
image_base64 = content and base64.b64decode(content) or self.placeholder()
headers.append(('Content-Length', len(image_base64)))
response = request.make_response(image_base64, headers)
response.status = str(status)
response.status_code = status
return response

# backward compatibility
Expand Down

0 comments on commit 807e776

Please sign in to comment.