Skip to content

Missing terminator option when using readline with socketserver.StreamRequestHandler #75547

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
tfeldmann mannequin opened this issue Sep 6, 2017 · 2 comments
Open
Labels
stdlib Python modules in the Lib dir type-feature A feature request or enhancement

Comments

@tfeldmann
Copy link
Mannequin

tfeldmann mannequin commented Sep 6, 2017

BPO 31366
Nosy @vadmium, @tfeldmann

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 = None
closed_at = None
created_at = <Date 2017-09-06.14:37:14.332>
labels = ['type-feature', 'library']
title = 'Missing terminator option when using readline with socketserver.StreamRequestHandler'
updated_at = <Date 2017-09-08.22:52:04.530>
user = 'https://github.com/tfeldmann'

bugs.python.org fields:

activity = <Date 2017-09-08.22:52:04.530>
actor = 'martin.panter'
assignee = 'none'
closed = False
closed_date = None
closer = None
components = ['Library (Lib)']
creation = <Date 2017-09-06.14:37:14.332>
creator = 'tfeldmann'
dependencies = []
files = []
hgrepos = []
issue_num = 31366
keywords = []
message_count = 2.0
messages = ['301474', '301753']
nosy_count = 2.0
nosy_names = ['martin.panter', 'tfeldmann']
pr_nums = []
priority = 'normal'
resolution = None
stage = None
status = 'open'
superseder = None
type = 'enhancement'
url = 'https://bugs.python.org/issue31366'
versions = []

@tfeldmann
Copy link
Mannequin Author

tfeldmann mannequin commented Sep 6, 2017

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.

@tfeldmann tfeldmann mannequin added stdlib Python modules in the Lib dir type-feature A feature request or enhancement labels Sep 6, 2017
@vadmium
Copy link
Member

vadmium commented 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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
stdlib Python modules in the Lib dir type-feature A feature request or enhancement
Projects
None yet
Development

No branches or pull requests

1 participant