From 052595ffbfd0464a5272a33927cd183c357beab0 Mon Sep 17 00:00:00 2001 From: Vincent Barbaresi Date: Wed, 15 Mar 2017 12:16:32 +0100 Subject: [PATCH] add explanatory comment about skipping null chunks in iter_lines --- requests/models.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/requests/models.py b/requests/models.py index a3958f73..375aae7a 100644 --- a/requests/models.py +++ b/requests/models.py @@ -780,7 +780,10 @@ class Response(object): for chunk in self.iter_content(chunk_size=chunk_size, decode_unicode=decode_unicode): - # Skip any null responses + # Skip any null responses: if there is pending data it is necessarily an + # incomplete chunk, so if we don't have more data we don't want to bother + # trying to get it. Unconsumed pending data will be yielded anyway in the + # end of the loop if the stream ends. if not chunk: continue