Introduce a filtered flow writer, and use it in dump.py

Fixes #104
This commit is contained in:
Aldo Cortesi
2013-03-14 09:19:43 +13:00
parent c34d1e3de6
commit cfb5ba89ce
9 changed files with 48 additions and 18 deletions

View File

@@ -3,8 +3,8 @@
This example shows how to build a proxy based on mitmproxy's Flow
primitives.
Note that request and response messages are not automatically acked, so we
need to implement handlers to do this.
Note that request and response messages are not automatically replied to,
so we need to implement handlers to do this.
"""
import os
from libmproxy import proxy, flow
@@ -19,13 +19,13 @@ class MyMaster(flow.FlowMaster):
def handle_request(self, r):
f = flow.FlowMaster.handle_request(self, r)
if f:
r._ack()
r.reply()
return f
def handle_response(self, r):
f = flow.FlowMaster.handle_response(self, r)
if f:
r._ack()
r.reply()
print f
return f