Exemplo n.º 1
0
def main(request, response):
    """Respond to `/cookie/drop/secure` by dropping the two cookie set by
    `setSecureTestCookies()`"""
    headers = setNoCacheAndCORSHeaders(request, response)

    # Expire the cookies, and return a JSON-encoded success code.
    headers.append(makeDropCookie(b"alone_secure", False))
    headers.append(makeDropCookie(b"alone_insecure", False))
    return headers, b'{"success": true}'
Exemplo n.º 2
0
def main(request, response):
    """Respond to `/cookies/resources/dropSameSiteNone.py by dropping the
    two cookies set by setSameSiteNone.py"""
    headers = setNoCacheAndCORSHeaders(request, response)

    # Expire the cookies, and return a JSON-encoded success code.
    headers.append(makeDropCookie(b"samesite_none_insecure", False))
    headers.append(makeDropCookie(b"samesite_none_secure", True))
    return headers, b'{"success": true}'
Exemplo n.º 3
0
def main(request, response):
    """Respond to `/cookie/same-site/resources/dropSameSite.py by dropping the
    four cookies set by setSameSiteCookies.py"""
    headers = setNoCacheAndCORSHeaders(request, response)

    # Expire the cookies, and return a JSON-encoded success code.
    headers.append(makeDropCookie(b"samesite_strict", False))
    headers.append(makeDropCookie(b"samesite_lax", False))
    headers.append(makeDropCookie(b"samesite_none", False))
    headers.append(makeDropCookie(b"samesite_unspecified", False))
    return headers, b'{"success": true}'
Exemplo n.º 4
0
def main(request, response):
    """Respond to `/cookie/drop?name={name}` by expiring the cookie named `{name}`."""
    headers = setNoCacheAndCORSHeaders(request, response)
    try:
        # Expire the named cookie, and return a JSON-encoded success code.
        name = readParameter(request, paramName=u"name", requireValue=True)
        scheme = request.url_parts.scheme
        headers.append(makeDropCookie(name, u"https" == scheme))
        return headers, b'{"success": true}'
    except:
        return 500, headers, b'{"error" : "Empty or missing name parameter."}'
Exemplo n.º 5
0
def main(request, response):
    """Respond to `/cookies/resources/dropSameSiteMultiAttribute.py by dropping
    the cookies set by setSameSiteMultiAttribute.py"""
    headers = setNoCacheAndCORSHeaders(request, response)

    # Expire the cookies, and return a JSON-encoded success code.
    headers.append(makeDropCookie(b"samesite_unsupported", True))
    headers.append(makeDropCookie(b"samesite_unsupported_none", True))
    headers.append(makeDropCookie(b"samesite_unsupported_lax", False))
    headers.append(makeDropCookie(b"samesite_unsupported_strict", False))
    headers.append(makeDropCookie(b"samesite_none_unsupported", True))
    headers.append(makeDropCookie(b"samesite_lax_unsupported", True))
    headers.append(makeDropCookie(b"samesite_strict_unsupported", True))
    headers.append(makeDropCookie(b"samesite_lax_none", True))
    return headers, b'{"success": true}'