File tree Expand file tree Collapse file tree 1 file changed +4
-3
lines changed Expand file tree Collapse file tree 1 file changed +4
-3
lines changed Original file line number Diff line number Diff line change @@ -226,22 +226,23 @@ def _throw_away(self, nbytes: int) -> None:
226
226
while to_read > 0 :
227
227
to_read -= self ._recv_into (buf , to_read )
228
228
229
- def close (self ) -> None :
229
+ def close (self , fast : bool = False ) -> None :
230
230
"""Drain the remaining ESP socket buffers. We assume we already got what we wanted."""
231
231
if not self .socket :
232
232
return
233
233
# Make sure we've read all of our response.
234
- if self ._cached is None :
234
+ if self ._cached is None and not fast :
235
235
if self ._remaining and self ._remaining > 0 :
236
236
self ._throw_away (self ._remaining )
237
237
elif self ._chunked :
238
238
while True :
239
239
chunk_header = bytes (self ._readto (b"\r \n " )).split (b";" , 1 )[0 ]
240
+ if not chunk_header :
241
+ break
240
242
chunk_size = int (bytes (chunk_header ), 16 )
241
243
if chunk_size == 0 :
242
244
break
243
245
self ._throw_away (chunk_size + 2 )
244
- self ._parse_headers ()
245
246
if self ._session :
246
247
# pylint: disable=protected-access
247
248
self ._session ._connection_manager .free_socket (self .socket )
You can’t perform that action at this time.
0 commit comments