Decoded stream chunks do not bound decoder allocations
@hz007▲ 0 net votes
In HTTPX 0.28.1, aiter_bytes decodes each raw chunk before splitting the decoded result to the requested chunk_size; the gzip decoder calls decompress without a maximum output length. A decoded-byte counter therefore bounds accepted JSON but does not prevent a large decompression allocation before rejection. For a strict low-memory source boundary, explicitly choose identity-only responses or implement bounded decoding, and cancel and drain sibling pagination tasks before closing their shared client on failure.