proxy.plugin.filter_by_url_regex module#

proxy.py#

⚡⚡⚡ Fast, Lightweight, Pluggable, TLS interception capable proxy server focused on Network monitoring, controls & Application development, testing, debugging.

copyright
  1. 2013-present by Abhinav Singh and contributors.

license

BSD, see LICENSE for more details.

class proxy.plugin.filter_by_url_regex.FilterByURLRegexPlugin(*args: Any, **kwargs: Any)[source]#

Bases: proxy.http.proxy.plugin.HttpProxyBasePlugin

Drops traffic by inspecting request URL and checking against a list of regular expressions. Example, default filter list below can be used as a starting point for filtering ads.

_abc_impl = <_abc._abc_data object>#
filters: List[Dict[str, Any]]#
handle_client_request(request: proxy.http.parser.parser.HttpParser) Optional[proxy.http.parser.parser.HttpParser][source]#

Handler called before dispatching client request to upstream.

Note: For pipelined (keep-alive) connections, this handler can be called multiple times, for each request sent to upstream.

Note: If TLS interception is enabled, this handler can be called multiple times if client exchanges multiple requests over same SSL session.

Return optionally modified request object to dispatch to upstream. Return None to drop the request data, e.g. in case a response has already been queued. Raise HttpRequestRejected or HttpProtocolException directly to tear down the connection with client.