Skip to content
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

Fix iter_lines boundary bug when CRLF straddles two chunks #4629

Closed
wants to merge 1 commit into from

Conversation

nanotone
Copy link

@nanotone nanotone commented May 4, 2018

In Response.iter_lines, if a \r\n sequence (the only multi-character line boundary) straddles two chunks, the \r and \n are treated as two separate boundaries. Consequently, iter_lines will yield one extra blank line, as an empty string.

This addresses the issue by checking if a chunk ends with \r, and when appropriate, leaving the trailing line in pending until the next chunk or EOF arrives.

@nateprewitt
Copy link
Member

Hi @nanotone, thanks for putting this together! This has actually already been addressed and is patched for Requests-3.0 (#3984). We won't be able to merge this into the current master branch because it's a breaking change for some users which isn't backwards compatible.

@nateprewitt nateprewitt closed this May 4, 2018
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Sep 3, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants