web: fix flow content update

This commit is contained in:
Maximilian Hils 2016-07-21 00:43:31 -07:00
parent 8b2a5cad2d
commit 427fffbcb8

View File

@ -8,6 +8,7 @@ import re
import six import six
import tornado.websocket import tornado.websocket
import tornado.web
from io import BytesIO from io import BytesIO
from mitmproxy.flow import FlowWriter, FlowReader from mitmproxy.flow import FlowWriter, FlowReader
@ -293,19 +294,11 @@ class ReplayFlow(RequestHandler):
class FlowContent(RequestHandler): class FlowContent(RequestHandler):
def post (self, flow_id, message): def post(self, flow_id, message):
# handle request later now just change response content self.flow.backup()
message = getattr(self.flow, message)
flow = self.flow message.content = self.request.files.values()[0][0].body
flow.backup() self.state.update_flow(self.flow)
content = self.request.files.values()[0][0].body
if (message == "response"):
with models.decoded(flow.response):
flow.response.content = content
elif(message == "request"):
with models.decoded(flow.request):
flow.request.content = content
self.state.update_flow(flow)
def get(self, flow_id, message): def get(self, flow_id, message):
message = getattr(self.flow, message) message = getattr(self.flow, message)