Class StickyCookie
- All Implemented Interfaces:
HttpFiltersSource
stickycookie, so that a session started in one client carries over to others (a browser and a
command-line tool, or replayed requests).
bootstrap.plusFiltersSource(StickyCookie.matching(FlowFilter.parse("~d example.com")));
Every Set-Cookie from a server goes into one jar shared by all clients, following RFC
6265: a Domain attribute must cover the server's host (else the cookie is ignored) and
makes the cookie apply to its subdomains too, otherwise it applies to that host only;
Path defaults to the directory of the request path; Max-Age wins over Expires,
and a cookie set to expire is removed from the jar; Secure cookies only go to
https URLs. Requests the filter matches get the jar's unexpired cookies for their host and
path, longest paths first, added to their Cookie header; a cookie the client sends
itself is kept rather than overridden. Ports are not told apart, as RFC 6265 says (mitmproxy
does). Domains are not checked against the public suffix list, beyond refusing a Domain
with no dot. Reads heads only.
-
Method Summary
Modifier and TypeMethodDescriptioncookies()The cookies the jar holds and has not seen expire, asname=valuestrings bydomain path; for inspection.filterRequest(HttpRequest originalRequest, FlowContext flowContext) Returns the filters for a request, ornullto proxy it unfiltered.static StickyCookiematching(FlowFilter filter) Sticky cookies for the requestsfiltermatches (body matchers do not match).static StickyCookieSticky cookies for the requests the expression matches, as--stickycookietakes it.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.microproxy.HttpFiltersSource
getMaximumRequestBufferSizeInBytes, getMaximumResponseBufferSizeInBytes
-
Method Details
-
matching
Sticky cookies for the requestsfiltermatches (body matchers do not match).- Parameters:
filter- the requests that get remembered cookies- Returns:
- the addon
-
of
Sticky cookies for the requests the expression matches, as--stickycookietakes it.- Parameters:
filterExpression- a flow filter expression- Returns:
- the addon
- Throws:
IllegalArgumentException- if the expression is invalid
-
cookies
The cookies the jar holds and has not seen expire, asname=valuestrings bydomain path; for inspection.- Returns:
- a snapshot of the jar
-
filterRequest
Description copied from interface:HttpFiltersSourceReturns the filters for a request, ornullto proxy it unfiltered.- Specified by:
filterRequestin interfaceHttpFiltersSource- Parameters:
originalRequest- a copy of the request as received from the clientflowContext- the client connection the request arrived on- Returns:
- the per-request filters, or
nullto leave the request unfiltered
-