From c333e4c76d42dc5c813a52b22fbe5328304a8ae8 Mon Sep 17 00:00:00 2001 From: Jason McCormick Date: Mon, 2 Nov 2026 20:42:45 -0500 Subject: updates for prod --- ip-echo-daemon | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) (limited to 'ip-echo-daemon') diff --git a/ip-echo-daemon b/ip-echo-daemon index 5b66801..1864956 100755 --- a/ip-echo-daemon +++ b/ip-echo-daemon @@ -22,14 +22,23 @@ class AddressHandler(BaseHTTPRequestHandler): server_version = "ip-echo-daemon" sys_version = "" + def send_error(self, code, message=None, explain=None): + body = (str(code) + "\n").encode("ascii") + self.send_response(code) + self.send_header("Content-Type", "text/plain; charset=us-ascii") + self.send_header("Content-Length", str(len(body))) + self.end_headers() + if self.command != "HEAD": + self.wfile.write(body) + def do_GET(self): if self.path != "/": self.send_error(404) return try: address = proxied_address(self.client_address[0], self.headers.get("X-Real-IP")) - except ValueError as exc: - self.send_error(400, str(exc)) + except ValueError: + self.send_error(400) return body = (str(address) + "\n").encode("ascii") self.send_response(200) -- cgit v1.2.3