Drop newline in tube.recvline
by default
#2588
Open
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This is a breaking change!
Change the default value of the
drop
parameter toTrue
to avoid the commonrecvline().strip()
dance and be in line with other readline implementations:Implementations stripping the final newline character when reading a line:
Python's
IOBase.readline
always includes the trailing newline, except for when there is none on the last line of a file.My claim is that exploits usually don't care about the trailing newline requiring users to strip it before parsing the line for e.g. address leaks. All other
tube.recvline*
functions likerecvlines
orrecvline_contains
already havedrop=True
as the default and strip the newline character(s), so this increases the API's consistency.This will break old exploits that expect the newline in some comparision, but the benefit for newer exploit not having to keep stripping seems to outweight this drawback.
Please leave a comment if there are concerns!