Skip to content
Merged
Changes from 1 commit
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
Prev Previous commit
optimize: support http1 automatic keepalive setting
  • Loading branch information
funky-eyes committed Dec 26, 2024
commit a6dfb8e60b1951833d7987218fc394868e7fb742
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ private void doWriteHeader(ChannelHandlerContext ctx, HttpMetadata msg, ChannelP
headers.add(HttpHeaderNames.CONNECTION.getKey(), String.valueOf(HttpHeaderValues.CLOSE));
}
// process normal headers
ctx.write(new DefaultHttpResponse(HttpVersion.HTTP_1_1, status, headers.getHeaders()), promise);
ctx.writeAndFlush(new DefaultHttpResponse(HttpVersion.HTTP_1_1, status, headers.getHeaders()), promise);
}

private void doWriteMessage(ChannelHandlerContext ctx, HttpOutputMessage msg, ChannelPromise promise) {
Expand All @@ -107,7 +107,7 @@ private void doWriteMessage(ChannelHandlerContext ctx, HttpOutputMessage msg, Ch
OutputStream body = msg.getBody();
if (body instanceof ByteBufOutputStream) {
ByteBuf buffer = ((ByteBufOutputStream) body).buffer();
ctx.write(buffer, promise);
ctx.writeAndFlush(buffer, promise);
return;
}
throw new IllegalArgumentException("HttpOutputMessage body must be 'io.netty.buffer.ByteBufOutputStream'");
Expand Down