Skip to content
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

Issue #12609 - better validation for response codes in setStatus #12643

Merged
merged 2 commits into from
Dec 19, 2024

Conversation

lachlan-roberts
Copy link
Contributor

closes #12609

Signed-off-by: Lachlan Roberts <lachlan.p.roberts@gmail.com>
Copy link
Contributor

@gregw gregw left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's do this only in 12.1.x

Also why not do it in core Response?

Signed-off-by: Lachlan Roberts <lachlan.p.roberts@gmail.com>
@lachlan-roberts
Copy link
Contributor Author

@gregw this came up because there was a change in behavior testing sendError on GAE, so I think its worth keeping it for 12.0.x.

Also why not do it in core Response?

good point, fixed now

@@ -754,7 +754,7 @@ public void addIntHeader(String name, int value)
@Override
public void setStatus(int sc)
{
if (sc <= 0)
if (sc < 100 || sc > 999)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I assume that if we didn't check here the core response check would eventually throw? But probably best to check here so the throw comes at the expected method rather than a later flush

@lachlan-roberts lachlan-roberts merged commit aa65102 into jetty-12.0.x Dec 19, 2024
10 checks passed
@lachlan-roberts lachlan-roberts deleted the jetty-12.0.x-12609-setStatusCodes branch December 19, 2024 23:35
@lachlan-roberts lachlan-roberts added the Sponsored This issue affects a user with a commercial support agreement label Dec 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Sponsored This issue affects a user with a commercial support agreement
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Change of behaviour with HttpServletResponse.sendError(0) in EE10
3 participants