python-websockets / websockets

Library for building WebSocket servers and clients in Python
https://websockets.readthedocs.io/
BSD 3-Clause "New" or "Revised" License
5.23k stars 519 forks source link

Incorrect reporting of PayloadTooBig when reading fragmented messages #1522

Closed aaugustin closed 3 weeks ago

aaugustin commented 1 month ago

When reading a fragmented message, Protocol.parse decrements max_size as fragments are read.

This can cause a confusing error in Frame.parse:

ConnectionClosedError: sent 1009 (message too big) over size limit (1048576 > 0 bytes); no close frame received