Repository: mitmproxy/mitmproxy

Issue:
Client Address is not displayed for flows from dumpfiles
I have two clients connecting to mitmproxy now, and I'd like to see the client IP for each request in the "Detail" tab.

Maybe show the server's IP too, since it can differ when connections come from different local IPs (e.g. 127.0.0.1 and 192.168.1.101).



Discussion:
Which version of mitmproxy are you using? The client IP is in the details tab in 0.15.

No, I don't see the client IP, there are only timings:

![mitmproxy](https://cloud.githubusercontent.com/assets/440661/12556487/1494ab08-c3c1-11e5-83e9-920a1c95b4bd.png)

```
$ mitmproxy --version
mitmproxy 0.15
```

I'm using Arch Linux.

That's interesting...

![image](https://cloud.githubusercontent.com/assets/1019198/12558540/549d9aa6-c390-11e5-8713-54ecaacbc385.png)

Ok, looks like connection details are hidden if I load flows from an dumpfile - this is clearly a bug.

But I did it live.

I find that `flow.client_conn`[here](https://github.com/mitmproxy/mitmproxy/blob/master/libmproxy/console/flowdetailview.py#L79) is a false value, because its `.finished = True`.

Being Arch Linux user as well, I can confirm that dump file is not the reason - same behavior is for live capture occurs at mine as well.

Hadn't ever need client connection details, thus even wasn't aware of this particular feature, thus cannot say whether it is a bug that always been there, or something newly introduced.

Willing to help this great project myself, I'll take a look into this issue on a spare moment...

Here is Arch packages versions of dependencies, just for reference:
community/python2-netlib 0.15.1-2
community/python2-tornado 4.3.0-1
community/python2-configargparse 0.10.0-1
community/python2-pyperclip 1.5.26-1
community/python2-blinker 1.4-2
community/python2-pyparsing 2.0.7-1
community/python2-html2text 2015.11.4-1
community/python2-six 1.10.0-1
extra/python2-lxml 3.5.0-1
community/python2-pillow 3.1.0-1
community/python2-watchdog 0.8.3-4

I am not sure if this expected behaviour, but I took the following screenshots of the SAME flow at different times.

In the first case, Both addresses are visible:

![both addresses visible](https://cloud.githubusercontent.com/assets/1449512/12574896/0437d7cc-c42e-11e5-96e4-960109f559f0.png)

Then after some time, only the Client connection is visible:

![only client connection visible](https://cloud.githubusercontent.com/assets/1449512/12574911/1e946e00-c42e-11e5-9205-8c51adc6f3c5.png)

After some more time, none of the addresses are now visible:

![no address visible](https://cloud.githubusercontent.com/assets/1449512/12574925/30ad0944-c42e-11e5-839e-3c517a6abfda.png)

I am using Kubuntu 15.10, with mitmproxy from the Github master tip.


Resolving patch:
diff --git a/libmproxy/console/flowdetailview.py b/libmproxy/console/flowdetailview.py
--- a/libmproxy/console/flowdetailview.py
+++ b/libmproxy/console/flowdetailview.py
@@ -20,7 +20,7 @@ def flowdetails(state, flow):
     req = flow.request
     resp = flow.response
 
-    if sc:
+    if sc is not None:
         text.append(urwid.Text([("head", "Server Connection:")]))
         parts = [
             ["Address", "%s:%s" % sc.address()],
@@ -76,7 +76,7 @@ def flowdetails(state, flow):
                 common.format_keyvals(parts, key="key", val="text", indent=4)
             )
 
-    if cc:
+    if cc is not None:
         text.append(urwid.Text([("head", "Client Connection:")]))
 
         parts = [


Test patch: