

def get_frame(self):
    'Get one stomp frame'
    while (not ('\x00' in self.incomingData)):
        data = self.socket.recv(1024)
        if (not data):
            raise Exception('Socket seem closed.')
        else:
            self.incomingData += data
    split_data = self.incomingData.split('\x00', 1)
    self.incomingData = split_data[1]
    frame_split = split_data[0].split('\n')
    command = frame_split[0]
    headers = []
    body = ''
    headerMode = True
    for x in frame_split[1:]:
        if ((x == '') and headerMode):
            headerMode = False
        elif headerMode:
            (key, value) = x.split(':', 1)
            headers.append((key, value))
        else:
            body += (x + '\n')
    body = body[:(- 1)]
    return (command, headers, body)

dataset/ETHPy150Open ebu/radiodns-plugit/RadioVisServer/tests.py Main.get_frame/original