Add http header connection close (#2432)

pull/2501/head
Joey777210 2 years ago committed by GitHub
parent 304d51d2e3
commit 8024aca4cf
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -125,6 +125,7 @@ public class HttpRequestHandler extends SimpleChannelInboundHandler<FullHttpRequ
// try to add content-length header for DefaultFullHttpResponse
if (!HttpUtil.isTransferEncodingChunked(response)
&& response instanceof DefaultFullHttpResponse) {
response.headers().set(HttpHeaderNames.CONNECTION, HttpHeaderValues.CLOSE);
response.headers().set(HttpHeaderNames.CONTENT_LENGTH,
((DefaultFullHttpResponse) response).content().readableBytes());
return ctx.writeAndFlush(response);

Loading…
Cancel
Save