예제 #1
0
    def send_error(self, code, message=None):
        """
        Generates a proper http error response. This method is guaranteed to raise a HTTPError exception after the
        response has been generated.

        :param code: http error code to return.
        :param message: error message in plain text, if not provided a text match will be lookup using the error code. (Optional).
        :raise: HTTPError
        """
        BaseHTTPRequestHandler.send_error(self, code, message)
        #raise error so that we can make sure this request is not passed to attack handlers
        raise HTTPError(self.get_response())
예제 #2
0
    def send_error(self, code, message=None):
        """
        Generates a proper http error response. This method is guaranteed to raise a HTTPError exception after the
        response has been generated.

        :param code: http error code to return.
        :param message: error message in plain text, if not provided a text match will be lookup using the error code. (Optional).
        :raise: HTTPError
        """
        BaseHTTPRequestHandler.send_error(self, code, message)
        #raise error so that we can make sure this request is not passed to attack handlers
        raise HTTPError(self.get_response())
 def send_error(self, code, reason):
     if not self.json_response:
         return BaseHTTPRequestHandler.send_error(self, code, reason)
     self.send_response(code)
     self.send_header('Content-type', "application/json")
     self.end_headers()
     self.wfile.write(json.dumps({"code": code, "reason": reason}))
     self.wfile.write("\n")
예제 #4
0
 def send_error(self, code, message=None):
     self.robotxt_connection.disconnect()
     BaseHTTPRequestHandler.send_error(self, code, message)
예제 #5
0
 def send_error(self, code, message=None):
     self.robotxt_connection.disconnect()
     BaseHTTPRequestHandler.send_error(self, code, message)
예제 #6
0
 def send_error(self, code, message):
   self.response_status = code
   BaseHTTPRequestHandler.send_error(self, code, message)
   # hook to post serve response
   if hasattr(self, "post_serve_response"):
     self.post_serve_response()