Issue 31366: Missing terminator option when using readline with socketserver.StreamRequestHandler (original) (raw)
The socket.makefile(newline=...) parameter only affects text mode, but StreamRequestHandler’s “rfile” attribute works in byte mode. You could call makefile or TextIOWrapper yourself, but neither of these options support reading null-terminated “lines” or packets.
I think it would be best to implement this more generally, e.g. via Issue 1152248 or Issue 17083. Perhaps like the “asyncio.StreamReader.readuntil” or “telnetlib.Telnet.read_until” methods, rather than a stream configuration option.