variablize reply pkt, ignore, Makefile
This commit is contained in:
parent
807c93f253
commit
755f0e07a1
|
@ -1,7 +1,8 @@
|
|||
.project
|
||||
.pydevproject
|
||||
.settings
|
||||
|
||||
.coverage
|
||||
*.pyc
|
||||
cover
|
||||
dist
|
||||
proxy.py.egg-info
|
||||
|
|
|
@ -0,0 +1,17 @@
|
|||
.PHONY: all clean package test
|
||||
|
||||
all: clean test
|
||||
|
||||
clean:
|
||||
find . -name '*.pyc' -exec rm -f {} +
|
||||
find . -name '*.pyo' -exec rm -f {} +
|
||||
find . -name '*~' -exec rm -f {} +
|
||||
|
||||
test:
|
||||
nosetests -v --with-coverage --cover-package=proxy --cover-erase --cover-html --nocapture
|
||||
|
||||
package:
|
||||
python setup.py sdist
|
||||
|
||||
release:
|
||||
python setup.py sdist register upload
|
12
proxy.py
12
proxy.py
|
@ -299,6 +299,12 @@ class Proxy(multiprocessing.Process):
|
|||
|
||||
self.request = HttpParser()
|
||||
self.response = HttpParser(HTTP_RESPONSE_PARSER)
|
||||
|
||||
self.connection_established_pkt = CRLF.join([
|
||||
'HTTP/1.1 200 Connection established',
|
||||
'Proxy-agent: proxy.py v%s' % __version__,
|
||||
CRLF
|
||||
])
|
||||
|
||||
def _now(self):
|
||||
return datetime.datetime.utcnow()
|
||||
|
@ -344,11 +350,7 @@ class Proxy(multiprocessing.Process):
|
|||
# queue appropriate response for client
|
||||
# notifying about established connection
|
||||
if self.request.method == "CONNECT":
|
||||
self.client.queue(CRLF.join([
|
||||
'HTTP/1.1 200 Connection established',
|
||||
'Proxy-agent: proxy.py v%s' % __version__,
|
||||
CRLF
|
||||
]))
|
||||
self.client.queue(self.connection_established_pkt)
|
||||
# for usual http requests, re-build request packet
|
||||
# and queue for the server with appropriate headers
|
||||
else:
|
||||
|
|
Loading…
Reference in New Issue