resp.close()
self.new_session()
- def _data(self, data):
- if self.listener.on_data(data) is False:
- self.running = False
-
def _read_loop(self, resp):
charset = resp.headers.get('content-type', default='')
enc_search = re.search(r'charset=(?P<enc>\S*)', charset)
next_status_obj = buf.read_len(length)
if self.running and next_status_obj:
- self._data(next_status_obj)
+ if self.listener.on_data(next_status_obj) is False:
+ self.running = False
# # Note: keep-alive newlines might be inserted before each length value.
# # read until we get a digit...
# status_id = int(delimited_string)
# next_status_obj = resp.raw.read(status_id)
# if self.running:
- # self._data(next_status_obj.decode('utf-8'))
-
+ # if self.listener.on_data(next_status_obj.decode('utf-8')) is False:
+ # self.running = False
if resp.raw.closed:
self.on_closed(resp)