python3 AttributeError: No such option: body_size_limit


#1

Using the following code:

from mitmproxy import proxy, options
from mitmproxy.tools.dump import DumpMaster
from mitmproxy.addons import core




opts = options.Options(listen_host='127.0.0.1', listen_port=8081)
pconf = proxy.config.ProxyConfig(opts)

m = DumpMaster(None)
m.server = proxy.server.ProxyServer(pconf)
#print(m.addons)
print(m.addons)
#m.addons.add(core.Core())

try:
    m.run()
except KeyboardInterrupt:
    m.shutdown()

When running the above the following error is thrown:

Traceback (most recent call last):
  File "/home/userone/dev/p3_going_headless/venv/lib/python3.6/site-packages/mitmproxy/proxy/server.py", line 121, in handle
    root_layer()
  File "/home/userone/dev/p3_going_headless/venv/lib/python3.6/site-packages/mitmproxy/proxy/modes/http_proxy.py", line 9, in __call__
    layer()
  File "/home/userone/dev/p3_going_headless/venv/lib/python3.6/site-packages/mitmproxy/proxy/protocol/tls.py", line 286, in __call__
    layer()
  File "/home/userone/dev/p3_going_headless/venv/lib/python3.6/site-packages/mitmproxy/proxy/protocol/http1.py", line 83, in __call__
    layer()
  File "/home/userone/dev/p3_going_headless/venv/lib/python3.6/site-packages/mitmproxy/proxy/protocol/http.py", line 188, in __call__
    if not self._process_flow(flow):
  File "/home/userone/dev/p3_going_headless/venv/lib/python3.6/site-packages/mitmproxy/proxy/protocol/http.py", line 254, in _process_flow
    self.read_request_body(f.request)
  File "/home/userone/dev/p3_going_headless/venv/lib/python3.6/site-packages/mitmproxy/proxy/protocol/http1.py", line 23, in read_request_body
    human.parse_size(self.config.options.body_size_limit)
  File "/home/userone/dev/p3_going_headless/venv/lib/python3.6/site-packages/mitmproxy/optmanager.py", line 172, in __getattr__
    raise AttributeError("No such option: %s" % attr)
AttributeError: No such option: body_size_limit

mitmproxy has crashed!
Please lodge a bug report at: https://github.com/mitmproxy/mitmproxy
127.0.0.1:48110: clientdisconnect

According to the following a simple m.addons.add(core.Core()) should fix this however as can be seen in the addon list Core is already loaded:

'<mitmproxy.addons.core.Core object at 0x7f1521916e48>',

Any suggestions would be welcome, it seems to be a similar issue as posted here:

System information

python version: Python 3.6.5
mitmproxy ver: 4.0.4 (latest)


#2

Exact same issue for me :frowning: