Skip to content

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

Open

Description

@tfeldmann
mannequin
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 = []

Activity

  1. tfeldmann commented on Sep 6, 2017

    tfeldmannmannequin
    MannequinAuthor

    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.

  2. added
    stdlib
    type-feature
    on Sep 6, 2017
  3. vadmium commented on Sep 8, 2017

    @vadmium
    Member

    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.

  4. transferred this issue fromon Apr 10, 2022
  5. added
    topic-socket
    on Jul 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    stdlibtopic-sockettype-feature

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions