From 7b3d3dc85e9618f4b16f2c81a37429ebdaf5ebf2 Mon Sep 17 00:00:00 2001 From: Aldo Cortesi Date: Wed, 2 Jan 2013 14:02:41 +1300 Subject: [PATCH] Documentation, setup.py updates, styling. --- doc-src/02-docstyle.css | 4 +++ doc-src/_layout.html | 10 ++++-- doc-src/anticache.html | 6 ++-- doc-src/clientreplay.html | 5 ++- doc-src/filters.html | 4 ++- doc-src/index.py | 14 ++++++--- doc-src/install.html | 61 +++++++++++++++++-------------------- doc-src/proxyauth.html | 2 ++ doc-src/setheaders.html | 2 ++ libmproxy/authentication.py | 4 +-- setup.py | 3 -- 11 files changed, 62 insertions(+), 53 deletions(-) create mode 100644 doc-src/proxyauth.html create mode 100644 doc-src/setheaders.html diff --git a/doc-src/02-docstyle.css b/doc-src/02-docstyle.css index ad2235e7e..855899f60 100644 --- a/doc-src/02-docstyle.css +++ b/doc-src/02-docstyle.css @@ -3,3 +3,7 @@ font-size: 1em; background: #000000; } + +pre { + color: #333; +} diff --git a/doc-src/_layout.html b/doc-src/_layout.html index 826279ef9..a4e84bcc8 100644 --- a/doc-src/_layout.html +++ b/doc-src/_layout.html @@ -24,14 +24,16 @@ $!nav("faq.html", this, state)!$ + $!nav("anticache.html", this, state)!$ $!nav("clientreplay.html", this, state)!$ + $!nav("filters.html", this, state)!$ + $!nav("proxyauth.html", this, state)!$ + $!nav("replacements.html", this, state)!$ $!nav("serverreplay.html", this, state)!$ + $!nav("setheaders.html", this, state)!$ $!nav("sticky.html", this, state)!$ $!nav("reverseproxy.html", this, state)!$ $!nav("upstreamcerts.html", this, state)!$ - $!nav("replacements.html", this, state)!$ - $!nav("anticache.html", this, state)!$ - $!nav("filters.html", this, state)!$ $!nav("ssl.html", this, state)!$ @@ -58,7 +60,9 @@
+ $!body!$
diff --git a/doc-src/anticache.html b/doc-src/anticache.html index 79f0683dd..d97e9f5f9 100644 --- a/doc-src/anticache.html +++ b/doc-src/anticache.html @@ -5,6 +5,6 @@ When the __anticache__ option is passed to mitmproxy, it removes headers (__if-none-match__ and __if-modified-since__) that might elicit a 304-not-modified response from the server. This is useful when you want to make -sure you capture an HTTP exchange in its totality, and during [client -replay](@!urlTo("clientreplay.html")!@). - +sure you capture an HTTP exchange in its totality. It's also often used during +[client replay](@!urlTo("clientreplay.html")!@), when you want to make sure the +server responds with complete data. diff --git a/doc-src/clientreplay.html b/doc-src/clientreplay.html index d4b1c3ff0..c94f50348 100644 --- a/doc-src/clientreplay.html +++ b/doc-src/clientreplay.html @@ -9,6 +9,5 @@ before starting the next request. This might differ from the recorded conversation, where requests may have been made concurrently. You may want to use client-side replay in conjunction with the -[anticache](@!urlTo("anticache.html")!@) option. - - +[anticache](@!urlTo("anticache.html")!@) option, to make sure the server +responds with complete data. diff --git a/doc-src/filters.html b/doc-src/filters.html index 2424c6f8e..c7f0f78bc 100644 --- a/doc-src/filters.html +++ b/doc-src/filters.html @@ -2,13 +2,15 @@ Many commands in __mitmproxy__ and __mitmdump__ take a filter expression. Filter expressions consist of the following operators: - +
+ +
@!i[0]!@ @!i[1]!@
- Regexes are Python-style diff --git a/doc-src/index.py b/doc-src/index.py index 9684306b5..f2a07db8e 100644 --- a/doc-src/index.py +++ b/doc-src/index.py @@ -65,16 +65,20 @@ pages = [ Page("install.html", "Installation"), Page("mitmproxy.html", "mitmproxy"), Page("mitmdump.html", "mitmdump"), + + Page("anticache.html", "Anticache"), Page("clientreplay.html", "Client-side replay"), + Page("filters.html", "Filter expressions"), + Page("setheaders.html", "Set Headers"), Page("serverreplay.html", "Server-side replay"), Page("sticky.html", "Sticky cookies and auth"), - Page("upstreamcerts.html", "Upstream Certs"), + Page("proxyauth.html", "Proxy Authentication"), Page("replacements.html", "Replacements"), Page("reverseproxy.html", "Reverse proxy mode"), - Page("anticache.html", "Anticache"), - Page("filters.html", "Filter expressions"), - Page("ssl.html", "SSL Overview"), - Page("transparent.html", "Transparent Overview"), + Page("upstreamcerts.html", "Upstream Certs"), + + Page("ssl.html", "Overview"), + Page("transparent.html", "Overview"), Directory("certinstall"), Directory("scripting"), Directory("tutorials"), diff --git a/doc-src/install.html b/doc-src/install.html index 6f4bc5305..30e2774d6 100644 --- a/doc-src/install.html +++ b/doc-src/install.html @@ -1,54 +1,49 @@ -## Using Pip +The preferred way to install mitmproxy - whether you're installing the latest +release or from source - is to use [pip](http://www.pip-installer.org/). If you +don't already have pip on your system, you can find installation instructions +[here](http://www.pip-installer.org/en/latest/installing.html). -The preferred way to install mitmproxy is to use -[pip](http://pypi.python.org/pypi/pip). A single command will install the -latest release of mitmproxy, along with all its dependencies: -
-sudo pip install mitmproxy
+## Installing the latest release
+
+A single command will download and install the latest release of mitmproxy,
+along with all its dependencies:
+
+
+pip install mitmproxy
 
-## From Source +## Installing from source -- When installing from source, you will need to install the -[dependencies](@!urlTo("index.html")!@) by hand. -- Then run the following command from the base of the source distribution: +When installing from source, the easiest method is still to use pip. In this +case run: -
-sudo python setup.py install
+
+pip install /path/to/source
 
+Note that if you're installing current git master, you will also have to +install the current git master of [netlib](http://github.com/cortesi/netlib) by +hand. ## OSX +- If you're running a Python interpreter installed with homebrew (or similar), +you may have to install some dependencies by hand. - Make sure that XCode is installed from the App Store, and that the command-line tools have been downloaded (XCode/Preferences/Downloads). -- Install __pip__ using the following command: - -
-sudo easy_install pip
-
- -- Now use __pip__ to set up the dependencies and do the install: - -
-sudo pip install mitmproxy
-
- -This procedure may vary if, for instance, you've installed Python from an -external source like [homebrew](http://mxcl.github.com/homebrew/). In that -case, the easiest way to proceed is to first install __easy_install__, then -continue as above. +- Now use __pip__ to do the installation, as above. There are a few bits of customization you might want to do to make mitmproxy -comfortable to use. At the moment, mitmproxy's color scheme is optimized for a -dark background terminal, so you probably want to change the default. You can -use the OSX open program to create a simple and effective -~/.mailcap file to view HTTP bodies: +comfortable to use on OSX. The default color scheme is optimized for a dark +background terminal, but you can select a palette for a light terminal +background with the --palette option. You can use the OSX open program +to create a simple and effective ~/.mailcap file to view request and +response bodies: -
+
 application/*; /usr/bin/open -Wn %s
 audio/*; /usr/bin/open -Wn %s
 image/*; /usr/bin/open -Wn %s
diff --git a/doc-src/proxyauth.html b/doc-src/proxyauth.html
new file mode 100644
index 000000000..224b9e2d8
--- /dev/null
+++ b/doc-src/proxyauth.html
@@ -0,0 +1,2 @@
+
+Proxy auth.
diff --git a/doc-src/setheaders.html b/doc-src/setheaders.html
new file mode 100644
index 000000000..d000e95b5
--- /dev/null
+++ b/doc-src/setheaders.html
@@ -0,0 +1,2 @@
+
+Setheaders.
diff --git a/libmproxy/authentication.py b/libmproxy/authentication.py
index 1f1f40ae2..500ead6b8 100644
--- a/libmproxy/authentication.py
+++ b/libmproxy/authentication.py
@@ -12,7 +12,7 @@ class NullProxyAuth():
     def clean(self, headers):
         """
             Clean up authentication headers, so they're not passed upstream.
-        """ 
+        """
         pass
 
     def authenticate(self, headers):
@@ -33,7 +33,7 @@ class BasicProxyAuth(NullProxyAuth):
     AUTH_HEADER = 'Proxy-Authorization'
     def __init__(self, password_manager, realm):
         NullProxyAuth.__init__(self, password_manager)
-        self.realm = realm 
+        self.realm = realm
 
     def clean(self, headers):
         del headers[self.AUTH_HEADER]
diff --git a/setup.py b/setup.py
index 6fb25c017..9a5398be9 100644
--- a/setup.py
+++ b/setup.py
@@ -93,7 +93,4 @@ setup(
             "Topic :: Software Development :: Testing"
         ],
         install_requires=["netlib", "urwid>=1.1", "pyasn1>0.1.2", "pyopenssl>=0.12", "PIL", "lxml"],
-        dependency_links=[
-            'https://github.com/cortesi/netlib/tarball/master#egg=netlib-0.1'
-        ],
 )