INNER CODE UNIT · Python
_send
Kounex/obs_blade · tool/kick_auth_proxy/proxy.py:294
def _send(self, status: int, payload: bytes, content_type: str) -> None:
self.send_response(status)
self.send_header("Content-Type", content_type)
self.send_header("Content-Length", str(len(payload)))
self.send_header("Cache-Control", "no-store")
self.end_headers()
self.wfile.write(payload)
def _json(self, status: int, message: str) -> None:
self._send(
status,
json.dumps({"error": message}).encode(),
"application/json",
)
def _client_ip(self) -> str:
forwarded = self.headers.get("CF-Connecting-IP", "").strip()
if forwarded: