How to use the cheroot.errors.MaxSizeExceeded function in cheroot

To help you get started, we’ve selected a few cheroot examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github cherrypy / cheroot / cheroot / server.py View on Github external
def _fetch(self):
        if self.closed:
            return

        line = self.rfile.readline()
        self.bytes_read += len(line)

        if self.maxlen and self.bytes_read > self.maxlen:
            raise errors.MaxSizeExceeded(
                'Request Entity Too Large', self.maxlen,
            )

        line = line.strip().split(SEMICOLON, 1)

        try:
            chunk_size = line.pop(0)
            chunk_size = int(chunk_size, 16)
        except ValueError:
            raise ValueError(
                'Bad chunked transfer size: {chunk_size!r}'.
                format(chunk_size=chunk_size),
            )

        if chunk_size <= 0:
            self.closed = True
github cherrypy / cheroot / cheroot / server.py View on Github external
def _check_length(self):
        if self.maxlen and self.bytes_read > self.maxlen:
            raise errors.MaxSizeExceeded()