diff options
-rw-r--r-- | proxy.py | 6 |
1 files changed, 6 insertions, 0 deletions
@@ -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 |