Make sure AggregatedFullHttpMessage.trailingHeaders() return non-null
When handling an oversized message, HttpObjectAggregator does not wait until the last chunk is received to produce the failed message, making AggregatedFullHttpMessage.trailingHeaders() return null.
This commit is contained in:
parent
650bb5358d
commit
ecfa241768
@ -192,17 +192,23 @@ public class HttpObjectAggregator
|
||||
protected final HttpMessage message;
|
||||
private HttpHeaders trailingHeaders;
|
||||
|
||||
private AggregatedFullHttpMessage(HttpMessage message, ByteBuf content, HttpHeaders trailingHeaders) {
|
||||
AggregatedFullHttpMessage(HttpMessage message, ByteBuf content, HttpHeaders trailingHeaders) {
|
||||
super(content);
|
||||
this.message = message;
|
||||
this.trailingHeaders = trailingHeaders;
|
||||
}
|
||||
|
||||
@Override
|
||||
public HttpHeaders trailingHeaders() {
|
||||
return trailingHeaders;
|
||||
HttpHeaders trailingHeaders = this.trailingHeaders;
|
||||
if (trailingHeaders == null) {
|
||||
return HttpHeaders.EMPTY_HEADERS;
|
||||
} else {
|
||||
return trailingHeaders;
|
||||
}
|
||||
}
|
||||
|
||||
public void setTrailingHeaders(HttpHeaders trailingHeaders) {
|
||||
void setTrailingHeaders(HttpHeaders trailingHeaders) {
|
||||
this.trailingHeaders = trailingHeaders;
|
||||
}
|
||||
|
||||
@ -275,7 +281,7 @@ public class HttpObjectAggregator
|
||||
|
||||
private static final class AggregatedFullHttpRequest extends AggregatedFullHttpMessage implements FullHttpRequest {
|
||||
|
||||
private AggregatedFullHttpRequest(HttpRequest request, ByteBuf content, HttpHeaders trailingHeaders) {
|
||||
AggregatedFullHttpRequest(HttpRequest request, ByteBuf content, HttpHeaders trailingHeaders) {
|
||||
super(request, content, trailingHeaders);
|
||||
}
|
||||
|
||||
@ -367,7 +373,8 @@ public class HttpObjectAggregator
|
||||
|
||||
private static final class AggregatedFullHttpResponse extends AggregatedFullHttpMessage
|
||||
implements FullHttpResponse {
|
||||
private AggregatedFullHttpResponse(HttpResponse message, ByteBuf content, HttpHeaders trailingHeaders) {
|
||||
|
||||
AggregatedFullHttpResponse(HttpResponse message, ByteBuf content, HttpHeaders trailingHeaders) {
|
||||
super(message, content, trailingHeaders);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user