diff --git a/CHANGELOG.md b/CHANGELOG.md index 8db2dd771..6c52595fc 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -15,6 +15,7 @@ * Base container image bumped to Debian 11 Bullseye (@Kriechi) * Upstream replays don't do CONNECT on plaintext HTTP requests (#4876, @HoffmannP) * Remove workarounds for old pyOpenSSL versions (#4831, @KarlParkinson) +* Add fonts to asset filter (~a) (#4928, @elespike) ## 28 September 2021: mitmproxy 7.0.4 diff --git a/mitmproxy/flowfilter.py b/mitmproxy/flowfilter.py index 29ba0af84..da3f9d0d8 100644 --- a/mitmproxy/flowfilter.py +++ b/mitmproxy/flowfilter.py @@ -15,7 +15,8 @@ application/javascript text/css image/* - application/x-shockwave-flash + font/* + application/font-* ~h rex Header line in either request or response ~hq rex Header in request ~hs rex Header in response @@ -167,13 +168,15 @@ def _check_content_type(rex, message): class FAsset(_Action): code = "a" - help = "Match asset in response: CSS, JavaScript, images." + help = "Match asset in response: CSS, JavaScript, images, fonts." ASSET_TYPES = [re.compile(x) for x in [ b"text/javascript", b"application/x-javascript", b"application/javascript", b"text/css", - b"image/.*" + b"image/.*", + b"font/.*", + b"application/font-.*", ]] @only(http.HTTPFlow) diff --git a/web/src/js/filt/filt.peg b/web/src/js/filt/filt.peg index bca8bdddf..360324562 100644 --- a/web/src/js/filt/filt.peg +++ b/web/src/js/filt/filt.peg @@ -45,7 +45,9 @@ var ASSET_TYPES = [ new RegExp("application/x-javascript"), new RegExp("application/javascript"), new RegExp("text/css"), - new RegExp("image/.*") + new RegExp("image/.*"), + new RegExp("font/.*"), + new RegExp("application/font.*"), ]; function assetFilter(flow) { if (flow.response) {