INNER CODE UNIT · Python

Handler

cipi-sh/cipi · lib/cipi-crowdsec-rescue.py:122

class Handler(BaseHTTPRequestHandler):
    protocol_version = "HTTP/1.1"
    timeout = 10
    # Do not advertise "BaseHTTP/x Python/y" to whoever port-scans this.
    server_version = "cipi"
    sys_version = ""

    def log_message(self, fmt: str, *args) -> None:
        # Do not log the request line — it contains the token.
        sys.stderr.write("rescue peer=%s\n" % (_peer_ip(self),))

    def _send(self, code: int, body: str) -> None:
        data = body.encode("ascii", "replace")
        self.send_response(code)
        self.send_header("Content-Type", "text/plain; charset=us-ascii")
        self.send_header("Content-Length", str(len(data)))
        self.send_header("Cache-Control", "no-store")
        self.send_header("Connection", "close")

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…