aboutsummaryrefslogtreecommitdiffstats
path: root/mitmproxy/addons/core.py
blob: 5d2cf57b039c3c27e1ff6cf5440fc444c96e3a56 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
"""
    The core addon is responsible for verifying core settings that are not
    checked by other addons.
"""
from mitmproxy import exceptions
from mitmproxy.utils import human


class Core:
    def configure(self, options, updated):
        if "body_size_limit" in updated and options.body_size_limit:
            try:
                options._processed["body_size_limit"] = human.parse_size(
                    options.body_size_limit
                )
            except ValueError as e:
                raise exceptions.OptionsError(
                    "Invalid body size limit specification: %s" %
                    options.body_size_limit
                )