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
dc3bec4a25
commit
24c6b599c4
@ -192,17 +192,23 @@ public class HttpObjectAggregator
|
|||||||
protected final HttpMessage message;
|
protected final HttpMessage message;
|
||||||
private HttpHeaders trailingHeaders;
|
private HttpHeaders trailingHeaders;
|
||||||
|
|
||||||
private AggregatedFullHttpMessage(HttpMessage message, ByteBuf content, HttpHeaders trailingHeaders) {
|
AggregatedFullHttpMessage(HttpMessage message, ByteBuf content, HttpHeaders trailingHeaders) {
|
||||||
super(content);
|
super(content);
|
||||||
this.message = message;
|
this.message = message;
|
||||||
this.trailingHeaders = trailingHeaders;
|
this.trailingHeaders = trailingHeaders;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public HttpHeaders trailingHeaders() {
|
public HttpHeaders trailingHeaders() {
|
||||||
|
HttpHeaders trailingHeaders = this.trailingHeaders;
|
||||||
|
if (trailingHeaders == null) {
|
||||||
|
return HttpHeaders.EMPTY_HEADERS;
|
||||||
|
} else {
|
||||||
return trailingHeaders;
|
return trailingHeaders;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public void setTrailingHeaders(HttpHeaders trailingHeaders) {
|
void setTrailingHeaders(HttpHeaders trailingHeaders) {
|
||||||
this.trailingHeaders = trailingHeaders;
|
this.trailingHeaders = trailingHeaders;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -265,7 +271,7 @@ public class HttpObjectAggregator
|
|||||||
|
|
||||||
private static final class AggregatedFullHttpRequest extends AggregatedFullHttpMessage implements FullHttpRequest {
|
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);
|
super(request, content, trailingHeaders);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -373,7 +379,8 @@ public class HttpObjectAggregator
|
|||||||
|
|
||||||
private static final class AggregatedFullHttpResponse extends AggregatedFullHttpMessage
|
private static final class AggregatedFullHttpResponse extends AggregatedFullHttpMessage
|
||||||
implements FullHttpResponse {
|
implements FullHttpResponse {
|
||||||
private AggregatedFullHttpResponse(HttpResponse message, ByteBuf content, HttpHeaders trailingHeaders) {
|
|
||||||
|
AggregatedFullHttpResponse(HttpResponse message, ByteBuf content, HttpHeaders trailingHeaders) {
|
||||||
super(message, content, trailingHeaders);
|
super(message, content, trailingHeaders);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user