'Read until EOF, using multiple read() call.'

def readall(self):

    res = bytearray()
    while True:
        data = self.read(DEFAULT_BUFFER_SIZE)
        if (not data):
            break
        res += data
    if res:
        return bytes(res)
    else:
        return data
