Add tornado dependency, serve index file

This commit is contained in:
Aldo Cortesi 2014-09-14 12:33:07 +12:00
parent 6812d304a1
commit ff09529ba3
4 changed files with 24 additions and 4 deletions

View File

@ -82,20 +82,17 @@ class WebMaster(flow.FlowMaster):
self.shutdown()
def handle_request(self, f):
print "req"
flow.FlowMaster.handle_request(self, f)
if f:
f.reply()
return f
def handle_response(self, f):
print "resp"
flow.FlowMaster.handle_response(self, f)
if f:
f.reply()
return f
def handle_error(self, f):
print "err"
flow.FlowMaster.handle_error(self, f)
return f

View File

@ -3,9 +3,15 @@ import os.path
import tornado.web
class IndexHandler(tornado.web.RequestHandler):
def get(self):
self.render("index.html")
class Application(tornado.web.Application):
def __init__(self, debug):
handlers = [
(r"/", IndexHandler),
]
settings = dict(
template_path=os.path.join(os.path.dirname(__file__), "templates"),

View File

@ -0,0 +1,16 @@
<!DOCTYPE html>
<html>
<head lang="en">
<meta charset="UTF-8">
<title>mitmproxy</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="static/mitmproxy.css"/>
<script src="static/mitmproxy.js"></script>
</head>
<body>
<div id="mitmproxy"></div>
</body>
<script>
app = React.renderComponent(routes, document.body);
</script>
</html>

View File

@ -85,7 +85,8 @@ deps = {
"pyasn1>0.1.2",
"requests>=2.4.0",
"pyOpenSSL>=0.14",
"Flask>=0.10.1"
"Flask>=0.10.1",
"tornado>=4.0.2"
}
script_deps = {
"mitmproxy": {