def do_GET(self):
     from Toolkit import log
     self.result = None
     try:
         log.info(self.path)
         
         if self.path == "/stopDelayedRestart.foo":
             self.send_response(200)
             self.send_header('Content-type',    'text/html')
             self.end_headers()
             self.wfile.write("OK Mr '" + str(self.client_address[0]) + "' the operation will be aborted...")
             # Stop the server
             log.debug("Client '" + str(self.client_address[0]) + "' cancelled the operation")
             self.server.stop = True
             self.server.result = 1 # someone cancelled
             
         if self.path == "/timeOut.foo":
             self.send_response(200)
             self.end_headers()               
             # Stop the server
             self.server.stop = True
             self.server.result = 0 # timeout occured
                             
         return
             
     except IOError:
         self.send_error(404,'File Not Found: %s' % self.path)
Esempio n. 2
0
    def run(self):
        from Toolkit import log

        for i in xrange(int(self.runTime)):
            time.sleep(1)
            log.debug("Time remaining: " + str(self.runTime - i) + " sec")
            if self.stopped():
                return

        log.debug("Time is up. Attempting to hit '" + self.urlToHit + "'")
        urllib.urlopen(self.urlToHit)