Open janbartel opened 1 year ago
I think this test can be challenged. It is OK that we should close the response if exactly the right amount of data is written, but it is a bit strange to truncate data in excess of the set length. The string written could be multi-byte characters and the truncation could split a character in half.
I think it is reasonable that we throw an exception from such a write rather than truncate.
Still waiting on some action from the servlet spec group, note that this also affects the 6.1 tck and jetty as documented here: https://github.com/jetty/jetty.project/issues/11931
The Servlet Specification 6.0 says:
The tck has a test which sets the
contentLength
then writes more bytes than that, and also tries to set a header:Tck test is
com/sun/ts/tests/servlet/spec/httpservletresponse/URLClient.java.flushBufferTest
Jetty fails the tck test because we respond with an
500
error instead of ignoring the extra content: