summaryrefslogtreecommitdiff
path: root/proxy.py
diff options
context:
space:
mode:
Diffstat (limited to 'proxy.py')
-rw-r--r--proxy.py6
1 files changed, 6 insertions, 0 deletions
diff --git a/proxy.py b/proxy.py
index 0c4ea06..963275f 100644
--- a/proxy.py
+++ b/proxy.py
@@ -25,6 +25,8 @@ class Fetcher(asynchat.async_chat):
self.range = range
self.content_length = content_length
+ self.start_time = time.time()
+
self.pos = range[0]
asynchat.async_chat.__init__(self)
self.set_terminator("\r\n")
@@ -45,6 +47,9 @@ class Fetcher(asynchat.async_chat):
def debug_send(self, data):
print "SEND", data
self.send(data)
+
+ def time(self):
+ return self.stop_time - self.start_time
def collect_incoming_data(self, data):
if self.state==2:#body
@@ -54,6 +59,7 @@ class Fetcher(asynchat.async_chat):
if self.pos >= self.range[1]:
self.reader.finished()
print "fetcher finished"
+ self.stop_time = time.time()
self.close_when_done()
elif self.state ==1: #header
self.http_header += data