NoRealPipelining.java 文件源码

java
阅读 22 收藏 0 点赞 0 评论 0

项目:sinetja 作者:
/**
 * Handle keep alive as long as there's the request contains
 * 'connection:Keep-Alive' header, no matter what the client is 1.0 or 1.1:
 * http://sockjs.github.com/sockjs-protocol/sockjs-protocol-0.3.3.html#section-157
 */
public static void if_keepAliveRequest_then_resumeReading_else_closeOnComplete(
        final HttpRequest request, final Channel channel, final ChannelFuture channelFuture
) {
    // TODO:
    // Add Connection: Close, or Keep-Alive?
    // res.headers().set(HttpHeaders.Names.CONNECTION, HttpHeaders.Values.KEEP_ALIVE);
    if (HttpUtil.isKeepAlive(request)) {
        channelFuture.addListener(new ChannelFutureListener() {
            public void operationComplete(ChannelFuture future) {
                resumeReading(channel);
            }
        });
    } else {
        channelFuture.addListener(ChannelFutureListener.CLOSE);
    }
}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号