diff options
-rw-r--r-- | .travis.yml | 2 | ||||
-rw-r--r-- | CONTRIBUTING.md | 39 | ||||
-rw-r--r-- | libmproxy/console/contentview.py | 7 | ||||
-rw-r--r-- | libmproxy/console/flowview.py | 9 | ||||
-rw-r--r-- | libmproxy/protocol/tcp.py | 4 | ||||
-rw-r--r-- | test/test_console_contentview.py | 18 |
6 files changed, 65 insertions, 14 deletions
diff --git a/.travis.yml b/.travis.yml index 2dc898c2..ae4a9641 100644 --- a/.travis.yml +++ b/.travis.yml @@ -2,7 +2,7 @@ language: python sudo: false python: - "2.7" - - pypy +# - pypy # pypy 2.5.0 has a regression bug which breaks our test suite. # command to install dependencies, e.g. pip install -r requirements.txt --use-mirrors install: - "pip install --upgrade --src . -r requirements.txt" diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md new file mode 100644 index 00000000..66851622 --- /dev/null +++ b/CONTRIBUTING.md @@ -0,0 +1,39 @@ +# Contributing + +Thank you for your interest in contributing to mitmproxy! + +# Bug Reports + +Bug Reports are very welcome - please file them on the GitHub [issue tracker](https://github.com/mitmproxy/mitmproxy/issues). +You can use the following template to structure your report: + +``` +##### Steps to reproduce the problem: +1. +2. +3. + +##### What is the expected behavior? + + +##### What went wrong? + + +##### Any other comments? + + +--- +mitmproxy version: +Operating System: +``` + +# Feature Requests + +We're happy to hear what you'd like to see in mitmproxy. Please file feature requests on the GitHub [issue tracker](https://github.com/mitmproxy/mitmproxy/issues). + +# Patches + +We're always happy to accept patches. Please submit them in the form of pull requests to the main [mitmproxy repository](https://github.com/mitmproxy/mitmproxy/). +If you're working on something cool, please do not hesistate and get in touch! + +Instructions for setting up a development environment can be found in the [README](README.mkd). diff --git a/libmproxy/console/contentview.py b/libmproxy/console/contentview.py index b1b99bb6..582723bb 100644 --- a/libmproxy/console/contentview.py +++ b/libmproxy/console/contentview.py @@ -488,12 +488,15 @@ def get(name): return i -def get_content_view(viewmode, hdrItems, content, limit, logfunc): +def get_content_view(viewmode, hdrItems, content, limit, logfunc, is_request): """ Returns a (msg, body) tuple. """ if not content: - return ("No content", "") + if is_request: + return "No request content (press tab to view response)", "" + else: + return "No content", "" msg = [] hdrs = flow.ODictCaseless([list(i) for i in hdrItems]) diff --git a/libmproxy/console/flowview.py b/libmproxy/console/flowview.py index c01bb08f..f95cd776 100644 --- a/libmproxy/console/flowview.py +++ b/libmproxy/console/flowview.py @@ -3,7 +3,7 @@ import os, sys, copy import urwid from . import common, grideditor, contentview from .. import utils, flow, controller -from ..protocol.http import HTTPResponse, CONTENT_MISSING, decoded +from ..protocol.http import HTTPRequest, HTTPResponse, CONTENT_MISSING, decoded class SearchError(Exception): pass @@ -131,8 +131,8 @@ class FlowView(common.WWrap): else: self.view_request() - def _cached_content_view(self, viewmode, hdrItems, content, limit): - return contentview.get_content_view(viewmode, hdrItems, content, limit, self.master.add_event) + def _cached_content_view(self, viewmode, hdrItems, content, limit, is_request): + return contentview.get_content_view(viewmode, hdrItems, content, limit, self.master.add_event, is_request) def content_view(self, viewmode, conn): full = self.state.get_flow_setting( @@ -149,7 +149,8 @@ class FlowView(common.WWrap): viewmode, tuple(tuple(i) for i in conn.headers.lst), conn.content, - limit + limit, + isinstance(conn, HTTPRequest) ) return (description, text_objects) diff --git a/libmproxy/protocol/tcp.py b/libmproxy/protocol/tcp.py index d2d21829..5314b577 100644 --- a/libmproxy/protocol/tcp.py +++ b/libmproxy/protocol/tcp.py @@ -56,7 +56,9 @@ class TCPHandler(ProtocolHandler): conns.remove(src.rfile) # Shutdown connection to the other peer if dst.ssl_established: - dst.connection.shutdown() + # We can't half-close a connection, so we just close everything here. + # Sockets will be cleaned up on a higher level. + return else: dst.connection.shutdown(socket.SHUT_WR) diff --git a/test/test_console_contentview.py b/test/test_console_contentview.py index abc762fa..44378cf7 100644 --- a/test/test_console_contentview.py +++ b/test/test_console_contentview.py @@ -190,7 +190,8 @@ Larry [["content-type", "application/json"]], "[1, 2, 3]", 1000, - lambda x, l: None + lambda x, l: None, + False ) assert "Raw" in r[0] @@ -199,7 +200,8 @@ Larry [["content-type", "application/json"]], "[1, 2, 3]", 1000, - lambda x, l: None + lambda x, l: None, + False ) assert r[0] == "JSON" @@ -208,7 +210,8 @@ Larry [["content-type", "application/json"]], "[1, 2", 1000, - lambda x, l: None + lambda x, l: None, + False ) assert "Raw" in r[0] @@ -217,7 +220,8 @@ Larry [], "[1, 2", 1000, - lambda x, l: None + lambda x, l: None, + False ) assert "Raw" in r[0] @@ -230,7 +234,8 @@ Larry ], encoding.encode('gzip', "[1, 2, 3]"), 1000, - lambda x, l: None + lambda x, l: None, + False ) assert "decoded gzip" in r[0] assert "JSON" in r[0] @@ -243,7 +248,8 @@ Larry ], encoding.encode('gzip', "[1, 2, 3]"), 1000, - lambda x, l: None + lambda x, l: None, + False ) assert "decoded gzip" in r[0] assert "Raw" in r[0] |