jetty.project
                                
                                 jetty.project copied to clipboard
                                
                                    jetty.project copied to clipboard
                            
                            
                            
                        ChunkAccumulator not working with empty chunks
Jetty version(s) 12.0.8
Jetty Environment Any
Java version/vendor (use: java -version)
Any
OS type/version Any
Description ChunkAccumulator uses read-only buffer in case of empty chunks that leads to the ReadOnlyBufferException https://github.com/jetty/jetty.project/blob/jetty-12.0.x/jetty-core/jetty-io/src/main/java/org/eclipse/jetty/io/ChunkAccumulator.java#L75
Despite that asString/asInputStream/asPublisher works fine. And even asByteBuffer (because it uses ContentSourceByteBuffer)
How to reproduce?
val server = Server(8080)
server.setHandler(object : Handler.Abstract() {
  override fun handle(request: Request, response: Response, callback: Callback): Boolean {
    Content.Source.asByteBufferAsync(request)
    callback.succeeded()
    return true
  }
})
server.start()
curl http://127.0.0.1:8080
<h2>HTTP ERROR 500 java.nio.ReadOnlyBufferException</h2>
@scrat98 please note #11598 which deprecates ChunkAccumulator. It is still draft status, but we are working on improving this area of the code. However, we will still look at a short term fix for this issue as well.
@gregw Okay, good to know, thanks!