

def readinto(self, b):
    if (self.fp is None):
        return 0
    if (self._method == 'HEAD'):
        self._close_conn()
        return 0
    if self.chunked:
        return self._readinto_chunked(b)
    if (self.length is not None):
        if (len(b) > self.length):
            b = memoryview(b)[0:self.length]
    if PY2:
        data = self.fp.read(len(b))
        n = len(data)
        b[:n] = data
    else:
        n = self.fp.readinto(b)
    if ((not n) and b):
        self._close_conn()
    elif (self.length is not None):
        self.length -= n
        if (not self.length):
            self._close_conn()
    return n

dataset/ETHPy150Open OpenCobolIDE/OpenCobolIDE/open_cobol_ide/extlibs/future/backports/http/client.py HTTPResponse.readinto/original