yegor256 / takes

True Object-Oriented Java Web Framework without NULLs, Static Methods, Annotations, and Mutable Objects
https://www.takes.org
MIT License
805 stars 197 forks source link

RqLengthAware wrongly assumes available gives a good indication about number of bytes to read when no content length is aviable #1301

Closed laeubi closed 1 month ago

laeubi commented 2 months ago

RqLengthAware uses available in case of no content length is found, this is simply wrong, according to the docs this:

Returns an estimate of the number of bytes that can be read (or skipped over) from this input stream without blocking, which may be 0, or 0 when end of stream is detected.

The default implementation even return always 0....

instead it should simply return the stream as is if the content length can't be computed!