Current http keep-alive implementation requires user code to clean up pending data before it can be reused. it is too much burden on programmers.
Also see #5039967
Cut & paste from email discussions about the root cause for 5039967:
Zhengyu Gu wrote:
"When plugin download jars, it wraps input stream with JarInputStream, even plugin iterators all jar etnries and reads all entry content, it seems that input stream is still not clean. The solution is to empty the input stream if iterating jar entries.
I realized that your fix was not enough for plugin, I was hoping that networking code could provide simple call to cleanup the channel. For example, if user code call InputStream.close() && keep-alive is on, then close() call should put into pool, and when the connection is retrieved from the pool, cleanup code will be executed to clean up the pending data and connection become resuable."