Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

MITMProxy poor performance

We are seeing very poor performance while using MITMProxy in Python. We are custom forwarding requests using the requests Python library.

Our program uses the script mode on MITMProxy to create a custom request based on the request from a client and then return the response. So, basically, for every request made to the proxy, a new request object is built with requests, then forwarded and then returned.

How can I increase the performance of MITMProxy when using it to forward requests?

like image 498
Juan Carlos Coto Avatar asked Jun 14 '13 21:06

Juan Carlos Coto


1 Answers

I fixed this issue with Juan a while ago, but having received similar questions lately, let me leave the solution here for reference:

mitmproxy has a single flow primitive, so when an inline script is handling something, other requests block. Scripts can be run threaded by using the libmproxy.script.concurrent decorator. For more details, have a look at the docs.

(Full disclosure: I authored this feature)

like image 154
Maximilian Hils Avatar answered Sep 28 '22 01:09

Maximilian Hils