summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRyan Petrello <lists@ryanpetrello.com>2014-04-12 08:00:33 -0700
committerChristina Darretta <darrettac@gmail.com>2014-10-07 00:11:32 +0000
commit2a546acf22bc99c61277c370baa8a773baf3f68d (patch)
tree8c74510f4cecf51d758004e8d14634581fc7351b
parentcbdb9220e36fd2778a84da62d599bec492d057ae (diff)
downloadceilometer-2a546acf22bc99c61277c370baa8a773baf3f68d.tar.gz
Fix a response header bug in the error middleware
Coerce the Content-Length of the custom error message to a string, not an integer. Some pure Python WSGI servers aren't strict and violate the WSGI specification by automatically converting the value to a string. Apache, however, *is* strict, and considers this a 500 Internal Error Fixes bug 1306963 Change-Id: I9b82ceee096b00c21c3b230dc67701bc40629968 (cherry picked from commit 381d9ba941e93386000dd29b9426358efb7713f7)
-rw-r--r--ceilometer/api/middleware.py2
1 files changed, 1 insertions, 1 deletions
diff --git a/ceilometer/api/middleware.py b/ceilometer/api/middleware.py
index 3e9bfc67..2e04c516 100644
--- a/ceilometer/api/middleware.py
+++ b/ceilometer/api/middleware.py
@@ -124,7 +124,7 @@ class ParsableErrorMiddleware(object):
except ValueError as err:
body = [json.dumps({'error_message': '\n'.join(app_iter)})]
state['headers'].append(('Content-Type', 'application/json'))
- state['headers'].append(('Content-Length', len(body[0])))
+ state['headers'].append(('Content-Length', str(len(body[0]))))
else:
body = app_iter
return body