terminal.py http additions
This commit is contained in:
parent
6ecebfffcc
commit
34d08d9255
|
@ -207,6 +207,26 @@ class curses_terminal(threading.Thread):
|
||||||
self.keep_running = False
|
self.keep_running = False
|
||||||
self.send_command('quit', 0)
|
self.send_command('quit', 0)
|
||||||
|
|
||||||
|
class http_terminal(threading.Thread):
|
||||||
|
def __init__(self, input_q, output_q, endpoint, **kwds):
|
||||||
|
from http import http_server
|
||||||
|
|
||||||
|
threading.Thread.__init__ (self, **kwds)
|
||||||
|
self.setDaemon(1)
|
||||||
|
self.input_q = input_q
|
||||||
|
self.output_q = output_q
|
||||||
|
self.endpoint = endpoint
|
||||||
|
self.keep_running = True
|
||||||
|
self.server = http_server(self.input_q, self.output_q, self.endpoint)
|
||||||
|
|
||||||
|
self.start()
|
||||||
|
|
||||||
|
def end_terminal(self):
|
||||||
|
self.keep_running = False
|
||||||
|
|
||||||
|
def run(self):
|
||||||
|
self.server.run()
|
||||||
|
|
||||||
class udp_terminal(threading.Thread):
|
class udp_terminal(threading.Thread):
|
||||||
def __init__(self, input_q, output_q, port, **kwds):
|
def __init__(self, input_q, output_q, port, **kwds):
|
||||||
threading.Thread.__init__ (self, **kwds)
|
threading.Thread.__init__ (self, **kwds)
|
||||||
|
@ -256,6 +276,8 @@ def op25_terminal(input_q, output_q, terminal_type):
|
||||||
elif terminal_type[0].isdigit():
|
elif terminal_type[0].isdigit():
|
||||||
port = int(terminal_type)
|
port = int(terminal_type)
|
||||||
return udp_terminal(input_q, output_q, port)
|
return udp_terminal(input_q, output_q, port)
|
||||||
|
elif terminal_type.startswith('http:'):
|
||||||
|
return http_terminal(input_q, output_q, terminal_type.replace('http:', ''))
|
||||||
else:
|
else:
|
||||||
sys.stderr.write('warning: unsupported terminal type: %s\n', terminal_type)
|
sys.stderr.write('warning: unsupported terminal type: %s\n', terminal_type)
|
||||||
return None
|
return None
|
||||||
|
|
Loading…
Reference in New Issue