Issue #4711 trailers

Standard trailers cannot be set if committed or HTTP/1.0

Signed-off-by: Greg Wilkins <gregw@webtide.com>
This commit is contained in:
Greg Wilkins 2020-04-01 17:55:33 +02:00
parent ec38e99630
commit af895966fa
1 changed files with 4 additions and 1 deletions

View File

@ -1229,7 +1229,10 @@ public class Response implements HttpServletResponse
@Override
public void setTrailerFields(Supplier<Map<String, String>> trailers)
{
// TODO new for 4.0 - avoid transient supplier?
if (isCommitted())
throw new IllegalStateException("Committed");
if (getHttpChannel().getRequest().getHttpVersion().ordinal() <= HttpVersion.HTTP_1_0.ordinal())
throw new IllegalStateException("Trailers not supported");
this._trailers = new HttpFieldsSupplier(trailers);
}