Search in sources :

Example 1 with HttpSetCookie

use of io.servicetalk.http.api.HttpSetCookie in project servicetalk by apple.

the class NettyH2HeadersToHttpHeaders method removeSetCookies.

@Override
public boolean removeSetCookies(final CharSequence name, final CharSequence domain, final CharSequence path) {
    final int sizeBefore = size();
    Iterator<? extends CharSequence> valueItr = nettyHeaders.valueIterator(HttpHeaderNames.SET_COOKIE);
    while (valueItr.hasNext()) {
        // In the future we could attempt to delay full parsing of the cookie until after the domain/path have
        // been matched, but for simplicity just do the parsing ahead of time.
        HttpSetCookie setCookie = HeaderUtils.parseSetCookie(valueItr.next(), name, false);
        if (setCookie != null && domainMatches(domain, setCookie.domain()) && pathMatches(path, setCookie.path())) {
            valueItr.remove();
        }
    }
    return sizeBefore != size();
}
Also used : HttpSetCookie(io.servicetalk.http.api.HttpSetCookie)

Aggregations

HttpSetCookie (io.servicetalk.http.api.HttpSetCookie)1