@@ -54,13 +54,7 @@ def _obsolete_line_fold(lines):
54
54
55
55
def _decode_header_lines (lines ):
56
56
for line in _obsolete_line_fold (lines ):
57
- # _obsolete_line_fold yields either bytearray or bytes objects. On
58
- # Python 3, validate() takes either and returns matches as bytes. But
59
- # on Python 2, validate can return matches as bytearrays, so we have
60
- # to explicitly cast back.
61
- matches = validate (
62
- header_field_re , bytes (line ), "illegal header line: {!r}" , bytes (line )
63
- )
57
+ matches = validate (header_field_re , line , "illegal header line: {!r}" , line )
64
58
yield (matches ["field_name" ], matches ["field_value" ])
65
59
66
60
@@ -127,7 +121,7 @@ def read_eof(self):
127
121
chunk_header_re = re .compile (chunk_header .encode ("ascii" ))
128
122
129
123
130
- class ChunkedReader ( object ) :
124
+ class ChunkedReader :
131
125
def __init__ (self ):
132
126
self ._bytes_in_chunk = 0
133
127
# After reading a chunk, we have to throw away the trailing \r\n; if
@@ -163,9 +157,7 @@ def __call__(self, buf):
163
157
chunk_header ,
164
158
)
165
159
# XX FIXME: we discard chunk extensions. Does anyone care?
166
- # We convert to bytes because Python 2's `int()` function doesn't
167
- # work properly on bytearray objects.
168
- self ._bytes_in_chunk = int (bytes (matches ["chunk_size" ]), base = 16 )
160
+ self ._bytes_in_chunk = int (matches ["chunk_size" ], base = 16 )
169
161
if self ._bytes_in_chunk == 0 :
170
162
self ._reading_trailer = True
171
163
return self (buf )
@@ -191,7 +183,7 @@ def read_eof(self):
191
183
)
192
184
193
185
194
- class Http10Reader ( object ) :
186
+ class Http10Reader :
195
187
def __call__ (self , buf ):
196
188
data = buf .maybe_extract_at_most (999999999 )
197
189
if data is None :
0 commit comments