mirror of
https://github.com/frappe/gunicorn.git
synced 2026-07-01 18:21:30 +08:00
receive_data() stores every DATA frame in both _body_chunks (list) and request_body (BytesIO). The receive() closure in _handle_http2_request() has two read paths: a streaming path that pops from _body_chunks, and a fast path that reads from BytesIO. After the streaming path consumed the body, the fast path could re-read the same data from BytesIO because body_received was never set in the streaming return path. This caused the application to receive a doubled request body (e.g. 18 bytes sent, 36 bytes received), breaking JSON parsing with "Extra data" errors. Fix: set body_received = True in the streaming path when _body_complete is True, preventing the fast path from re-reading already-consumed data. Fixes #3558