From 05724ce17b8bd47b9662757517ab85ff4909a277 Mon Sep 17 00:00:00 2001 From: Mark Nottingham Date: Fri, 25 Aug 2023 15:53:32 +1000 Subject: [PATCH] incorrect slicing and some var name cleanup --- bin/redbot_cgi.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/bin/redbot_cgi.py b/bin/redbot_cgi.py index 3cea4c2d..4ec5d9c7 100755 --- a/bin/redbot_cgi.py +++ b/bin/redbot_cgi.py @@ -39,7 +39,7 @@ def out(inbytes: bytes) -> None: req_hdrs: RawHeaderListType = [] for key, val in os.environ.items(): if key[:5] == "HTTP_": - req_hdrs.append((key[:5].lower().encode("ascii"), val.encode("ascii"))) + req_hdrs.append((key[5:].lower().encode("ascii"), val.encode("ascii"))) req_body = sys.stdin.read().encode("utf-8") class Exchange(HttpResponseExchange): @@ -54,11 +54,11 @@ def response_start( out(b"\n".join(out_v)) def response_body(self, chunk: bytes) -> None: - freak_ceiling = 20000 + ceiling = 20000 rest = None - if len(chunk) > freak_ceiling: - rest = chunk[freak_ceiling:] - chunk = chunk[:freak_ceiling] + if len(chunk) > ceiling: + rest = chunk[ceiling:] + chunk = chunk[:ceiling] out(chunk) if rest: self.response_body(rest)