From d30216632dba3e24a831a1f9473e3f367e7aaf99 Mon Sep 17 00:00:00 2001 From: Thomas Keck Date: Fri, 12 Mar 2010 20:18:24 +0100 Subject: Time --- proxy.py | 6 ++++++ 1 file changed, 6 insertions(+) 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 -- cgit v1.2.1