mirror of
https://github.com/Grasscutters/mitmproxy.git
synced 2024-11-23 16:17:49 +00:00
pathod: flag to set debugging for web interface dev
This commit is contained in:
parent
99cb0808ab
commit
5dee4210eb
@ -9,9 +9,9 @@ from netlib import http_uastrings
|
|||||||
logging.basicConfig(level="DEBUG")
|
logging.basicConfig(level="DEBUG")
|
||||||
|
|
||||||
|
|
||||||
def make_app(noapi):
|
def make_app(noapi, debug):
|
||||||
app = Flask(__name__)
|
app = Flask(__name__)
|
||||||
# app.debug = True
|
app.debug = debug
|
||||||
|
|
||||||
if not noapi:
|
if not noapi:
|
||||||
@app.route('/api/info')
|
@app.route('/api/info')
|
||||||
|
@ -273,6 +273,10 @@ def args_pathod(argv, stdout=sys.stdout, stderr=sys.stderr):
|
|||||||
"--nocraft", dest='nocraft', default=False, action="store_true",
|
"--nocraft", dest='nocraft', default=False, action="store_true",
|
||||||
help='Disable response crafting. If anchors are specified, they still work.'
|
help='Disable response crafting. If anchors are specified, they still work.'
|
||||||
)
|
)
|
||||||
|
parser.add_argument(
|
||||||
|
"--webdebug", dest='webdebug', default=False, action="store_true",
|
||||||
|
help='Debugging mode for the web app (dev only).'
|
||||||
|
)
|
||||||
|
|
||||||
group = parser.add_argument_group(
|
group = parser.add_argument_group(
|
||||||
'SSL',
|
'SSL',
|
||||||
|
@ -289,7 +289,8 @@ class Pathod(tcp.TCPServer):
|
|||||||
logreq=False,
|
logreq=False,
|
||||||
logresp=False,
|
logresp=False,
|
||||||
explain=False,
|
explain=False,
|
||||||
hexdump=False
|
hexdump=False,
|
||||||
|
webdebug=False,
|
||||||
):
|
):
|
||||||
"""
|
"""
|
||||||
addr: (address, port) tuple. If port is 0, a free port will be
|
addr: (address, port) tuple. If port is 0, a free port will be
|
||||||
@ -317,7 +318,7 @@ class Pathod(tcp.TCPServer):
|
|||||||
self.logresp, self.hexdump = logresp, hexdump
|
self.logresp, self.hexdump = logresp, hexdump
|
||||||
self.explain = explain
|
self.explain = explain
|
||||||
|
|
||||||
self.app = app.make_app(noapi)
|
self.app = app.make_app(noapi, webdebug)
|
||||||
self.app.config["pathod"] = self
|
self.app.config["pathod"] = self
|
||||||
self.log = []
|
self.log = []
|
||||||
self.logid = 0
|
self.logid = 0
|
||||||
@ -438,6 +439,7 @@ def main(args): # pragma: nocover
|
|||||||
logresp = args.logresp,
|
logresp = args.logresp,
|
||||||
hexdump = args.hexdump,
|
hexdump = args.hexdump,
|
||||||
explain = args.explain,
|
explain = args.explain,
|
||||||
|
webdebug = args.webdebug
|
||||||
)
|
)
|
||||||
except PathodError, v:
|
except PathodError, v:
|
||||||
print >> sys.stderr, "Error: %s"%v
|
print >> sys.stderr, "Error: %s"%v
|
||||||
|
@ -74,7 +74,6 @@ class DaemonTests(object):
|
|||||||
return c.request(spec)
|
return c.request(spec)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@contextmanager
|
@contextmanager
|
||||||
def tmpdir(*args, **kwargs):
|
def tmpdir(*args, **kwargs):
|
||||||
orig_workdir = os.getcwd()
|
orig_workdir = os.getcwd()
|
||||||
|
Loading…
Reference in New Issue
Block a user