-
Bug
-
Resolution: Done
-
Major
-
None
-
None
IoUtils.transfer(..) does call ByteBuffer.compact() even if all of the data was transferred which is a problem for some Sink/Source implementations.
In undertow we "adjust" the count that needs to get transfered before try to call transfer on the underlying channel. This is done because we need to limit the count of data that can be transfer from/to the channel. The problem here is now that the underlying channel use the IoUtils.transfer(..) method todo the actual transfer, which in fact transfer all the data. Now we return the actual transfered count to the caller which may be less to what was passed in. To full-fill the contract he end up checking if the used ByteBuffer has anything remaining. Which will in fact the complete capacity as compact() was called in the IoUtils.transfer(..) method even if all was transfered without a problem