variablize reply pkt, ignore, Makefile

This commit is contained in:
Abhinav Singh 2013-12-24 03:21:45 +05:30
parent 807c93f253
commit 755f0e07a1
3 changed files with 26 additions and 6 deletions

3
.gitignore vendored
View File

@ -1,7 +1,8 @@
.project
.pydevproject
.settings
.coverage
*.pyc
cover
dist
proxy.py.egg-info

17
Makefile Normal file
View File

@ -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

View File

@ -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: