File tree Expand file tree Collapse file tree 1 file changed +10
-1
lines changed Expand file tree Collapse file tree 1 file changed +10
-1
lines changed Original file line number Diff line number Diff line change 55
55
56
56
import errno
57
57
58
+ # CircuitPython 6.0 does not have the bytearray.split method.
59
+ # This function emulates buf.split(needle)[0], which is the functionality
60
+ # required.
61
+ def _buffer_split0 (buf , needle ):
62
+ index = buf .find (needle )
63
+ if index == - 1 :
64
+ return buf
65
+ return buf [:index ]
66
+
58
67
59
68
class _RawResponse :
60
69
def __init__ (self , response ):
@@ -220,7 +229,7 @@ def _readinto(self, buf):
220
229
# Consume trailing \r\n for chunks 2+
221
230
if self ._remaining == 0 :
222
231
self ._throw_away (2 )
223
- chunk_header = self ._readto (b"\r \n " ). split ( b";" , 1 )[ 0 ]
232
+ chunk_header = _buffer_split0 ( self ._readto (b"\r \n " ), b";" )
224
233
http_chunk_size = int (bytes (chunk_header ), 16 )
225
234
if http_chunk_size == 0 :
226
235
self ._chunked = False
You can’t perform that action at this time.
0 commit comments