Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Issue #10508 - honor Servlet spec behaviors for null in addHeader / setHeader calls #10510

Merged
merged 2 commits into from
Sep 14, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -196,30 +196,45 @@ public void sendRedirect(int code, String location) throws IOException
@Override
public void setDateHeader(String name, long date)
{
if (name == null)
return; // Spec is to do nothing

getResponse().getHeaders().putDate(name, date);
}

@Override
public void addDateHeader(String name, long date)
{
if (name == null)
return; // Spec is to do nothing

getResponse().getHeaders().addDateField(name, date);
}

@Override
public void setHeader(String name, String value)
{
if (name == null)
return; // Spec is to do nothing

getResponse().getHeaders().put(name, value);
}

@Override
public void addHeader(String name, String value)
{
if (name == null || value == null)
return; // Spec is to do nothing

getResponse().getHeaders().add(name, value);
}

@Override
public void setIntHeader(String name, int value)
{
if (name == null)
return; // Spec is to do nothing

// TODO do we need int versions?
if (!isCommitted())
getResponse().getHeaders().put(name, value);
Expand All @@ -228,6 +243,9 @@ public void setIntHeader(String name, int value)
@Override
public void addIntHeader(String name, int value)
{
if (name == null)
return; // Spec is to do nothing

// TODO do we need a native version?
if (!isCommitted())
getResponse().getHeaders().add(name, Integer.toString(value));
Expand Down
Loading