Skip to content

Commit

Permalink
Merge pull request #12643 from jetty/jetty-12.0.x-12609-setStatusCodes
Browse files Browse the repository at this point in the history
Issue #12609 - better validation for response codes in setStatus
  • Loading branch information
lachlan-roberts authored Dec 19, 2024
2 parents a7de14a + 92d5b92 commit aa65102
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1190,6 +1190,8 @@ public int getStatus()
@Override
public void setStatus(int code)
{
if (code < 100 || code > 999)
throw new IllegalArgumentException();
if (!isCommitted())
_status = code;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)
throw new IllegalArgumentException();
if (isMutable())
{
Expand All @@ -775,7 +775,7 @@ public void setStatus(int sc, String message)

public void setStatusWithReason(int sc, String message)
{
if (sc <= 0)
if (sc < 100 || sc > 999)
throw new IllegalArgumentException();
if (isMutable())
{
Expand Down

0 comments on commit aa65102

Please sign in to comment.