[etwist] use more specific REQUEST_ENTITY_TOO_LARGE instead of BAD_REQUEST
When a request body exceeds the configured limit, return 413 to the
client instead of a generic 400.
--- a/etwist/server.py Tue Jul 08 10:34:50 2014 +0200
+++ b/etwist/server.py Tue Jul 08 11:33:32 2014 +0200
@@ -178,7 +178,7 @@
path = self.channel._path.split('?', 1)[0].rstrip('/').rsplit('/', 1)[-1]
self.clientproto = 'HTTP/1.1' # not yet initialized
self.channel.persistent = 0 # force connection close on cleanup
- self.setResponseCode(http.BAD_REQUEST)
+ self.setResponseCode(http.REQUEST_ENTITY_TOO_LARGE)
if path in JSON_PATHS: # XXX better json path detection
self.setHeader('content-type',"application/json")
body = json_dumps({'reason': 'request max size exceeded'})