This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: Missing terminator option when using readline with socketserver.StreamRequestHandler
Type: enhancement Stage:
Components: Library (Lib) Versions:
process
Status: open Resolution:
Dependencies: Superseder:
Assigned To: Nosy List: martin.panter, tfeldmann
Priority: normal Keywords:

Created on 2017-09-06 14:37 by tfeldmann, last changed 2022-04-11 14:58 by admin.

Messages (2)
msg301474 - (view) Author: Thomas Feldmann (tfeldmann) Date: 2017-09-06 14:37
When using `socketserver.StreamRequestHandler` it should be possible to specify the newline terminator that is passed to `self.connection.makefile()`.

This would be greatly appreciated by many people who have to work with network packets ending with `\0`.
msg301753 - (view) Author: Martin Panter (martin.panter) * (Python committer) Date: 2017-09-08 22:52
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.
History
Date User Action Args
2022-04-11 14:58:52adminsetgithub: 75547
2017-09-08 22:52:04martin.pantersetnosy: + martin.panter
messages: + msg301753
2017-09-06 14:37:14tfeldmanncreate