Opened 22 months ago
#6559 enhancement new
lineLengthExceeded() doesn't really need the entire rest of the buffer
|Reported by:||zooko||Owned by:|
As I mentioned on IRC, I would like to change the contract of lineLengthExceeded to not promise to send the entire contents of its internal buffer, but instead to send "The thing we received that violated the max-length constraint".
My reasoning for this is:
- "The rest of my internal buffer" is an internal matter and not really appropriate for a contract that I offer to you.
- Optimized internal representations (such as I am working on for #6357) don't necessarily have the rest of the buffer in a single string at that time, and have to go through some code complication and runtime costs to preserve and/or reconstruct it in order to pass it to lineLengthExceeded.
- Apparently no clients are actually depending on this contract at the moment, since both LineReceiver (#6536) and LineOnlyReceiver (#6558) satisfy that contract only some of the time.
Please, someone who has the authority to commit patches to Twisted trunk, let me know if there is any point in me writing a patch for this ticket that changes the documentation of the arguments to lineLengthExceeded, changes the unit tests (that I just wrote and attached to #6536 and #6558) so they no longer require the code-under-test to deliver the entire remnant of the buffer, and changes the implementations of LineReceiver and LineOnlyReceiver to deliver only the part of their buffer that violated the constraint (and throw away the rest of their buffer).