def _rename_with_content_disposition(self, response: HTTPResponse):
        '''Rename using the Content-Disposition header.'''
        if not self._filename:
            return

        if response.request.url_info.scheme not in ('http', 'https'):
            return

        header_value = response.fields.get('Content-Disposition')

        if not header_value:
            return

        filename = parse_content_disposition(header_value)

        if filename:
            dir_path = os.path.dirname(self._filename)
            new_filename = self._path_namer.safe_filename(filename)
            self._filename = os.path.join(dir_path, new_filename)
Rename using the Content-Disposition header.