def validate_and_store_body_data(self, data):
        """
        Attempts simple body data validation by comparining incoming
        data to the content length header.
        If passes store the data into self._buffer.

        Parameters:
            data (bytes): Incoming client data to be added to the body

        Raises:
            HTTPErrorBadRequest: Raised if data is sent when not
                expected, or if too much data is sent.
        """

        # add data to end of buffer
        self.body_buffer[-1:] = data

        #
        if len(self.body_buffer) > self.content_length:
            problem = "Content length exceeds expected value (%d > %d)" % (
                len(self.body_buffer), self.content_length
            )
            raise HTTPErrorBadRequest(phrase=problem)
def validate_and_store_body_data ( self , data ) : self . body_buffer [ - 1 : ] = data if len ( self . body_buffer ) > self . content_length : problem = "Content length exceeds expected value (%d > %d)" % ( len ( self . body_buffer ) , self . content_length ) raise HTTPErrorBadRequest ( phrase = problem )
Attempts simple body data validation by comparining incoming
        data to the content length header.
        If passes store the data into self._buffer.

        Parameters:
            data (bytes): Incoming client data to be added to the body

        Raises:
            HTTPErrorBadRequest: Raised if data is sent when not
                expected, or if too much data is sent.