Compare commits

...

7 Commits

Author SHA1 Message Date
Maximilian Hils
0a1ca53689 bump version to 0.18.2 2016-10-25 22:28:23 -07:00
Maximilian Hils
d0c27c76af fix the linter, knuth ftw! 2016-10-25 22:27:57 -07:00
Maximilian Hils
b72f3ee568 backport fix for #1620 2016-10-25 22:15:44 -07:00
Maximilian Hils
2fcc0458d1 backport fix for #1666 2016-10-25 22:09:58 -07:00
Maximilian Hils
fb1d2a8c89 constrain h2 version, refs #1671 2016-10-25 22:07:33 -07:00
Aldo Cortesi
6b524c9054 Merge pull request #1641 from cortesi/v0.18.x
console: correct handling of logs
2016-10-21 10:45:38 +13:00
Aldo Cortesi
ffe7eb94f1 console: correct handling of logs 2016-10-21 09:32:51 +13:00
6 changed files with 21 additions and 16 deletions

View File

@@ -19,7 +19,7 @@ class ClientPlayback:
def configure(self, options, updated):
if "client_replay" in updated:
if options.client_replay:
ctx.log.info(options.client_replay)
ctx.log.info("Client Replay: {}".format(options.client_replay))
try:
flows = flow.read_flows_from_paths(options.client_replay)
except exceptions.FlowReadException as e:

View File

@@ -285,9 +285,6 @@ class ConsoleMaster(flow.FlowMaster):
self.logbuffer.pop(0)
self.logbuffer.set_focus(len(self.logbuffer) - 1)
def add_log(self, e, level):
signals.add_log(e, level)
def sig_call_in(self, sender, seconds, callback, args=()):
def cb(*_):
return callback(*args)
@@ -668,11 +665,10 @@ class ConsoleMaster(flow.FlowMaster):
)
def process_flow(self, f):
should_intercept = any(
[
self.state.intercept and flowfilter.match(self.state.intercept, f) and not f.request.is_replay,
f.intercepted,
]
should_intercept = (
self.state.intercept and flowfilter.match(self.state.intercept, f)
and not f.request.is_replay
and f.reply.state == "handled"
)
if should_intercept:
f.intercept(self)
@@ -703,9 +699,13 @@ class ConsoleMaster(flow.FlowMaster):
super(ConsoleMaster, self).tcp_message(f)
message = f.messages[-1]
direction = "->" if message.from_client else "<-"
self.add_log("{client} {direction} tcp {direction} {server}".format(
signals.add_log("{client} {direction} tcp {direction} {server}".format(
client=repr(f.client_conn.address),
server=repr(f.server_conn.address),
direction=direction,
), "info")
self.add_log(strutils.bytes_to_escaped_str(message.content), "debug")
signals.add_log(strutils.bytes_to_escaped_str(message.content), "debug")
@controller.handler
def log(self, evt):
signals.add_log(evt.msg, evt.level)

View File

@@ -12,6 +12,7 @@ from mitmproxy import builtins
from mitmproxy import controller
from mitmproxy import exceptions
from mitmproxy import flow
from mitmproxy import flowfilter
from mitmproxy import options
from mitmproxy.web import app
from netlib.http import authentication
@@ -180,8 +181,12 @@ class WebMaster(flow.FlowMaster):
self.shutdown()
def _process_flow(self, f):
if self.state.intercept and self.state.intercept(
f) and not f.request.is_replay:
should_intercept = (
self.state.intercept and flowfilter.match(self.state.intercept, f)
and not f.request.is_replay
and f.reply.state == "handled"
)
if should_intercept:
f.intercept(self)
return f

View File

@@ -1,6 +1,6 @@
from __future__ import (absolute_import, print_function, division)
IVERSION = (0, 18, 1)
IVERSION = (0, 18, 2)
VERSION = ".".join(str(i) for i in IVERSION)
PATHOD = "pathod " + VERSION
MITMPROXY = "mitmproxy " + VERSION

View File

@@ -1,7 +1,7 @@
[flake8]
max-line-length = 140
max-complexity = 25
ignore = E251,C901
ignore = E251,C901,W503
exclude = mitmproxy/contrib/*,test/mitmproxy/data/*
builtins = file,open,basestring,xrange,unicode,long,cmp

View File

@@ -69,7 +69,7 @@ setup(
"cryptography>=1.3, <1.6",
"cssutils>=1.0.1, <1.1",
"Flask>=0.10.1, <0.12",
"h2>=2.4.1, <3",
"h2>=2.4.1, <2.5",
"html2text>=2016.1.8, <=2016.9.19",
"hyperframe>=4.0.1, <5",
"jsbeautifier>=1.6.3, <1.7",