176 orig_gotLength(self, length) |
176 orig_gotLength(self, length) |
177 if length > MAX_POST_LENGTH: # length is 0 on GET |
177 if length > MAX_POST_LENGTH: # length is 0 on GET |
178 path = self.channel._path.split('?', 1)[0].rstrip('/').rsplit('/', 1)[-1] |
178 path = self.channel._path.split('?', 1)[0].rstrip('/').rsplit('/', 1)[-1] |
179 self.clientproto = 'HTTP/1.1' # not yet initialized |
179 self.clientproto = 'HTTP/1.1' # not yet initialized |
180 self.channel.persistent = 0 # force connection close on cleanup |
180 self.channel.persistent = 0 # force connection close on cleanup |
181 self.setResponseCode(http.BAD_REQUEST) |
181 self.setResponseCode(http.REQUEST_ENTITY_TOO_LARGE) |
182 if path in JSON_PATHS: # XXX better json path detection |
182 if path in JSON_PATHS: # XXX better json path detection |
183 self.setHeader('content-type',"application/json") |
183 self.setHeader('content-type',"application/json") |
184 body = json_dumps({'reason': 'request max size exceeded'}) |
184 body = json_dumps({'reason': 'request max size exceeded'}) |
185 elif path in FRAME_POST_PATHS: # XXX better frame post path detection |
185 elif path in FRAME_POST_PATHS: # XXX better frame post path detection |
186 self.setHeader('content-type',"text/html") |
186 self.setHeader('content-type',"text/html") |