jetty.project
                                
                                 jetty.project copied to clipboard
                                
                                    jetty.project copied to clipboard
                            
                            
                            
                        Customizable error page buffer size
Ability to increase buffer size past 8k in the custom ErrorHandler
The HttpConfiguration is how you control the output buffer size.
What is the use case for this?
True, but
    bufferSize = Math.min(8192, bufferSize); // TODO ?
limiting it to the 8k. We need a way to increase the limit.
limiting it to the 8k. We need a way to increase the limit.
I understand that you want to increase the buffer size limit, but why? What's the use case for a larger buffer size? (I ask, as there's probably several different ways to accomplish your use case without increasing this specific buffer size)
Hi, In the
@Override
protected void writeErrorHtml(Request request, Writer writer, Charset charset, int code, String message, Throwable cause, boolean showStacks) throws IOException {
  ....
}
we are generating custom error page using Writer. Something like:
  themeLeafTemplate.execute(writer, errorInfo);
If error page is bigger than buffer size it is just trimmed.
Need to dig into why we are doing this via a static sized buffer.
I would like to see if this need can be accomplished via a Writer created with the Content.Sink features instead. (will try this in a different branch soon)
Hi @joakime , maybe we can merge this one in a meantime?
Need to dig into why we are doing this via a static sized buffer.
I believe the reasoning is that we don't want to get into complex responses when generating error pages, as if we are in an error state, we want simplicity.... otherwise we can get errors within errors within errors.....
I'll review this PR for merging now...
This is OK.... but I think I'd prefer a simple
setBufferSizemethod, with a -1 meaning that a heuristic will be used (e.g. min(8K, httpConfig.bufferSize)). Default value will be -1 andpublic int getBufferSize()would return -1 (or the set value). Then have aprotect int computeBufferSize(Request request)that would check for -1 and do the min(8k, config.bufferSize) thang.
Note the reason I prefer a setter, is that it can be used from XML.
@gregw Could you please take a look now.
CI failure is a flake. rerunning
Re-running CI test again.
Known CI flake
@dkaukov thanks