Example #1
0
    def _fix_content_length(self, head, postdata):
        """
        The user may have changed the postdata of the request, and not the
        content-length header; so we are going to fix that problem.
        """
        fuzzable_request = HTTPRequestParser(head, postdata)
        
        if fuzzable_request.get_data() is None:
            # Nothing to do here
            return head, postdata
        
        headers = fuzzable_request.get_headers()
        headers['content-length'] = [str(len(fuzzable_request.get_data())), ]

        fuzzable_request.set_headers(headers)
        head = fuzzable_request.dump_request_head()
        return head, postdata
Example #2
0
    def _fix_content_length(self, head, postdata):
        """
        The user may have changed the postdata of the request, and not the
        content-length header; so we are going to fix that problem.
        """
        fuzzable_request = HTTPRequestParser(head, postdata)

        if fuzzable_request.get_data() is None:
            # Nothing to do here
            return head, postdata

        headers = fuzzable_request.get_headers()
        headers['content-length'] = [
            str(len(fuzzable_request.get_data())),
        ]

        fuzzable_request.set_headers(headers)
        head = fuzzable_request.dump_request_head()
        return head, postdata