Package: httproxy
This module implements a tiny HTTP proxy by extendingBaseHTTPServer.
Supports theGET,HEAD,POST,PUT,DELETEandCONNECTmethods.The latest version can be installed viaPyPI:$ pip install httproxyor:$ easy_install httproxyThesource code repositoryandissue
trackerare maintained onGitHub.QuickstartUsage:httproxy [options]
httproxy [options] <allowed-client> ...Options:-h, --help                   Show this screen.
--version                    Show version and exit.
-H, --host HOST              Host to bind to [default: 127.0.0.1].
-p, --port PORT              Port to bind to [default: 8000].
-l, --logfile PATH           Path to the logfile [default: STDOUT].
-i, --pidfile PIDFILE        Path to the pidfile [default: httproxy.pid].
-d, --daemon                 Daemonize (run in the background). The
                             default logfile path is httproxy.log in
                             this case.
-c, --configfile CONFIGFILE  Path to a configuration file.
-v, --verbose                Log headers.To start the proxy server and bind it to port 22222 (the port on which it will
listen and accept connections):httproxy -p 22222To start the proxy server, bind it to port 22222 and tell it to log all requests
to the filehttproxy.log:httproxy -p 22222 -l httproxy.logTo start the proxy server so it only allows connections from IP123.123.123.123:httproxy 123.123.123.123To start the proxy server bound to port 22222, log to filehttproxy.logand run
the server in the background (as a daemon):httproxy -p 22222 -l httproxy.log -dConfiguration fileEvery option stated as a command-line argument can be passed using
a configuration file. httproxy looks for the following files to read
configuration:/etc/httproxy/config$HOME/.httproxy/config(or%HOME%\.httproxy\configon Windows)the value specified in--configfileon command-lineThe names of the settings in themainsection are derived from the long
command line option names.Theallowed-clientssection holds a list of hostnames that can access the
proxy, one hostname per line. Remove this section or leave empty to allow any
client to connect.An example file:[main]
host = localhost
port = 8011
logfile = /Users/ambv/.httproxy/log
pidfile = /Users/ambv/.httproxy/pid
daemon = yes
verbose = yes

[allowed-clients]
localhost
192.168.0.1Note:command-line options have precedence over configuration file settings.Optional dependenciesIf you installsetproctitle, the name of the process reported bypswill
be more descriptive.If you installpsutil, httproxy will be able to automatically remove stale
pidfiles on startup.Change Log0.9.0ability to read configuration from a file (--configfile)ability to specify the address the proxy will bind to (--host)ability to log headers sent and received (--verbose)better process management: pidfile support, a more descriptive process title
(with the optionalsetproctitledependency)fixed spurious[Errno 54] Connection reset by peertracebacksproperly shuts down when receivingSIGHUP,SIGINTorSIGTERMmajor code refactoringcompatible with Python 2.6 and 2.7 only: requiresdocoptandconfigparser0.3.1added rudimentary FTP file retrievaladded custom logging methodsadded code to make it run as a standalone applicationUpgraded byMitko Haralanovin 2009.0.2.1basic version hosted in 2006 by the original author athttp://www.oki-osk.jp/esc/python/proxy/AuthorsScript based on work by Suzuki Hisao and Mitko Haralanov, currently maintained
byŁukasz Langa.