@@ -315,7 +315,7 @@ def on_disconnect(self):
315
315
def can_read (self , timeout ):
316
316
return self ._buffer and self ._buffer .can_read (timeout )
317
317
318
- def read_response (self ):
318
+ def read_response (self , disable_decoding = False ):
319
319
raw = self ._buffer .readline ()
320
320
if not raw :
321
321
raise ConnectionError (SERVER_CLOSED_CONNECTION_ERROR )
@@ -355,8 +355,9 @@ def read_response(self):
355
355
length = int (response )
356
356
if length == - 1 :
357
357
return None
358
- response = [self .read_response () for i in range (length )]
359
- if isinstance (response , bytes ):
358
+ response = [self .read_response (disable_decoding = disable_decoding )
359
+ for i in range (length )]
360
+ if isinstance (response , bytes ) and disable_decoding is False :
360
361
response = self .encoder .decode (response )
361
362
return response
362
363
@@ -450,7 +451,7 @@ def read_from_socket(self, timeout=SENTINEL, raise_on_timeout=True):
450
451
if custom_timeout :
451
452
sock .settimeout (self ._socket_timeout )
452
453
453
- def read_response (self ):
454
+ def read_response (self , disable_decoding = False ):
454
455
if not self ._reader :
455
456
raise ConnectionError (SERVER_CLOSED_CONNECTION_ERROR )
456
457
@@ -758,10 +759,12 @@ def can_read(self, timeout=0):
758
759
self .connect ()
759
760
return self ._parser .can_read (timeout )
760
761
761
- def read_response (self ):
762
+ def read_response (self , disable_decoding = False ):
762
763
"""Read the response from a previously sent command"""
763
764
try :
764
- response = self ._parser .read_response ()
765
+ response = self ._parser .read_response (
766
+ disable_decoding = disable_decoding
767
+ )
765
768
except socket .timeout :
766
769
self .disconnect ()
767
770
raise TimeoutError ("Timeout reading from %s:%s" %
0 commit comments