capybara/virtualenv/lib/python2.7/site-packages/pip/_vendor/requests/packages/urllib3/response.py
def read_chunked(self, amt=None, decode_content=None):
        """
        Similar to :meth:`HTTPResponse.read`, but with an additional
        parameter: ``decode_content``.

        :param decode_content:
            If True, will attempt to decode the body based on the
            'content-encoding' header.
        """
        self._init_decoder()
        # FIXME: Rewrite this method and make it a class with a better structured logic.
        if not self.chunked:
            raise ResponseNotChunked("Response is not chunked. "
                "Header 'transfer-encoding: chunked' is missing.")

        if self._original_response and self._original_response._method.upper() == 'HEAD':
            # Don't bother reading the body of a HEAD request.
            # FIXME: Can we do this somehow without accessing private httplib _method?
            self._original_response.close()
            return

        while True:
            self._update_chunk_length()
            if self.chunk_left == 0:
                break
            chunk = self._handle_chunk(amt)
            yield self._decode(chunk, decode_content=decode_content,
                               flush_decoder=True)

        # Chunk content ends with \r\n: discard it.
        while True:
            line = self._fp.fp.readline()
            if not line:
                # Some sites may not end with '\r\n'.
                break
            if line == b'\r\n':
                break

        # We read everything; close the "file".
        if self._original_response:
            self._original_response.close()
        self.release_conn()
def read_chunked(self, amt=None, decode_content=None):
        """
        Similar to :meth:`HTTPResponse.read`, but with an additional
        parameter: ``decode_content``.

        :param decode_content:
            If True, will attempt to decode the body based on the
            'content-encoding' header.
        """
        self._init_decoder()
        # FIXME: Rewrite this method and make it a class with a better structured logic.
        if not self.chunked:
            raise ResponseNotChunked("Response is not chunked. "
                "Header 'transfer-encoding: chunked' is missing.")

        if self._original_response and self._original_response._method.upper() == 'HEAD':
            # Don't bother reading the body of a HEAD request.
            # FIXME: Can we do this somehow without accessing private httplib _method?
            self._original_response.close()
            return

        while True:
            self._update_chunk_length()
            if self.chunk_left == 0:
                break
            chunk = self._handle_chunk(amt)
            yield self._decode(chunk, decode_content=decode_content,
                               flush_decoder=True)

        # Chunk content ends with \r\n: discard it.
        while True:
            line = self._fp.fp.readline()
            if not line:
                # Some sites may not end with '\r\n'.
                break
            if line == b'\r\n':
                break

        # We read everything; close the "file".
        if self._original_response:
            self._original_response.close()
        self.release_conn()
Similar to :meth:`HTTPResponse.read`, but with an additional
        parameter: ``decode_content``.

        :param decode_content:
            If True, will attempt to decode the body based on the
            'content-encoding' header.