read body until content-length or MEMFILE_MAX into a string. Raise HTTPError(413) on requests that are to large.
(self)
| 1182 | return body |
| 1183 | |
| 1184 | def _get_body_string(self): |
| 1185 | ''' read body until content-length or MEMFILE_MAX into a string. Raise |
| 1186 | HTTPError(413) on requests that are to large. ''' |
| 1187 | clen = self.content_length |
| 1188 | if clen > self.MEMFILE_MAX: |
| 1189 | raise HTTPError(413, 'Request to large') |
| 1190 | if clen < 0: clen = self.MEMFILE_MAX + 1 |
| 1191 | data = self.body.read(clen) |
| 1192 | if len(data) > self.MEMFILE_MAX: # Fail fast |
| 1193 | raise HTTPError(413, 'Request to large') |
| 1194 | return data |
| 1195 | |
| 1196 | @property |
| 1197 | def body(self): |