# HG changeset patch # User Julien Cristau # Date 1404812012 -7200 # Node ID e013c35067d7f3098891085e6f1d30a5b8a1bf09 # Parent 228c3571e22227d1af55681ed93f24cab6dad382 [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. diff -r 228c3571e222 -r e013c35067d7 etwist/server.py --- 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'})