INNER CODE UNIT · Python
do_POST
cipi-sh/cipi · lib/cipi-crowdsec-rescue.py:143
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
# always honoured: this is the path someone locked out of SSH uses, and
# refusing it because they fat-fingered the URL twice defeats the point.
_rate_hit(ip)
self._send(429 if not _rate_ok(ip) else 403, "forbidden\n")
def do_GET(self) -> None:
ip = _peer_ip(self)
if ip in ("127.0.0.1", "::1", ""):
self._send(403, "forbidden\n")
return