RFC2965PortAttributeHandlerHC4.java 文件源码

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

项目:remote-files-sync 作者:
/**
 * Match cookie port attribute. If the Port attribute is not specified
 * in header, the cookie can be sent to any port. Otherwise, the request port
 * must be in the cookie's port list.
 */
public boolean match(final Cookie cookie, final CookieOrigin origin) {
    Args.notNull(cookie, "Cookie");
    Args.notNull(origin, "Cookie origin");
    final int port = origin.getPort();
    if (cookie instanceof ClientCookie
            && ((ClientCookie) cookie).containsAttribute(ClientCookie.PORT_ATTR)) {
        if (cookie.getPorts() == null) {
            // Invalid cookie state: port not specified
            return false;
        }
        if (!portMatch(port, cookie.getPorts())) {
            return false;
        }
    }
    return true;
}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号