INNER CODE UNIT · Python
_send
cipi-sh/cipi · lib/cipi-crowdsec-rescue.py:133
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")
self.end_headers()
self.wfile.write(data)
def do_POST(self) -> None:
self._send(405, "GET only\n")
def do_PUT(self) -> None:
self._send(405, "GET only\n")
def _reject(self, ip: str) -> None:
# The throttle applies to wrong tokens only. A correct 256-bit token is