aboutsummaryrefslogtreecommitdiffstats
path: root/libmproxy/console/common.py
diff options
context:
space:
mode:
Diffstat (limited to 'libmproxy/console/common.py')
-rw-r--r--libmproxy/console/common.py28
1 files changed, 12 insertions, 16 deletions
diff --git a/libmproxy/console/common.py b/libmproxy/console/common.py
index d68aba3d..951d2c2a 100644
--- a/libmproxy/console/common.py
+++ b/libmproxy/console/common.py
@@ -1,23 +1,11 @@
-# Copyright (C) 2012 Aldo Cortesi
-#
-# This program is free software: you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation, either version 3 of the License, or
-# (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program. If not, see <http://www.gnu.org/licenses/>.
-
import urwid
import urwid.util
from .. import utils, flow
+VIEW_LIST = 0
+VIEW_FLOW = 1
+
VIEW_FLOW_REQUEST = 0
VIEW_FLOW_RESPONSE = 1
@@ -156,6 +144,8 @@ def raw_format_flow(f, focus, extended, padding):
if f["resp_ctype"]:
resp.append(fcol(f["resp_ctype"], rc))
resp.append(fcol(f["resp_clen"], rc))
+ resp.append(fcol(f["resp_rate"], rc))
+
elif f["err_msg"]:
resp.append(fcol(SYMBOL_RETURN, "error"))
resp.append(
@@ -197,11 +187,17 @@ def format_flow(f, focus, extended=False, hostheader=False, padding=2):
contentdesc = "[content missing]"
else:
contentdesc = "[no content]"
+
+ delta = f.response.timestamp_end - f.response.timestamp_start
+ size = len(f.response.content) + f.response.get_header_size()
+ rate = utils.pretty_size(size / ( delta if delta > 0 else 1 ) )
+
d.update(dict(
resp_code = f.response.code,
resp_is_replay = f.response.is_replay(),
resp_acked = f.response.reply.acked,
- resp_clen = contentdesc
+ resp_clen = contentdesc,
+ resp_rate = "{0}/s".format(rate),
))
t = f.response.headers["content-type"]
if t: