Move recv_chunk() into a stand alone function. Further minimize memory use by using a chunk sized bytearray.
Move variables out of the iterator class and into the generator function. This slightly improves locality of code and data.
As Twitter appears to send complete JSON in the chunks, we can simplify buffer management to only operate on strings and not re-encode the string as bytes. This improves readability at the expense of breakage if Twitter starts spanning JSON across HTTP chunks. This is an unlikely change to their infrastructure. That said, this is a totally optional patch.
Further refine socket management.
All HTTP chunks are read in their entirety.
Cosmetic code improvements. (The socket's blocking state is set in a more compact form after a DeMorgan's boolean transformation.)
Hangups by Twitter, as with timeouts, are signaled via a message to allow gracious recovery.
Bump the version number.
Remove all keep-alive delimiters to allow the hangup patch to function.
Remove socket timeout mutation code.
Simplify protocol parsing checks.
Move HTTP exception catching to where it might actually be thrown.
Set a timeout on the main sample stream to test that code path.
Handle HTTP chunks that only contain keep-alive delimiters.
A few cosmetic edits of the iterator function.
Add comments detailing why we can avoid handling certain edge cases in the Twitter stream.
Clarify the comment about edge cases.
Merge branch 'fix-stream' into pr-fix-stream