Add font types to asset filter (~a) (#4928)

* Add font types to asset filter (~a)

* Add PR number to changelog

* remove flash mention

* restore asset test

Co-authored-by: Maximilian Hils <github@maximilianhils.com>
This commit is contained in:
Marius 2021-11-21 08:47:09 -06:00 committed by GitHub
parent 3847842f73
commit 1c93a93696
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 10 additions and 4 deletions

View File

@ -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

View File

@ -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)

View File

@ -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) {