summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Keck <thomas@macbook.macbook>2010-03-12 20:18:24 +0100
committerThomas Keck <thomas@macbook.macbook>2010-03-12 20:18:24 +0100
commitd30216632dba3e24a831a1f9473e3f367e7aaf99 (patch)
tree27b23d7905ca6d9bb55bd56158f30acb9d82bef8
parent0d338b944706e165c9cdb205a79075beaa48253b (diff)
downloadmagicproxy-d30216632dba3e24a831a1f9473e3f367e7aaf99.tar.gz
magicproxy-d30216632dba3e24a831a1f9473e3f367e7aaf99.zip
Time
-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