Ejemplo n.º 1
0
class ClientInputHandler(threading.Thread):
    def __init__(self, processHandler):
        threading.Thread.__init__(self)
        self.client = processHandler.client
        self.responseParser = ResponseParser(processHandler)
    def __getFullMessage(self):
        ret = ''
        for line in self.client.stdout:
            line = line.decode('UTF-8')
            if line.lower() != 'end\n':
                ret +=line
            else:
                return ret

    def run(self):
        for line in self.client.stdout:
            line = line.decode('UTF-8')
            if line.lower() == 'request\n':
                parseRequest(self.__getFullMessage())
            elif line.lower() == 'response\n':
                self.responseParser.parse(self.__getFullMessage())