Skip to content

Commit 07f19f3

Browse files
committed
Non-working example of how we could expose chunk boundaries
See gh-19
1 parent 9c0a553 commit 07f19f3

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

h11/_readers.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -245,14 +245,20 @@ def __call__(self, buf):
245245
if self._bytes_in_chunk == 0:
246246
self._reading_trailer = True
247247
return self(buf)
248+
chunk_start = True
249+
else:
250+
chunk_start = False
248251
assert self._bytes_in_chunk > 0
249252
data = buf.maybe_extract_at_most(self._bytes_in_chunk)
250253
if data is None:
251254
return None
252255
self._bytes_in_chunk -= len(data)
253256
if self._bytes_in_chunk == 0:
254257
self._bytes_to_discard = 2
255-
return Data(data=data)
258+
chunk_end = True
259+
else:
260+
chunk_end = False
261+
return Data(data=data, chunk_start=chunk_start, chunk_end=chunk_end)
256262

257263

258264
class Http10Reader(object):

0 commit comments

Comments
 (0)