-
Notifications
You must be signed in to change notification settings - Fork 1.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Customizable error page buffer size #11654
Conversation
The HttpConfiguration is how you control the output buffer size. What is the use case for this? |
True, but
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? |
Hi, In the
we are generating custom error page using Writer. Something like:
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? |
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... |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is OK.... but I think I'd prefer a simple setBufferSize
method, with a -1 meaning that a heuristic will be used (e.g. min(8K, httpConfig.bufferSize)). Default value will be -1 and public int getBufferSize()
would return -1 (or the set value). Then have a protect int computeBufferSize(Request request)
that would check for -1 and do the min(8k, config.bufferSize) thang.
protected int getBufferSize(Request request) | ||
{ | ||
int bufferSize = request.getConnectionMetaData().getHttpConfiguration().getOutputBufferSize(); | ||
bufferSize = Math.min(8192, bufferSize); // TODO ? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's remove the TODO from the code
@@ -262,6 +261,13 @@ else if (charsets.contains(StandardCharsets.ISO_8859_1)) | |||
} | |||
} | |||
|
|||
protected int getBufferSize(Request request) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We need a bit of javadoc to say that this is getting the buffer size for the entire error response (any larger responses will be truncated). Then say that default implementation imposes an 8K limit on the standard buffer size, but that implementations may override the method to provide some other size.
Note the reason I prefer a setter, is that it can be used from XML. |
@gregw Could you please take a look now. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks good to me!
jetty-core/jetty-server/src/main/java/org/eclipse/jetty/server/handler/ErrorHandler.java
Show resolved
Hide resolved
CI failure is a flake. rerunning |
Re-running CI test again. |
Known CI flake |
@dkaukov thanks |
Ability to increase buffer size past 8k in the custom
ErrorHandler