def __init__(self, program, ctl): threading.Thread.__init__(self) self.killed = False self.program = program self.ctl = ctl self.listener = http_client.Listener() self.output_handler = http_client.HTTPHandler(self.listener, self.ctl.options.username, self.ctl.options.password) self.error_handler = http_client.HTTPHandler(self.listener, self.ctl.options.username, self.ctl.options.password)
def _tailf(self, path): self.ctl.output('==> Press Ctrl-C to exit <==') username = self.ctl.options.username password = self.ctl.options.password handler = None try: # Python's urllib2 (at least as of Python 2.4.2) isn't up # to this task; it doesn't actually implement a proper # HTTP/1.1 client that deals with chunked responses (it # always sends a Connection: close header). We use a # homegrown client based on asyncore instead. This makes # me sad. import supervisor.http_client as http_client if self.listener is None: listener = http_client.Listener() else: listener = self.listener # for unit tests handler = http_client.HTTPHandler(listener, username, password) handler.get(self.ctl.options.serverurl, path) asyncore.loop() except KeyboardInterrupt: if handler: handler.close() self.ctl.output('') return