README and minor felicities for script examples.

This commit is contained in:
Aldo Cortesi 2011-08-27 09:24:04 +12:00
parent b635112d36
commit 7629a43d82
2 changed files with 6 additions and 6 deletions

View File

@ -1,5 +1,6 @@
add_header.py Simple script that just adds a header to every request.
stub.py Script stub with a method definition for every event.
stickycookies An example of writing a custom proxy with libmproxy
add_header.py Simple script that just adds a header to every request.
flowbasic Basic use of mitmproxy as a library.
stub.py Script stub with a method definition for every event.
stickycookies An example of writing a custom proxy with libmproxy.
upsidedownternet.py Rewrites traffic to turn PNGs upside down.

View File

@ -2,8 +2,7 @@ import Image, cStringIO
def response(context, flow):
if flow.response.headers["content-type"] == ["image/png"]:
s = cStringIO.StringIO(flow.response.content)
img = Image.open(s)
img = img.rotate(180)
img = Image.open(s).rotate(180)
s2 = cStringIO.StringIO()
img.save(s2, "png")
flow.response.content = s2.getvalue()