You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Missing terminator option when using readline with socketserver.StreamRequestHandler #75547
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
assignee=Noneclosed_at=Nonecreated_at=<Date2017-09-06.14:37:14.332>labels= ['type-feature', 'library']
title='Missing terminator option when using readline with socketserver.StreamRequestHandler'updated_at=<Date2017-09-08.22:52:04.530>user='https://github.com/tfeldmann'
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 bpo-1152248 or bpo-17083. Perhaps like the “asyncio.StreamReader.readuntil” or “telnetlib.Telnet.read_until” methods, rather than a stream configuration option.
Activity
tfeldmann commentedon Sep 6, 2017
When using
socketserver.StreamRequestHandlerit should be possible to specify the newline terminator that is passed toself.connection.makefile().This would be greatly appreciated by many people who have to work with network packets ending with
\0.vadmium commentedon Sep 8, 2017
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 bpo-1152248 or bpo-17083. Perhaps like the “asyncio.StreamReader.readuntil” or “telnetlib.Telnet.read_until” methods, rather than a stream configuration option.