updated README.md
This commit is contained in:
parent
cffbc48c06
commit
807c93f253
39
README.md
39
README.md
|
@ -1,4 +1,41 @@
|
||||||
proxy.py
|
proxy.py
|
||||||
========
|
========
|
||||||
|
|
||||||
HTTP Proxy Server in Python.
|
Lightweight HTTP Proxy Server in Python.
|
||||||
|
|
||||||
|
Features
|
||||||
|
--------
|
||||||
|
|
||||||
|
- Distributed as a single file module
|
||||||
|
- No dependency other than the Python standard library
|
||||||
|
- Support for http, https, websockets request proxy
|
||||||
|
|
||||||
|
Install
|
||||||
|
-------
|
||||||
|
|
||||||
|
To install proxy.py, simply:
|
||||||
|
|
||||||
|
$ pip install proxy.py
|
||||||
|
|
||||||
|
This will add `proxy.py` inside your python bin folder.
|
||||||
|
|
||||||
|
Usage
|
||||||
|
-----
|
||||||
|
|
||||||
|
```
|
||||||
|
$ proxy.py -h
|
||||||
|
usage: proxy.py [-h] [--hostname HOSTNAME] [--port PORT]
|
||||||
|
[--log-level LOG_LEVEL]
|
||||||
|
|
||||||
|
proxy.py v0.1
|
||||||
|
|
||||||
|
optional arguments:
|
||||||
|
-h, --help show this help message and exit
|
||||||
|
--hostname HOSTNAME Default: 127.0.0.1
|
||||||
|
--port PORT Default: 8899
|
||||||
|
--log-level LOG_LEVEL
|
||||||
|
DEBUG, INFO, WARNING, ERROR, CRITICAL
|
||||||
|
|
||||||
|
Having difficulty using proxy.py? Report at:
|
||||||
|
https://github.com/abhinavsingh/proxy.py/issues/new
|
||||||
|
```
|
||||||
|
|
7
proxy.py
7
proxy.py
|
@ -25,7 +25,7 @@ import logging
|
||||||
import socket
|
import socket
|
||||||
import select
|
import select
|
||||||
|
|
||||||
logger = logging.getLogger('proxy.py')
|
logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
CRLF, COLON, SP = '\r\n', ':', ' '
|
CRLF, COLON, SP = '\r\n', ':', ' '
|
||||||
|
|
||||||
|
@ -103,7 +103,8 @@ class HttpParser(object):
|
||||||
self.buffer = ''
|
self.buffer = ''
|
||||||
|
|
||||||
more = True if len(data) > 0 else False
|
more = True if len(data) > 0 else False
|
||||||
while more: more, data = self.process(data)
|
while more:
|
||||||
|
more, data = self.process(data)
|
||||||
self.buffer = data
|
self.buffer = data
|
||||||
|
|
||||||
def process(self, data):
|
def process(self, data):
|
||||||
|
@ -209,7 +210,7 @@ class HttpParser(object):
|
||||||
return line, data
|
return line, data
|
||||||
|
|
||||||
class Connection(object):
|
class Connection(object):
|
||||||
"""TCP connection abstraction"""
|
"""TCP connection abstraction."""
|
||||||
|
|
||||||
def __init__(self, what):
|
def __init__(self, what):
|
||||||
self.buffer = ''
|
self.buffer = ''
|
||||||
|
|
Loading…
Reference in New Issue