'read body until content-length or MEMFILE_MAX into a string. Raise
HTTPError(413) on requests that are to large.'

def _get_body_string(self):

    clen = self.content_length
    if (clen > self.MEMFILE_MAX):
        raise HTTPError(413, 'Request    entity    too    large')
    if (clen < 0):
        clen = (self.MEMFILE_MAX + 1)
    data = self.body.read(clen)
    if (len(data) > self.MEMFILE_MAX):
        raise HTTPError(413, 'Request    entity    too    large')
    return data
