diff --git a/hyper/http20/connection.py b/hyper/http20/connection.py index badf58d4..506e6b6a 100644 --- a/hyper/http20/connection.py +++ b/hyper/http20/connection.py @@ -343,11 +343,7 @@ def _close_stream(self, stream_id): """ Called by a stream when it would like to be 'closed'. """ - try: - del self.streams[stream_id] - except KeyError: - # If the stream is already missing from the dict, no-one cares. - pass + del self.streams[stream_id] def _send_cb(self, frame): """ diff --git a/hyper/http20/response.py b/hyper/http20/response.py index abd614c1..71348757 100644 --- a/hyper/http20/response.py +++ b/hyper/http20/response.py @@ -127,6 +127,7 @@ def read(self, amt=None, decode_content=True): if decode_content and self._decompressobj: data += self._decompressobj.flush() + if not data: self.close() return data