def cookie.shadows
import bend-kit-http@0.38.2.0/http.bend as Httpimport Base
2343# §5.7 step 16: a secure cookie that a new cookie from plain http must not overlay.
2344def cookie.shadows(+old: Cookie, +c: Cookie) -> Bool:
2345 Cookie{n1, v1, +d1, h1, p1, s1, o1, ss1, e1} = old
2346 Cookie{n2, v2, +d2, h2, p2, s2, o2, ss2, e2} = c
2347 Bool.and(Bool.and(String.eq(n1, n2), s1), Bool.and(Bool.or(cookie.domain_match(d1, d2), cookie.domain_match(d2, d1)), cookie.path_match(p2, p1)))