rubygems-update 3.3.18 → 3.3.22
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +65 -0
- data/Manifest.txt +11 -0
- data/bin/gem +2 -2
- data/bin/update_rubygems +4 -4
- data/bundler/CHANGELOG.md +100 -0
- data/bundler/UPGRADING.md +11 -4
- data/bundler/bundler.gemspec +6 -8
- data/bundler/lib/bundler/build_metadata.rb +2 -2
- data/bundler/lib/bundler/cli/common.rb +1 -0
- data/bundler/lib/bundler/cli/install.rb +5 -2
- data/bundler/lib/bundler/cli/outdated.rb +12 -3
- data/bundler/lib/bundler/cli/platform.rb +1 -1
- data/bundler/lib/bundler/cli.rb +7 -4
- data/bundler/lib/bundler/current_ruby.rb +14 -5
- data/bundler/lib/bundler/definition.rb +102 -31
- data/bundler/lib/bundler/dependency.rb +18 -85
- data/bundler/lib/bundler/dsl.rb +2 -2
- data/bundler/lib/bundler/endpoint_specification.rb +2 -13
- data/bundler/lib/bundler/feature_flag.rb +0 -1
- data/bundler/lib/bundler/fetcher.rb +6 -6
- data/bundler/lib/bundler/gem_helpers.rb +7 -1
- data/bundler/lib/bundler/gem_version_promoter.rb +8 -18
- data/bundler/lib/bundler/index.rb +10 -12
- data/bundler/lib/bundler/injector.rb +2 -1
- data/bundler/lib/bundler/inline.rb +1 -1
- data/bundler/lib/bundler/installer/standalone.rb +1 -1
- data/bundler/lib/bundler/installer.rb +14 -12
- data/bundler/lib/bundler/lazy_specification.rb +30 -23
- data/bundler/lib/bundler/lockfile_generator.rb +1 -1
- data/bundler/lib/bundler/man/bundle-add.1 +6 -2
- data/bundler/lib/bundler/man/bundle-add.1.ronn +4 -1
- data/bundler/lib/bundler/man/bundle-binstubs.1 +1 -1
- data/bundler/lib/bundler/man/bundle-cache.1 +7 -1
- data/bundler/lib/bundler/man/bundle-cache.1.ronn +7 -0
- data/bundler/lib/bundler/man/bundle-check.1 +1 -1
- data/bundler/lib/bundler/man/bundle-clean.1 +1 -1
- data/bundler/lib/bundler/man/bundle-config.1 +25 -6
- data/bundler/lib/bundler/man/bundle-config.1.ronn +16 -6
- data/bundler/lib/bundler/man/bundle-console.1 +53 -0
- data/bundler/lib/bundler/man/bundle-console.1.ronn +44 -0
- data/bundler/lib/bundler/man/bundle-doctor.1 +1 -1
- data/bundler/lib/bundler/man/bundle-exec.1 +2 -2
- data/bundler/lib/bundler/man/bundle-exec.1.ronn +1 -1
- data/bundler/lib/bundler/man/bundle-gem.1 +1 -1
- data/bundler/lib/bundler/man/bundle-help.1 +13 -0
- data/bundler/lib/bundler/man/bundle-help.1.ronn +12 -0
- data/bundler/lib/bundler/man/bundle-info.1 +1 -1
- data/bundler/lib/bundler/man/bundle-init.1 +1 -1
- data/bundler/lib/bundler/man/bundle-inject.1 +5 -2
- data/bundler/lib/bundler/man/bundle-inject.1.ronn +3 -1
- data/bundler/lib/bundler/man/bundle-install.1 +5 -1
- data/bundler/lib/bundler/man/bundle-install.1.ronn +6 -0
- data/bundler/lib/bundler/man/bundle-list.1 +1 -1
- data/bundler/lib/bundler/man/bundle-lock.1 +1 -1
- data/bundler/lib/bundler/man/bundle-open.1 +1 -1
- data/bundler/lib/bundler/man/bundle-outdated.1 +1 -1
- data/bundler/lib/bundler/man/bundle-platform.1 +16 -6
- data/bundler/lib/bundler/man/bundle-platform.1.ronn +14 -7
- data/bundler/lib/bundler/man/bundle-plugin.1 +81 -0
- data/bundler/lib/bundler/man/bundle-plugin.1.ronn +59 -0
- data/bundler/lib/bundler/man/bundle-pristine.1 +1 -1
- data/bundler/lib/bundler/man/bundle-remove.1 +1 -1
- data/bundler/lib/bundler/man/bundle-show.1 +1 -1
- data/bundler/lib/bundler/man/bundle-update.1 +1 -1
- data/bundler/lib/bundler/man/bundle-version.1 +35 -0
- data/bundler/lib/bundler/man/bundle-version.1.ronn +24 -0
- data/bundler/lib/bundler/man/bundle-viz.1 +4 -1
- data/bundler/lib/bundler/man/bundle-viz.1.ronn +2 -0
- data/bundler/lib/bundler/man/bundle.1 +15 -10
- data/bundler/lib/bundler/man/bundle.1.ronn +12 -7
- data/bundler/lib/bundler/man/gemfile.5 +23 -47
- data/bundler/lib/bundler/man/gemfile.5.ronn +32 -43
- data/bundler/lib/bundler/man/index.txt +4 -0
- data/bundler/lib/bundler/match_metadata.rb +13 -0
- data/bundler/lib/bundler/match_remote_metadata.rb +29 -0
- data/bundler/lib/bundler/plugin.rb +2 -0
- data/bundler/lib/bundler/remote_specification.rb +6 -11
- data/bundler/lib/bundler/resolver/base.rb +50 -0
- data/bundler/lib/bundler/resolver/spec_group.rb +11 -8
- data/bundler/lib/bundler/resolver.rb +95 -90
- data/bundler/lib/bundler/ruby_dsl.rb +1 -1
- data/bundler/lib/bundler/ruby_version.rb +5 -5
- data/bundler/lib/bundler/rubygems_ext.rb +52 -1
- data/bundler/lib/bundler/rubygems_gem_installer.rb +19 -12
- data/bundler/lib/bundler/settings.rb +1 -1
- data/bundler/lib/bundler/source/metadata.rb +1 -1
- data/bundler/lib/bundler/source_list.rb +4 -0
- data/bundler/lib/bundler/spec_set.rb +48 -33
- data/bundler/lib/bundler/version.rb +1 -1
- data/bundler/lib/bundler.rb +3 -3
- data/lib/rubygems/available_set.rb +3 -3
- data/lib/rubygems/basic_specification.rb +4 -4
- data/lib/rubygems/command.rb +25 -25
- data/lib/rubygems/command_manager.rb +9 -9
- data/lib/rubygems/commands/build_command.rb +8 -8
- data/lib/rubygems/commands/cert_command.rb +33 -33
- data/lib/rubygems/commands/check_command.rb +20 -20
- data/lib/rubygems/commands/cleanup_command.rb +17 -17
- data/lib/rubygems/commands/contents_command.rb +13 -13
- data/lib/rubygems/commands/dependency_command.rb +16 -16
- data/lib/rubygems/commands/environment_command.rb +5 -5
- data/lib/rubygems/commands/fetch_command.rb +8 -8
- data/lib/rubygems/commands/generate_index_command.rb +17 -17
- data/lib/rubygems/commands/help_command.rb +3 -3
- data/lib/rubygems/commands/info_command.rb +3 -3
- data/lib/rubygems/commands/install_command.rb +20 -20
- data/lib/rubygems/commands/list_command.rb +3 -3
- data/lib/rubygems/commands/lock_command.rb +4 -4
- data/lib/rubygems/commands/mirror_command.rb +3 -3
- data/lib/rubygems/commands/open_command.rb +9 -9
- data/lib/rubygems/commands/outdated_command.rb +5 -5
- data/lib/rubygems/commands/owner_command.rb +11 -11
- data/lib/rubygems/commands/pristine_command.rb +36 -36
- data/lib/rubygems/commands/push_command.rb +8 -8
- data/lib/rubygems/commands/query_command.rb +8 -8
- data/lib/rubygems/commands/rdoc_command.rb +17 -17
- data/lib/rubygems/commands/search_command.rb +3 -3
- data/lib/rubygems/commands/server_command.rb +3 -3
- data/lib/rubygems/commands/setup_command.rb +96 -106
- data/lib/rubygems/commands/signin_command.rb +9 -9
- data/lib/rubygems/commands/signout_command.rb +7 -7
- data/lib/rubygems/commands/sources_command.rb +21 -21
- data/lib/rubygems/commands/specification_command.rb +13 -13
- data/lib/rubygems/commands/stale_command.rb +2 -2
- data/lib/rubygems/commands/uninstall_command.rb +40 -40
- data/lib/rubygems/commands/unpack_command.rb +12 -12
- data/lib/rubygems/commands/update_command.rb +40 -56
- data/lib/rubygems/commands/which_command.rb +7 -7
- data/lib/rubygems/commands/yank_command.rb +11 -11
- data/lib/rubygems/config_file.rb +21 -21
- data/lib/rubygems/core_ext/kernel_gem.rb +1 -1
- data/lib/rubygems/core_ext/kernel_require.rb +1 -1
- data/lib/rubygems/core_ext/kernel_warn.rb +1 -1
- data/lib/rubygems/core_ext/tcpsocket_init.rb +1 -1
- data/lib/rubygems/defaults.rb +16 -16
- data/lib/rubygems/dependency.rb +9 -9
- data/lib/rubygems/dependency_installer.rb +13 -13
- data/lib/rubygems/dependency_list.rb +6 -6
- data/lib/rubygems/doctor.rb +18 -18
- data/lib/rubygems/errors.rb +2 -2
- data/lib/rubygems/exceptions.rb +5 -5
- data/lib/rubygems/ext/build_error.rb +1 -1
- data/lib/rubygems/ext/builder.rb +16 -16
- data/lib/rubygems/ext/cargo_builder.rb +7 -7
- data/lib/rubygems/ext/cmake_builder.rb +2 -2
- data/lib/rubygems/ext/configure_builder.rb +1 -1
- data/lib/rubygems/ext/ext_conf_builder.rb +8 -8
- data/lib/rubygems/ext/rake_builder.rb +3 -3
- data/lib/rubygems/ext.rb +7 -7
- data/lib/rubygems/gem_runner.rb +5 -5
- data/lib/rubygems/gemcutter_utilities.rb +31 -28
- data/lib/rubygems/indexer.rb +27 -27
- data/lib/rubygems/install_default_message.rb +2 -2
- data/lib/rubygems/install_message.rb +2 -2
- data/lib/rubygems/install_update_options.rb +55 -55
- data/lib/rubygems/installer.rb +32 -40
- data/lib/rubygems/installer_uninstaller_utils.rb +2 -2
- data/lib/rubygems/local_remote_options.rb +18 -20
- data/lib/rubygems/mock_gem_ui.rb +2 -2
- data/lib/rubygems/name_tuple.rb +4 -4
- data/lib/rubygems/optparse.rb +1 -1
- data/lib/rubygems/package/file_source.rb +2 -2
- data/lib/rubygems/package/old.rb +8 -8
- data/lib/rubygems/package/tar_header.rb +50 -50
- data/lib/rubygems/package/tar_reader/entry.rb +2 -2
- data/lib/rubygems/package/tar_reader.rb +1 -1
- data/lib/rubygems/package/tar_writer.rb +7 -7
- data/lib/rubygems/package.rb +54 -43
- data/lib/rubygems/package_task.rb +4 -4
- data/lib/rubygems/platform.rb +66 -55
- data/lib/rubygems/psych_tree.rb +1 -1
- data/lib/rubygems/query_utils.rb +35 -35
- data/lib/rubygems/rdoc.rb +2 -2
- data/lib/rubygems/remote_fetcher.rb +22 -22
- data/lib/rubygems/request/connection_pools.rb +4 -4
- data/lib/rubygems/request/http_pool.rb +1 -1
- data/lib/rubygems/request.rb +22 -22
- data/lib/rubygems/request_set/gem_dependency_api.rb +18 -18
- data/lib/rubygems/request_set/lockfile/parser.rb +26 -26
- data/lib/rubygems/request_set/lockfile/tokenizer.rb +4 -4
- data/lib/rubygems/request_set/lockfile.rb +5 -5
- data/lib/rubygems/request_set.rb +17 -17
- data/lib/rubygems/requirement.rb +6 -6
- data/lib/rubygems/resolver/activation_request.rb +3 -3
- data/lib/rubygems/resolver/api_set.rb +4 -4
- data/lib/rubygems/resolver/api_specification.rb +6 -6
- data/lib/rubygems/resolver/best_set.rb +5 -5
- data/lib/rubygems/resolver/conflict.rb +10 -10
- data/lib/rubygems/resolver/dependency_request.rb +2 -2
- data/lib/rubygems/resolver/git_set.rb +2 -2
- data/lib/rubygems/resolver/git_specification.rb +6 -6
- data/lib/rubygems/resolver/index_set.rb +3 -3
- data/lib/rubygems/resolver/index_specification.rb +6 -5
- data/lib/rubygems/resolver/installed_specification.rb +4 -4
- data/lib/rubygems/resolver/installer_set.rb +11 -16
- data/lib/rubygems/resolver/local_specification.rb +2 -2
- data/lib/rubygems/resolver/lock_set.rb +4 -4
- data/lib/rubygems/resolver/lock_specification.rb +4 -4
- data/lib/rubygems/resolver/molinillo.rb +1 -1
- data/lib/rubygems/resolver/specification.rb +1 -1
- data/lib/rubygems/resolver/vendor_set.rb +1 -1
- data/lib/rubygems/resolver/vendor_specification.rb +3 -3
- data/lib/rubygems/resolver.rb +39 -39
- data/lib/rubygems/s3_uri_signer.rb +6 -6
- data/lib/rubygems/safe_yaml.rb +2 -2
- data/lib/rubygems/security/policies.rb +11 -11
- data/lib/rubygems/security/policy.rb +18 -18
- data/lib/rubygems/security/signer.rb +5 -5
- data/lib/rubygems/security/trust_dir.rb +3 -3
- data/lib/rubygems/security.rb +28 -28
- data/lib/rubygems/security_option.rb +5 -5
- data/lib/rubygems/source/git.rb +21 -21
- data/lib/rubygems/source/installed.rb +1 -1
- data/lib/rubygems/source/local.rb +2 -2
- data/lib/rubygems/source/specific_file.rb +1 -1
- data/lib/rubygems/source.rb +16 -16
- data/lib/rubygems/spec_fetcher.rb +9 -9
- data/lib/rubygems/specification.rb +63 -62
- data/lib/rubygems/specification_policy.rb +15 -15
- data/lib/rubygems/stub_specification.rb +5 -5
- data/lib/rubygems/tsort.rb +1 -1
- data/lib/rubygems/uninstaller.rb +18 -18
- data/lib/rubygems/uri.rb +4 -4
- data/lib/rubygems/uri_formatter.rb +1 -1
- data/lib/rubygems/user_interaction.rb +33 -19
- data/lib/rubygems/util/licenses.rb +3 -3
- data/lib/rubygems/util.rb +10 -10
- data/lib/rubygems/validator.rb +5 -5
- data/lib/rubygems/version.rb +15 -9
- data/lib/rubygems/version_option.rb +3 -3
- data/lib/rubygems.rb +62 -61
- data/rubygems-update.gemspec +2 -2
- data/setup.rb +9 -9
- data/test/rubygems/helper.rb +132 -134
- data/test/rubygems/installer_test_case.rb +13 -13
- data/test/rubygems/package/tar_test_case.rb +2 -2
- data/test/rubygems/plugin/exception/rubygems_plugin.rb +1 -1
- data/test/rubygems/plugin/standarderror/rubygems_plugin.rb +1 -1
- data/test/rubygems/rubygems_plugin.rb +2 -2
- data/test/rubygems/specifications/rubyforge-0.0.1.gemspec +4 -4
- data/test/rubygems/test_bundled_ca.rb +10 -10
- data/test/rubygems/test_config.rb +3 -3
- data/test/rubygems/test_deprecate.rb +3 -3
- data/test/rubygems/test_exit.rb +2 -2
- data/test/rubygems/test_gem.rb +342 -342
- data/test/rubygems/test_gem_available_set.rb +21 -21
- data/test/rubygems/test_gem_bundler_version_finder.rb +1 -1
- data/test/rubygems/test_gem_command.rb +44 -44
- data/test/rubygems/test_gem_command_manager.rb +29 -29
- data/test/rubygems/test_gem_commands_build_command.rb +63 -63
- data/test/rubygems/test_gem_commands_cert_command.rb +97 -99
- data/test/rubygems/test_gem_commands_check_command.rb +4 -4
- data/test/rubygems/test_gem_commands_cleanup_command.rb +40 -40
- data/test/rubygems/test_gem_commands_contents_command.rb +27 -27
- data/test/rubygems/test_gem_commands_dependency_command.rb +36 -36
- data/test/rubygems/test_gem_commands_environment_command.rb +16 -16
- data/test/rubygems/test_gem_commands_fetch_command.rb +37 -37
- data/test/rubygems/test_gem_commands_generate_index_command.rb +7 -7
- data/test/rubygems/test_gem_commands_help_command.rb +13 -13
- data/test/rubygems/test_gem_commands_info_command.rb +28 -2
- data/test/rubygems/test_gem_commands_install_command.rb +131 -131
- data/test/rubygems/test_gem_commands_list_command.rb +4 -4
- data/test/rubygems/test_gem_commands_lock_command.rb +10 -10
- data/test/rubygems/test_gem_commands_mirror.rb +2 -2
- data/test/rubygems/test_gem_commands_open_command.rb +4 -4
- data/test/rubygems/test_gem_commands_outdated_command.rb +9 -9
- data/test/rubygems/test_gem_commands_owner_command.rb +41 -41
- data/test/rubygems/test_gem_commands_pristine_command.rb +92 -92
- data/test/rubygems/test_gem_commands_push_command.rb +54 -54
- data/test/rubygems/test_gem_commands_query_command.rb +73 -73
- data/test/rubygems/test_gem_commands_search_command.rb +2 -2
- data/test/rubygems/test_gem_commands_server_command.rb +2 -2
- data/test/rubygems/test_gem_commands_setup_command.rb +119 -85
- data/test/rubygems/test_gem_commands_signin_command.rb +45 -31
- data/test/rubygems/test_gem_commands_signout_command.rb +3 -3
- data/test/rubygems/test_gem_commands_sources_command.rb +28 -29
- data/test/rubygems/test_gem_commands_specification_command.rb +32 -32
- data/test/rubygems/test_gem_commands_stale_command.rb +4 -4
- data/test/rubygems/test_gem_commands_uninstall_command.rb +75 -75
- data/test/rubygems/test_gem_commands_unpack_command.rb +31 -31
- data/test/rubygems/test_gem_commands_update_command.rb +89 -89
- data/test/rubygems/test_gem_commands_which_command.rb +6 -6
- data/test/rubygems/test_gem_commands_yank_command.rb +40 -40
- data/test/rubygems/test_gem_config_file.rb +93 -81
- data/test/rubygems/test_gem_dependency.rb +73 -73
- data/test/rubygems/test_gem_dependency_installer.rb +165 -165
- data/test/rubygems/test_gem_dependency_list.rb +47 -47
- data/test/rubygems/test_gem_dependency_resolution_error.rb +4 -4
- data/test/rubygems/test_gem_doctor.rb +26 -26
- data/test/rubygems/test_gem_ext_builder.rb +59 -59
- data/test/rubygems/test_gem_ext_cargo_builder/custom_name/Cargo.lock +6 -6
- data/test/rubygems/test_gem_ext_cargo_builder/custom_name/Cargo.toml +1 -1
- data/test/rubygems/test_gem_ext_cargo_builder/custom_name/build.rb +8 -8
- data/test/rubygems/test_gem_ext_cargo_builder/custom_name/custom_name.gemspec +1 -1
- data/test/rubygems/test_gem_ext_cargo_builder/rust_ruby_example/Cargo.lock +6 -6
- data/test/rubygems/test_gem_ext_cargo_builder/rust_ruby_example/Cargo.toml +1 -1
- data/test/rubygems/test_gem_ext_cargo_builder/rust_ruby_example/build.rb +8 -8
- data/test/rubygems/test_gem_ext_cargo_builder.rb +26 -26
- data/test/rubygems/test_gem_ext_cargo_builder_link_flag_converter.rb +3 -3
- data/test/rubygems/test_gem_ext_cargo_builder_unit.rb +23 -23
- data/test/rubygems/test_gem_ext_cmake_builder.rb +15 -15
- data/test/rubygems/test_gem_ext_configure_builder.rb +13 -13
- data/test/rubygems/test_gem_ext_ext_conf_builder.rb +51 -52
- data/test/rubygems/test_gem_ext_rake_builder.rb +15 -15
- data/test/rubygems/test_gem_gem_runner.rb +7 -7
- data/test/rubygems/test_gem_gemcutter_utilities.rb +66 -66
- data/test/rubygems/test_gem_impossible_dependencies_error.rb +4 -4
- data/test/rubygems/test_gem_indexer.rb +48 -48
- data/test/rubygems/test_gem_install_update_options.rb +16 -16
- data/test/rubygems/test_gem_installer.rb +303 -300
- data/test/rubygems/test_gem_local_remote_options.rb +10 -10
- data/test/rubygems/test_gem_name_tuple.rb +4 -4
- data/test/rubygems/test_gem_package.rb +228 -206
- data/test/rubygems/test_gem_package_old.rb +13 -13
- data/test/rubygems/test_gem_package_tar_header.rb +42 -42
- data/test/rubygems/test_gem_package_tar_reader.rb +8 -8
- data/test/rubygems/test_gem_package_tar_reader_entry.rb +10 -10
- data/test/rubygems/test_gem_package_tar_writer.rb +76 -76
- data/test/rubygems/test_gem_package_task.rb +18 -18
- data/test/rubygems/test_gem_path_support.rb +14 -14
- data/test/rubygems/test_gem_platform.rb +298 -227
- data/test/rubygems/test_gem_rdoc.rb +14 -14
- data/test/rubygems/test_gem_remote_fetcher.rb +149 -149
- data/test/rubygems/test_gem_request.rb +55 -55
- data/test/rubygems/test_gem_request_connection_pools.rb +29 -29
- data/test/rubygems/test_gem_request_set.rb +99 -99
- data/test/rubygems/test_gem_request_set_gem_dependency_api.rb +204 -206
- data/test/rubygems/test_gem_request_set_lockfile.rb +86 -86
- data/test/rubygems/test_gem_request_set_lockfile_parser.rb +56 -56
- data/test/rubygems/test_gem_request_set_lockfile_tokenizer.rb +62 -62
- data/test/rubygems/test_gem_requirement.rb +47 -41
- data/test/rubygems/test_gem_resolver.rb +133 -99
- data/test/rubygems/test_gem_resolver_activation_request.rb +6 -6
- data/test/rubygems/test_gem_resolver_api_set.rb +33 -33
- data/test/rubygems/test_gem_resolver_api_specification.rb +47 -47
- data/test/rubygems/test_gem_resolver_best_set.rb +22 -22
- data/test/rubygems/test_gem_resolver_composed_set.rb +1 -1
- data/test/rubygems/test_gem_resolver_conflict.rb +12 -12
- data/test/rubygems/test_gem_resolver_dependency_request.rb +15 -15
- data/test/rubygems/test_gem_resolver_git_set.rb +21 -21
- data/test/rubygems/test_gem_resolver_git_specification.rb +21 -21
- data/test/rubygems/test_gem_resolver_index_set.rb +12 -12
- data/test/rubygems/test_gem_resolver_index_specification.rb +16 -16
- data/test/rubygems/test_gem_resolver_installed_specification.rb +5 -5
- data/test/rubygems/test_gem_resolver_installer_set.rb +78 -34
- data/test/rubygems/test_gem_resolver_local_specification.rb +7 -7
- data/test/rubygems/test_gem_resolver_lock_set.rb +12 -12
- data/test/rubygems/test_gem_resolver_lock_specification.rb +17 -17
- data/test/rubygems/test_gem_resolver_requirement_list.rb +1 -1
- data/test/rubygems/test_gem_resolver_specification.rb +8 -8
- data/test/rubygems/test_gem_resolver_vendor_set.rb +6 -6
- data/test/rubygems/test_gem_resolver_vendor_specification.rb +10 -10
- data/test/rubygems/test_gem_security.rb +67 -67
- data/test/rubygems/test_gem_security_policy.rb +62 -62
- data/test/rubygems/test_gem_security_signer.rb +28 -28
- data/test/rubygems/test_gem_security_trust_dir.rb +4 -4
- data/test/rubygems/test_gem_silent_ui.rb +38 -32
- data/test/rubygems/test_gem_source.rb +44 -44
- data/test/rubygems/test_gem_source_fetch_problem.rb +9 -9
- data/test/rubygems/test_gem_source_git.rb +59 -59
- data/test/rubygems/test_gem_source_installed.rb +16 -16
- data/test/rubygems/test_gem_source_list.rb +5 -5
- data/test/rubygems/test_gem_source_local.rb +14 -14
- data/test/rubygems/test_gem_source_lock.rb +31 -31
- data/test/rubygems/test_gem_source_specific_file.rb +17 -17
- data/test/rubygems/test_gem_source_subpath_problem.rb +7 -7
- data/test/rubygems/test_gem_source_vendor.rb +13 -13
- data/test/rubygems/test_gem_spec_fetcher.rb +72 -72
- data/test/rubygems/test_gem_specification.rb +444 -436
- data/test/rubygems/test_gem_stream_ui.rb +19 -19
- data/test/rubygems/test_gem_stub_specification.rb +32 -32
- data/test/rubygems/test_gem_text.rb +1 -1
- data/test/rubygems/test_gem_uninstaller.rb +112 -112
- data/test/rubygems/test_gem_unsatisfiable_dependency_error.rb +3 -3
- data/test/rubygems/test_gem_uri.rb +4 -4
- data/test/rubygems/test_gem_uri_formatter.rb +14 -14
- data/test/rubygems/test_gem_util.rb +23 -23
- data/test/rubygems/test_gem_validator.rb +8 -8
- data/test/rubygems/test_gem_version.rb +22 -15
- data/test/rubygems/test_gem_version_option.rb +15 -15
- data/test/rubygems/test_kernel.rb +31 -31
- data/test/rubygems/test_project_sanity.rb +1 -1
- data/test/rubygems/test_remote_fetch_error.rb +6 -6
- data/test/rubygems/test_require.rb +43 -43
- data/test/rubygems/test_rubygems.rb +8 -8
- data/test/rubygems/utilities.rb +19 -19
- metadata +14 -3
@@ -1,15 +1,15 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
|
-
require_relative
|
2
|
+
require_relative "helper"
|
3
3
|
|
4
|
-
require
|
5
|
-
require
|
4
|
+
require "webrick"
|
5
|
+
require "webrick/https" if Gem::HAVE_OPENSSL
|
6
6
|
|
7
7
|
unless Gem::HAVE_OPENSSL
|
8
|
-
warn
|
8
|
+
warn "Skipping Gem::RemoteFetcher tests. openssl not found."
|
9
9
|
end
|
10
10
|
|
11
|
-
require
|
12
|
-
require
|
11
|
+
require "rubygems/remote_fetcher"
|
12
|
+
require "rubygems/package"
|
13
13
|
|
14
14
|
# = Testing Proxy Settings
|
15
15
|
#
|
@@ -69,7 +69,7 @@ gems:
|
|
69
69
|
dependencies: []
|
70
70
|
EOY
|
71
71
|
|
72
|
-
PROXY_DATA = SERVER_DATA.gsub(/0.4.11/,
|
72
|
+
PROXY_DATA = SERVER_DATA.gsub(/0.4.11/, "0.4.2")
|
73
73
|
|
74
74
|
# Generated via:
|
75
75
|
# x = OpenSSL::PKey::DH.new(2048) # wait a while...
|
@@ -104,11 +104,11 @@ PeIQQkFng2VVot/WAQbv3ePqWq07g1BBcwIBAg==
|
|
104
104
|
@cache_dir = File.join @gemhome, "cache"
|
105
105
|
|
106
106
|
# TODO: why does the remote fetcher need it written to disk?
|
107
|
-
@a1, @a1_gem = util_gem
|
108
|
-
s.executables <<
|
107
|
+
@a1, @a1_gem = util_gem "a", "1" do |s|
|
108
|
+
s.executables << "a_bin"
|
109
109
|
end
|
110
110
|
|
111
|
-
@a1.loaded_from = File.join(@gemhome,
|
111
|
+
@a1.loaded_from = File.join(@gemhome, "specifications", @a1.full_name)
|
112
112
|
|
113
113
|
Gem::RemoteFetcher.fetcher = nil
|
114
114
|
@stub_ui = Gem::MockGemUi.new
|
@@ -130,7 +130,7 @@ PeIQQkFng2VVot/WAQbv3ePqWq07g1BBcwIBAg==
|
|
130
130
|
end
|
131
131
|
|
132
132
|
def test_self_fetcher_with_proxy
|
133
|
-
proxy_uri =
|
133
|
+
proxy_uri = "http://proxy.example.com"
|
134
134
|
Gem.configuration[:http_proxy] = proxy_uri
|
135
135
|
Gem::RemoteFetcher.fetcher = nil
|
136
136
|
|
@@ -149,34 +149,34 @@ PeIQQkFng2VVot/WAQbv3ePqWq07g1BBcwIBAg==
|
|
149
149
|
@fetcher.fetch_path("gems.example.com/yaml", nil, true)
|
150
150
|
end
|
151
151
|
|
152
|
-
assert_equal
|
152
|
+
assert_equal "uri scheme is invalid: nil", e.message
|
153
153
|
end
|
154
154
|
|
155
155
|
def test_no_proxy
|
156
156
|
use_ui @stub_ui do
|
157
157
|
assert_data_from_server @fetcher.fetch_path(@server_uri)
|
158
158
|
response = @fetcher.fetch_path(@server_uri, nil, true)
|
159
|
-
assert_equal SERVER_DATA.size, response[
|
159
|
+
assert_equal SERVER_DATA.size, response["content-length"].to_i
|
160
160
|
end
|
161
161
|
end
|
162
162
|
|
163
163
|
def test_cache_update_path
|
164
|
-
uri = URI
|
165
|
-
path = File.join @tempdir,
|
164
|
+
uri = URI "http://example/file"
|
165
|
+
path = File.join @tempdir, "file"
|
166
166
|
|
167
|
-
fetcher = util_fuck_with_fetcher
|
167
|
+
fetcher = util_fuck_with_fetcher "hello"
|
168
168
|
|
169
169
|
data = fetcher.cache_update_path uri, path
|
170
170
|
|
171
|
-
assert_equal
|
171
|
+
assert_equal "hello", data
|
172
172
|
|
173
|
-
assert_equal
|
173
|
+
assert_equal "hello", File.read(path)
|
174
174
|
end
|
175
175
|
|
176
176
|
def test_cache_update_path_with_utf8_internal_encoding
|
177
|
-
with_internal_encoding(
|
178
|
-
uri = URI
|
179
|
-
path = File.join @tempdir,
|
177
|
+
with_internal_encoding("UTF-8") do
|
178
|
+
uri = URI "http://example/file"
|
179
|
+
path = File.join @tempdir, "file"
|
180
180
|
data = String.new("\xC8").force_encoding(Encoding::BINARY)
|
181
181
|
|
182
182
|
fetcher = util_fuck_with_fetcher data
|
@@ -189,14 +189,14 @@ PeIQQkFng2VVot/WAQbv3ePqWq07g1BBcwIBAg==
|
|
189
189
|
end
|
190
190
|
|
191
191
|
def test_cache_update_path_no_update
|
192
|
-
uri = URI
|
193
|
-
path = File.join @tempdir,
|
192
|
+
uri = URI "http://example/file"
|
193
|
+
path = File.join @tempdir, "file"
|
194
194
|
|
195
|
-
fetcher = util_fuck_with_fetcher
|
195
|
+
fetcher = util_fuck_with_fetcher "hello"
|
196
196
|
|
197
197
|
data = fetcher.cache_update_path uri, path, false
|
198
198
|
|
199
|
-
assert_equal
|
199
|
+
assert_equal "hello", data
|
200
200
|
|
201
201
|
assert_path_not_exist path
|
202
202
|
end
|
@@ -219,7 +219,7 @@ PeIQQkFng2VVot/WAQbv3ePqWq07g1BBcwIBAg==
|
|
219
219
|
@test_data
|
220
220
|
end
|
221
221
|
|
222
|
-
raise Gem::RemoteFetcher::FetchError.new("haha!",
|
222
|
+
raise Gem::RemoteFetcher::FetchError.new("haha!", "")
|
223
223
|
end
|
224
224
|
end
|
225
225
|
|
@@ -228,14 +228,14 @@ PeIQQkFng2VVot/WAQbv3ePqWq07g1BBcwIBAg==
|
|
228
228
|
|
229
229
|
def test_download
|
230
230
|
a1_data = nil
|
231
|
-
File.open @a1_gem,
|
231
|
+
File.open @a1_gem, "rb" do |fp|
|
232
232
|
a1_data = fp.read
|
233
233
|
end
|
234
234
|
|
235
235
|
fetcher = util_fuck_with_fetcher a1_data
|
236
236
|
|
237
237
|
a1_cache_gem = @a1.cache_file
|
238
|
-
assert_equal a1_cache_gem, fetcher.download(@a1,
|
238
|
+
assert_equal a1_cache_gem, fetcher.download(@a1, "http://gems.example.com")
|
239
239
|
assert_equal("http://gems.example.com/gems/a-1.gem",
|
240
240
|
fetcher.instance_variable_get(:@test_arg).to_s)
|
241
241
|
assert File.exist?(a1_cache_gem)
|
@@ -243,14 +243,14 @@ PeIQQkFng2VVot/WAQbv3ePqWq07g1BBcwIBAg==
|
|
243
243
|
|
244
244
|
def test_download_with_auth
|
245
245
|
a1_data = nil
|
246
|
-
File.open @a1_gem,
|
246
|
+
File.open @a1_gem, "rb" do |fp|
|
247
247
|
a1_data = fp.read
|
248
248
|
end
|
249
249
|
|
250
250
|
fetcher = util_fuck_with_fetcher a1_data
|
251
251
|
|
252
252
|
a1_cache_gem = @a1.cache_file
|
253
|
-
assert_equal a1_cache_gem, fetcher.download(@a1,
|
253
|
+
assert_equal a1_cache_gem, fetcher.download(@a1, "http://user:password@gems.example.com")
|
254
254
|
assert_equal("http://user:password@gems.example.com/gems/a-1.gem",
|
255
255
|
fetcher.instance_variable_get(:@test_arg).to_s)
|
256
256
|
assert File.exist?(a1_cache_gem)
|
@@ -258,14 +258,14 @@ PeIQQkFng2VVot/WAQbv3ePqWq07g1BBcwIBAg==
|
|
258
258
|
|
259
259
|
def test_download_with_token
|
260
260
|
a1_data = nil
|
261
|
-
File.open @a1_gem,
|
261
|
+
File.open @a1_gem, "rb" do |fp|
|
262
262
|
a1_data = fp.read
|
263
263
|
end
|
264
264
|
|
265
265
|
fetcher = util_fuck_with_fetcher a1_data
|
266
266
|
|
267
267
|
a1_cache_gem = @a1.cache_file
|
268
|
-
assert_equal a1_cache_gem, fetcher.download(@a1,
|
268
|
+
assert_equal a1_cache_gem, fetcher.download(@a1, "http://token@gems.example.com")
|
269
269
|
assert_equal("http://token@gems.example.com/gems/a-1.gem",
|
270
270
|
fetcher.instance_variable_get(:@test_arg).to_s)
|
271
271
|
assert File.exist?(a1_cache_gem)
|
@@ -273,14 +273,14 @@ PeIQQkFng2VVot/WAQbv3ePqWq07g1BBcwIBAg==
|
|
273
273
|
|
274
274
|
def test_download_with_x_oauth_basic
|
275
275
|
a1_data = nil
|
276
|
-
File.open @a1_gem,
|
276
|
+
File.open @a1_gem, "rb" do |fp|
|
277
277
|
a1_data = fp.read
|
278
278
|
end
|
279
279
|
|
280
280
|
fetcher = util_fuck_with_fetcher a1_data
|
281
281
|
|
282
282
|
a1_cache_gem = @a1.cache_file
|
283
|
-
assert_equal a1_cache_gem, fetcher.download(@a1,
|
283
|
+
assert_equal a1_cache_gem, fetcher.download(@a1, "http://token:x-oauth-basic@gems.example.com")
|
284
284
|
assert_equal("http://token:x-oauth-basic@gems.example.com/gems/a-1.gem",
|
285
285
|
fetcher.instance_variable_get(:@test_arg).to_s)
|
286
286
|
assert File.exist?(a1_cache_gem)
|
@@ -288,14 +288,14 @@ PeIQQkFng2VVot/WAQbv3ePqWq07g1BBcwIBAg==
|
|
288
288
|
|
289
289
|
def test_download_with_encoded_auth
|
290
290
|
a1_data = nil
|
291
|
-
File.open @a1_gem,
|
291
|
+
File.open @a1_gem, "rb" do |fp|
|
292
292
|
a1_data = fp.read
|
293
293
|
end
|
294
294
|
|
295
295
|
fetcher = util_fuck_with_fetcher a1_data
|
296
296
|
|
297
297
|
a1_cache_gem = @a1.cache_file
|
298
|
-
assert_equal a1_cache_gem, fetcher.download(@a1,
|
298
|
+
assert_equal a1_cache_gem, fetcher.download(@a1, "http://user:%25pas%25sword@gems.example.com")
|
299
299
|
assert_equal("http://user:%25pas%25sword@gems.example.com/gems/a-1.gem",
|
300
300
|
fetcher.instance_variable_get(:@test_arg).to_s)
|
301
301
|
assert File.exist?(a1_cache_gem)
|
@@ -306,7 +306,7 @@ PeIQQkFng2VVot/WAQbv3ePqWq07g1BBcwIBAg==
|
|
306
306
|
|
307
307
|
inst = Gem::RemoteFetcher.fetcher
|
308
308
|
|
309
|
-
assert_equal @a1.cache_file, inst.download(@a1,
|
309
|
+
assert_equal @a1.cache_file, inst.download(@a1, "http://gems.example.com")
|
310
310
|
end
|
311
311
|
|
312
312
|
def test_download_local
|
@@ -322,7 +322,7 @@ PeIQQkFng2VVot/WAQbv3ePqWq07g1BBcwIBAg==
|
|
322
322
|
end
|
323
323
|
|
324
324
|
def test_download_local_space
|
325
|
-
space_path = File.join @tempdir,
|
325
|
+
space_path = File.join @tempdir, "space path"
|
326
326
|
FileUtils.mkdir space_path
|
327
327
|
FileUtils.mv @a1_gem, space_path
|
328
328
|
local_path = File.join space_path, @a1.file_name
|
@@ -336,17 +336,17 @@ PeIQQkFng2VVot/WAQbv3ePqWq07g1BBcwIBAg==
|
|
336
336
|
end
|
337
337
|
|
338
338
|
def test_download_install_dir
|
339
|
-
a1_data = File.open @a1_gem,
|
339
|
+
a1_data = File.open @a1_gem, "rb" do |fp|
|
340
340
|
fp.read
|
341
341
|
end
|
342
342
|
|
343
343
|
fetcher = util_fuck_with_fetcher a1_data
|
344
344
|
|
345
|
-
install_dir = File.join @tempdir,
|
345
|
+
install_dir = File.join @tempdir, "more_gems"
|
346
346
|
|
347
347
|
a1_cache_gem = File.join install_dir, "cache", @a1.file_name
|
348
348
|
FileUtils.mkdir_p(File.dirname(a1_cache_gem))
|
349
|
-
actual = fetcher.download(@a1,
|
349
|
+
actual = fetcher.download(@a1, "http://gems.example.com", install_dir)
|
350
350
|
|
351
351
|
assert_equal a1_cache_gem, actual
|
352
352
|
assert_equal("http://gems.example.com/gems/a-1.gem",
|
@@ -380,7 +380,7 @@ PeIQQkFng2VVot/WAQbv3ePqWq07g1BBcwIBAg==
|
|
380
380
|
FileUtils.chmod 0555, @gemhome
|
381
381
|
|
382
382
|
fetcher = util_fuck_with_fetcher File.read(@a1_gem)
|
383
|
-
fetcher.download(@a1,
|
383
|
+
fetcher.download(@a1, "http://gems.example.com")
|
384
384
|
a1_cache_gem = File.join Gem.user_dir, "cache", @a1.file_name
|
385
385
|
assert File.exist? a1_cache_gem
|
386
386
|
ensure
|
@@ -390,16 +390,16 @@ PeIQQkFng2VVot/WAQbv3ePqWq07g1BBcwIBAg==
|
|
390
390
|
end
|
391
391
|
|
392
392
|
def test_download_platform_legacy
|
393
|
-
original_platform =
|
393
|
+
original_platform = "old-platform"
|
394
394
|
|
395
|
-
e1, e1_gem = util_gem
|
395
|
+
e1, e1_gem = util_gem "e", "1" do |s|
|
396
396
|
s.platform = Gem::Platform::CURRENT
|
397
397
|
s.instance_variable_set :@original_platform, original_platform
|
398
398
|
end
|
399
|
-
e1.loaded_from = File.join(@gemhome,
|
399
|
+
e1.loaded_from = File.join(@gemhome, "specifications", e1.full_name)
|
400
400
|
|
401
401
|
e1_data = nil
|
402
|
-
File.open e1_gem,
|
402
|
+
File.open e1_gem, "rb" do |fp|
|
403
403
|
e1_data = fp.read
|
404
404
|
end
|
405
405
|
|
@@ -407,7 +407,7 @@ PeIQQkFng2VVot/WAQbv3ePqWq07g1BBcwIBAg==
|
|
407
407
|
|
408
408
|
e1_cache_gem = e1.cache_file
|
409
409
|
|
410
|
-
assert_equal e1_cache_gem, fetcher.download(e1,
|
410
|
+
assert_equal e1_cache_gem, fetcher.download(e1, "http://gems.example.com")
|
411
411
|
|
412
412
|
assert_equal("http://gems.example.com/gems/#{e1.original_name}.gem",
|
413
413
|
fetcher.instance_variable_get(:@test_arg).to_s)
|
@@ -435,14 +435,14 @@ PeIQQkFng2VVot/WAQbv3ePqWq07g1BBcwIBAg==
|
|
435
435
|
inst = Gem::RemoteFetcher.fetcher
|
436
436
|
|
437
437
|
e = assert_raise ArgumentError do
|
438
|
-
inst.download @a1,
|
438
|
+
inst.download @a1, "ftp://gems.rubyforge.org"
|
439
439
|
end
|
440
440
|
|
441
|
-
assert_equal
|
441
|
+
assert_equal "unsupported URI scheme ftp", e.message
|
442
442
|
end
|
443
443
|
|
444
444
|
def test_download_to_cache
|
445
|
-
@a2, @a2_gem = util_gem
|
445
|
+
@a2, @a2_gem = util_gem "a", "2"
|
446
446
|
|
447
447
|
util_setup_spec_fetcher @a1, @a2
|
448
448
|
@fetcher.instance_variable_set :@a1, @a1
|
@@ -458,7 +458,7 @@ PeIQQkFng2VVot/WAQbv3ePqWq07g1BBcwIBAg==
|
|
458
458
|
end
|
459
459
|
end
|
460
460
|
|
461
|
-
gem = Gem::RemoteFetcher.fetcher.download_to_cache dep
|
461
|
+
gem = Gem::RemoteFetcher.fetcher.download_to_cache dep "a"
|
462
462
|
|
463
463
|
assert_equal @a2.file_name, File.basename(gem)
|
464
464
|
end
|
@@ -468,10 +468,10 @@ PeIQQkFng2VVot/WAQbv3ePqWq07g1BBcwIBAg==
|
|
468
468
|
@fetcher = fetcher
|
469
469
|
|
470
470
|
def fetcher.fetch_http(uri, mtime, head = nil)
|
471
|
-
Gem::Util.gzip
|
471
|
+
Gem::Util.gzip "foo"
|
472
472
|
end
|
473
473
|
|
474
|
-
assert_equal
|
474
|
+
assert_equal "foo", fetcher.fetch_path(@uri + "foo.gz")
|
475
475
|
end
|
476
476
|
|
477
477
|
def test_fetch_path_gzip_unmodified
|
@@ -482,7 +482,7 @@ PeIQQkFng2VVot/WAQbv3ePqWq07g1BBcwIBAg==
|
|
482
482
|
nil
|
483
483
|
end
|
484
484
|
|
485
|
-
assert_nil fetcher.fetch_path(@uri +
|
485
|
+
assert_nil fetcher.fetch_path(@uri + "foo.gz", Time.at(0))
|
486
486
|
end
|
487
487
|
|
488
488
|
def test_fetch_path_io_error
|
@@ -493,7 +493,7 @@ PeIQQkFng2VVot/WAQbv3ePqWq07g1BBcwIBAg==
|
|
493
493
|
raise EOFError
|
494
494
|
end
|
495
495
|
|
496
|
-
url =
|
496
|
+
url = "http://example.com/uri"
|
497
497
|
|
498
498
|
e = assert_raise Gem::RemoteFetcher::FetchError do
|
499
499
|
fetcher.fetch_path url
|
@@ -511,7 +511,7 @@ PeIQQkFng2VVot/WAQbv3ePqWq07g1BBcwIBAg==
|
|
511
511
|
raise SocketError
|
512
512
|
end
|
513
513
|
|
514
|
-
url =
|
514
|
+
url = "http://example.com/uri"
|
515
515
|
|
516
516
|
e = assert_raise Gem::RemoteFetcher::FetchError do
|
517
517
|
fetcher.fetch_path url
|
@@ -526,10 +526,10 @@ PeIQQkFng2VVot/WAQbv3ePqWq07g1BBcwIBAg==
|
|
526
526
|
@fetcher = fetcher
|
527
527
|
|
528
528
|
def fetcher.fetch_http(uri, mtime = nil, head = nil)
|
529
|
-
raise Errno::ECONNREFUSED,
|
529
|
+
raise Errno::ECONNREFUSED, "connect(2)"
|
530
530
|
end
|
531
531
|
|
532
|
-
url =
|
532
|
+
url = "http://example.com/uri"
|
533
533
|
|
534
534
|
e = assert_raise Gem::RemoteFetcher::FetchError do
|
535
535
|
fetcher.fetch_path url
|
@@ -545,10 +545,10 @@ PeIQQkFng2VVot/WAQbv3ePqWq07g1BBcwIBAg==
|
|
545
545
|
@fetcher = fetcher
|
546
546
|
|
547
547
|
def fetcher.fetch_http(uri, mtime = nil, head = nil)
|
548
|
-
raise Timeout::Error,
|
548
|
+
raise Timeout::Error, "timed out"
|
549
549
|
end
|
550
550
|
|
551
|
-
url =
|
551
|
+
url = "http://example.com/uri"
|
552
552
|
|
553
553
|
e = assert_raise Gem::RemoteFetcher::FetchError do
|
554
554
|
fetcher.fetch_path url
|
@@ -564,10 +564,10 @@ PeIQQkFng2VVot/WAQbv3ePqWq07g1BBcwIBAg==
|
|
564
564
|
@fetcher = fetcher
|
565
565
|
|
566
566
|
def fetcher.fetch_http(uri, mtime = nil, head = nil)
|
567
|
-
raise SocketError,
|
567
|
+
raise SocketError, "getaddrinfo: nodename nor servname provided"
|
568
568
|
end
|
569
569
|
|
570
|
-
url =
|
570
|
+
url = "http://example.com/uri"
|
571
571
|
|
572
572
|
e = assert_raise Gem::RemoteFetcher::FetchError do
|
573
573
|
fetcher.fetch_path url
|
@@ -586,7 +586,7 @@ PeIQQkFng2VVot/WAQbv3ePqWq07g1BBcwIBAg==
|
|
586
586
|
raise OpenSSL::SSL::SSLError
|
587
587
|
end
|
588
588
|
|
589
|
-
url =
|
589
|
+
url = "http://example.com/uri"
|
590
590
|
|
591
591
|
e = assert_raise Gem::RemoteFetcher::FetchError do
|
592
592
|
fetcher.fetch_path url
|
@@ -609,7 +609,7 @@ PeIQQkFng2VVot/WAQbv3ePqWq07g1BBcwIBAg==
|
|
609
609
|
|
610
610
|
def test_implicit_no_proxy
|
611
611
|
use_ui @stub_ui do
|
612
|
-
ENV[
|
612
|
+
ENV["http_proxy"] = "http://fakeurl:12345"
|
613
613
|
fetcher = Gem::RemoteFetcher.new :no_proxy
|
614
614
|
@fetcher = fetcher
|
615
615
|
assert_data_from_server fetcher.fetch_path(@server_uri)
|
@@ -618,7 +618,7 @@ PeIQQkFng2VVot/WAQbv3ePqWq07g1BBcwIBAg==
|
|
618
618
|
|
619
619
|
def test_implicit_proxy
|
620
620
|
use_ui @stub_ui do
|
621
|
-
ENV[
|
621
|
+
ENV["http_proxy"] = @proxy_uri
|
622
622
|
fetcher = Gem::RemoteFetcher.new nil
|
623
623
|
@fetcher = fetcher
|
624
624
|
assert_data_from_proxy fetcher.fetch_path(@server_uri)
|
@@ -627,7 +627,7 @@ PeIQQkFng2VVot/WAQbv3ePqWq07g1BBcwIBAg==
|
|
627
627
|
|
628
628
|
def test_implicit_upper_case_proxy
|
629
629
|
use_ui @stub_ui do
|
630
|
-
ENV[
|
630
|
+
ENV["HTTP_PROXY"] = @proxy_uri
|
631
631
|
fetcher = Gem::RemoteFetcher.new nil
|
632
632
|
@fetcher = fetcher
|
633
633
|
assert_data_from_proxy fetcher.fetch_path(@server_uri)
|
@@ -645,36 +645,36 @@ PeIQQkFng2VVot/WAQbv3ePqWq07g1BBcwIBAg==
|
|
645
645
|
def test_fetch_http
|
646
646
|
fetcher = Gem::RemoteFetcher.new nil
|
647
647
|
@fetcher = fetcher
|
648
|
-
url =
|
648
|
+
url = "http://gems.example.com/redirect"
|
649
649
|
|
650
650
|
def fetcher.request(uri, request_class, last_modified = nil)
|
651
|
-
url =
|
651
|
+
url = "http://gems.example.com/redirect"
|
652
652
|
unless defined? @requested
|
653
653
|
@requested = true
|
654
654
|
res = Net::HTTPMovedPermanently.new nil, 301, nil
|
655
|
-
res.add_field
|
655
|
+
res.add_field "Location", url
|
656
656
|
res
|
657
657
|
else
|
658
658
|
res = Net::HTTPOK.new nil, 200, nil
|
659
|
-
def res.body()
|
659
|
+
def res.body() "real_path" end
|
660
660
|
res
|
661
661
|
end
|
662
662
|
end
|
663
663
|
|
664
664
|
data = fetcher.fetch_http URI.parse(url)
|
665
665
|
|
666
|
-
assert_equal
|
666
|
+
assert_equal "real_path", data
|
667
667
|
end
|
668
668
|
|
669
669
|
def test_fetch_http_redirects
|
670
670
|
fetcher = Gem::RemoteFetcher.new nil
|
671
671
|
@fetcher = fetcher
|
672
|
-
url =
|
672
|
+
url = "http://gems.example.com/redirect"
|
673
673
|
|
674
674
|
def fetcher.request(uri, request_class, last_modified = nil)
|
675
|
-
url =
|
675
|
+
url = "http://gems.example.com/redirect"
|
676
676
|
res = Net::HTTPMovedPermanently.new nil, 301, nil
|
677
|
-
res.add_field
|
677
|
+
res.add_field "Location", url
|
678
678
|
res
|
679
679
|
end
|
680
680
|
|
@@ -688,7 +688,7 @@ PeIQQkFng2VVot/WAQbv3ePqWq07g1BBcwIBAg==
|
|
688
688
|
def test_fetch_http_redirects_without_location
|
689
689
|
fetcher = Gem::RemoteFetcher.new nil
|
690
690
|
@fetcher = fetcher
|
691
|
-
url =
|
691
|
+
url = "http://gems.example.com/redirect"
|
692
692
|
|
693
693
|
def fetcher.request(uri, request_class, last_modified = nil)
|
694
694
|
res = Net::HTTPMovedPermanently.new nil, 301, nil
|
@@ -710,7 +710,7 @@ PeIQQkFng2VVot/WAQbv3ePqWq07g1BBcwIBAg==
|
|
710
710
|
assert_equal "murphy", fetcher.fetch_path(@server_uri)
|
711
711
|
end
|
712
712
|
|
713
|
-
def assert_fetch_s3(url, signature, token=nil, region=
|
713
|
+
def assert_fetch_s3(url, signature, token=nil, region="us-east-1", instance_profile_json=nil)
|
714
714
|
fetcher = Gem::RemoteFetcher.new nil
|
715
715
|
@fetcher = fetcher
|
716
716
|
$fetched_uri = nil
|
@@ -719,12 +719,12 @@ PeIQQkFng2VVot/WAQbv3ePqWq07g1BBcwIBAg==
|
|
719
719
|
def fetcher.request(uri, request_class, last_modified = nil)
|
720
720
|
$fetched_uri = uri
|
721
721
|
res = Net::HTTPOK.new nil, 200, nil
|
722
|
-
def res.body()
|
722
|
+
def res.body() "success" end
|
723
723
|
res
|
724
724
|
end
|
725
725
|
|
726
726
|
def fetcher.s3_uri_signer(uri)
|
727
|
-
require
|
727
|
+
require "json"
|
728
728
|
s3_uri_signer = Gem::S3URISigner.new(uri)
|
729
729
|
def s3_uri_signer.ec2_metadata_credentials_json
|
730
730
|
JSON.parse($instance_profile)
|
@@ -738,18 +738,18 @@ PeIQQkFng2VVot/WAQbv3ePqWq07g1BBcwIBAg==
|
|
738
738
|
data = fetcher.fetch_s3 URI.parse(url)
|
739
739
|
|
740
740
|
assert_equal "https://my-bucket.s3.#{region}.amazonaws.com/gems/specs.4.8.gz?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=testuser%2F20190624%2F#{region}%2Fs3%2Faws4_request&X-Amz-Date=20190624T050641Z&X-Amz-Expires=86400#{token ? "&X-Amz-Security-Token=" + token : ""}&X-Amz-SignedHeaders=host&X-Amz-Signature=#{signature}", $fetched_uri.to_s
|
741
|
-
assert_equal
|
741
|
+
assert_equal "success", data
|
742
742
|
ensure
|
743
743
|
$fetched_uri = nil
|
744
744
|
end
|
745
745
|
|
746
746
|
def test_fetch_s3_config_creds
|
747
747
|
Gem.configuration[:s3_source] = {
|
748
|
-
|
748
|
+
"my-bucket" => { :id => "testuser", :secret => "testpass" },
|
749
749
|
}
|
750
|
-
url =
|
750
|
+
url = "s3://my-bucket/gems/specs.4.8.gz"
|
751
751
|
Time.stub :now, Time.at(1561353581) do
|
752
|
-
assert_fetch_s3 url,
|
752
|
+
assert_fetch_s3 url, "20f974027db2f3cd6193565327a7c73457a138efb1a63ea248d185ce6827d41b"
|
753
753
|
end
|
754
754
|
ensure
|
755
755
|
Gem.configuration[:s3_source] = nil
|
@@ -757,11 +757,11 @@ PeIQQkFng2VVot/WAQbv3ePqWq07g1BBcwIBAg==
|
|
757
757
|
|
758
758
|
def test_fetch_s3_config_creds_with_region
|
759
759
|
Gem.configuration[:s3_source] = {
|
760
|
-
|
760
|
+
"my-bucket" => { :id => "testuser", :secret => "testpass", :region => "us-west-2" },
|
761
761
|
}
|
762
|
-
url =
|
762
|
+
url = "s3://my-bucket/gems/specs.4.8.gz"
|
763
763
|
Time.stub :now, Time.at(1561353581) do
|
764
|
-
assert_fetch_s3 url,
|
764
|
+
assert_fetch_s3 url, "4afc3010757f1fd143e769f1d1dabd406476a4fc7c120e9884fd02acbb8f26c9", nil, "us-west-2"
|
765
765
|
end
|
766
766
|
ensure
|
767
767
|
Gem.configuration[:s3_source] = nil
|
@@ -769,79 +769,79 @@ PeIQQkFng2VVot/WAQbv3ePqWq07g1BBcwIBAg==
|
|
769
769
|
|
770
770
|
def test_fetch_s3_config_creds_with_token
|
771
771
|
Gem.configuration[:s3_source] = {
|
772
|
-
|
772
|
+
"my-bucket" => { :id => "testuser", :secret => "testpass", :security_token => "testtoken" },
|
773
773
|
}
|
774
|
-
url =
|
774
|
+
url = "s3://my-bucket/gems/specs.4.8.gz"
|
775
775
|
Time.stub :now, Time.at(1561353581) do
|
776
|
-
assert_fetch_s3 url,
|
776
|
+
assert_fetch_s3 url, "935160a427ef97e7630f799232b8f208c4a4e49aad07d0540572a2ad5fe9f93c", "testtoken"
|
777
777
|
end
|
778
778
|
ensure
|
779
779
|
Gem.configuration[:s3_source] = nil
|
780
780
|
end
|
781
781
|
|
782
782
|
def test_fetch_s3_env_creds
|
783
|
-
ENV[
|
784
|
-
ENV[
|
785
|
-
ENV[
|
783
|
+
ENV["AWS_ACCESS_KEY_ID"] = "testuser"
|
784
|
+
ENV["AWS_SECRET_ACCESS_KEY"] = "testpass"
|
785
|
+
ENV["AWS_SESSION_TOKEN"] = nil
|
786
786
|
Gem.configuration[:s3_source] = {
|
787
|
-
|
787
|
+
"my-bucket" => { :provider => "env" },
|
788
788
|
}
|
789
|
-
url =
|
789
|
+
url = "s3://my-bucket/gems/specs.4.8.gz"
|
790
790
|
Time.stub :now, Time.at(1561353581) do
|
791
|
-
assert_fetch_s3 url,
|
791
|
+
assert_fetch_s3 url, "20f974027db2f3cd6193565327a7c73457a138efb1a63ea248d185ce6827d41b"
|
792
792
|
end
|
793
793
|
ensure
|
794
|
-
ENV.each_key {|key| ENV.delete(key) if key.start_with?(
|
794
|
+
ENV.each_key {|key| ENV.delete(key) if key.start_with?("AWS") }
|
795
795
|
Gem.configuration[:s3_source] = nil
|
796
796
|
end
|
797
797
|
|
798
798
|
def test_fetch_s3_env_creds_with_region
|
799
|
-
ENV[
|
800
|
-
ENV[
|
801
|
-
ENV[
|
799
|
+
ENV["AWS_ACCESS_KEY_ID"] = "testuser"
|
800
|
+
ENV["AWS_SECRET_ACCESS_KEY"] = "testpass"
|
801
|
+
ENV["AWS_SESSION_TOKEN"] = nil
|
802
802
|
Gem.configuration[:s3_source] = {
|
803
|
-
|
803
|
+
"my-bucket" => { :provider => "env", :region => "us-west-2" },
|
804
804
|
}
|
805
|
-
url =
|
805
|
+
url = "s3://my-bucket/gems/specs.4.8.gz"
|
806
806
|
Time.stub :now, Time.at(1561353581) do
|
807
|
-
assert_fetch_s3 url,
|
807
|
+
assert_fetch_s3 url, "4afc3010757f1fd143e769f1d1dabd406476a4fc7c120e9884fd02acbb8f26c9", nil, "us-west-2"
|
808
808
|
end
|
809
809
|
ensure
|
810
|
-
ENV.each_key {|key| ENV.delete(key) if key.start_with?(
|
810
|
+
ENV.each_key {|key| ENV.delete(key) if key.start_with?("AWS") }
|
811
811
|
Gem.configuration[:s3_source] = nil
|
812
812
|
end
|
813
813
|
|
814
814
|
def test_fetch_s3_env_creds_with_token
|
815
|
-
ENV[
|
816
|
-
ENV[
|
817
|
-
ENV[
|
815
|
+
ENV["AWS_ACCESS_KEY_ID"] = "testuser"
|
816
|
+
ENV["AWS_SECRET_ACCESS_KEY"] = "testpass"
|
817
|
+
ENV["AWS_SESSION_TOKEN"] = "testtoken"
|
818
818
|
Gem.configuration[:s3_source] = {
|
819
|
-
|
819
|
+
"my-bucket" => { :provider => "env" },
|
820
820
|
}
|
821
|
-
url =
|
821
|
+
url = "s3://my-bucket/gems/specs.4.8.gz"
|
822
822
|
Time.stub :now, Time.at(1561353581) do
|
823
|
-
assert_fetch_s3 url,
|
823
|
+
assert_fetch_s3 url, "935160a427ef97e7630f799232b8f208c4a4e49aad07d0540572a2ad5fe9f93c", "testtoken"
|
824
824
|
end
|
825
825
|
ensure
|
826
|
-
ENV.each_key {|key| ENV.delete(key) if key.start_with?(
|
826
|
+
ENV.each_key {|key| ENV.delete(key) if key.start_with?("AWS") }
|
827
827
|
Gem.configuration[:s3_source] = nil
|
828
828
|
end
|
829
829
|
|
830
830
|
def test_fetch_s3_url_creds
|
831
|
-
url =
|
831
|
+
url = "s3://testuser:testpass@my-bucket/gems/specs.4.8.gz"
|
832
832
|
Time.stub :now, Time.at(1561353581) do
|
833
|
-
assert_fetch_s3 url,
|
833
|
+
assert_fetch_s3 url, "20f974027db2f3cd6193565327a7c73457a138efb1a63ea248d185ce6827d41b"
|
834
834
|
end
|
835
835
|
end
|
836
836
|
|
837
837
|
def test_fetch_s3_instance_profile_creds
|
838
838
|
Gem.configuration[:s3_source] = {
|
839
|
-
|
839
|
+
"my-bucket" => { :provider => "instance_profile" },
|
840
840
|
}
|
841
841
|
|
842
|
-
url =
|
842
|
+
url = "s3://my-bucket/gems/specs.4.8.gz"
|
843
843
|
Time.stub :now, Time.at(1561353581) do
|
844
|
-
assert_fetch_s3 url,
|
844
|
+
assert_fetch_s3 url, "20f974027db2f3cd6193565327a7c73457a138efb1a63ea248d185ce6827d41b", nil, "us-east-1",
|
845
845
|
'{"AccessKeyId": "testuser", "SecretAccessKey": "testpass"}'
|
846
846
|
end
|
847
847
|
ensure
|
@@ -850,12 +850,12 @@ PeIQQkFng2VVot/WAQbv3ePqWq07g1BBcwIBAg==
|
|
850
850
|
|
851
851
|
def test_fetch_s3_instance_profile_creds_with_region
|
852
852
|
Gem.configuration[:s3_source] = {
|
853
|
-
|
853
|
+
"my-bucket" => { :provider => "instance_profile", :region => "us-west-2" },
|
854
854
|
}
|
855
855
|
|
856
|
-
url =
|
856
|
+
url = "s3://my-bucket/gems/specs.4.8.gz"
|
857
857
|
Time.stub :now, Time.at(1561353581) do
|
858
|
-
assert_fetch_s3 url,
|
858
|
+
assert_fetch_s3 url, "4afc3010757f1fd143e769f1d1dabd406476a4fc7c120e9884fd02acbb8f26c9", nil, "us-west-2",
|
859
859
|
'{"AccessKeyId": "testuser", "SecretAccessKey": "testpass"}'
|
860
860
|
end
|
861
861
|
ensure
|
@@ -864,12 +864,12 @@ PeIQQkFng2VVot/WAQbv3ePqWq07g1BBcwIBAg==
|
|
864
864
|
|
865
865
|
def test_fetch_s3_instance_profile_creds_with_token
|
866
866
|
Gem.configuration[:s3_source] = {
|
867
|
-
|
867
|
+
"my-bucket" => { :provider => "instance_profile" },
|
868
868
|
}
|
869
869
|
|
870
|
-
url =
|
870
|
+
url = "s3://my-bucket/gems/specs.4.8.gz"
|
871
871
|
Time.stub :now, Time.at(1561353581) do
|
872
|
-
assert_fetch_s3 url,
|
872
|
+
assert_fetch_s3 url, "935160a427ef97e7630f799232b8f208c4a4e49aad07d0540572a2ad5fe9f93c", "testtoken", "us-east-1",
|
873
873
|
'{"AccessKeyId": "testuser", "SecretAccessKey": "testpass", "Token": "testtoken"}'
|
874
874
|
end
|
875
875
|
ensure
|
@@ -888,35 +888,35 @@ PeIQQkFng2VVot/WAQbv3ePqWq07g1BBcwIBAg==
|
|
888
888
|
end
|
889
889
|
|
890
890
|
def test_fetch_s3_no_source_key
|
891
|
-
url =
|
892
|
-
refute_fetch_s3 url,
|
891
|
+
url = "s3://my-bucket/gems/specs.4.8.gz"
|
892
|
+
refute_fetch_s3 url, "no s3_source key exists in .gemrc"
|
893
893
|
end
|
894
894
|
|
895
895
|
def test_fetch_s3_no_host
|
896
896
|
Gem.configuration[:s3_source] = {
|
897
|
-
|
897
|
+
"my-bucket" => { :id => "testuser", :secret => "testpass" },
|
898
898
|
}
|
899
899
|
|
900
|
-
url =
|
901
|
-
refute_fetch_s3 url,
|
900
|
+
url = "s3://other-bucket/gems/specs.4.8.gz"
|
901
|
+
refute_fetch_s3 url, "no key for host other-bucket in s3_source in .gemrc"
|
902
902
|
ensure
|
903
903
|
Gem.configuration[:s3_source] = nil
|
904
904
|
end
|
905
905
|
|
906
906
|
def test_fetch_s3_no_id
|
907
|
-
Gem.configuration[:s3_source] = {
|
907
|
+
Gem.configuration[:s3_source] = { "my-bucket" => { :secret => "testpass" } }
|
908
908
|
|
909
|
-
url =
|
910
|
-
refute_fetch_s3 url,
|
909
|
+
url = "s3://my-bucket/gems/specs.4.8.gz"
|
910
|
+
refute_fetch_s3 url, "s3_source for my-bucket missing id or secret"
|
911
911
|
ensure
|
912
912
|
Gem.configuration[:s3_source] = nil
|
913
913
|
end
|
914
914
|
|
915
915
|
def test_fetch_s3_no_secret
|
916
|
-
Gem.configuration[:s3_source] = {
|
916
|
+
Gem.configuration[:s3_source] = { "my-bucket" => { :id => "testuser" } }
|
917
917
|
|
918
|
-
url =
|
919
|
-
refute_fetch_s3 url,
|
918
|
+
url = "s3://my-bucket/gems/specs.4.8.gz"
|
919
|
+
refute_fetch_s3 url, "s3_source for my-bucket missing id or secret"
|
920
920
|
ensure
|
921
921
|
Gem.configuration[:s3_source] = nil
|
922
922
|
end
|
@@ -946,7 +946,7 @@ PeIQQkFng2VVot/WAQbv3ePqWq07g1BBcwIBAg==
|
|
946
946
|
@fetcher = fetcher
|
947
947
|
|
948
948
|
assert_throws :block_called do
|
949
|
-
fetcher.request URI(
|
949
|
+
fetcher.request URI("http://example"), Net::HTTP::Get do |req|
|
950
950
|
assert_kind_of Net::HTTPGenericRequest, req
|
951
951
|
throw :block_called
|
952
952
|
end
|
@@ -964,7 +964,7 @@ PeIQQkFng2VVot/WAQbv3ePqWq07g1BBcwIBAg==
|
|
964
964
|
|
965
965
|
def test_ssl_connection
|
966
966
|
ssl_server = start_ssl_server
|
967
|
-
temp_ca_cert = File.join(__dir__,
|
967
|
+
temp_ca_cert = File.join(__dir__, "ca_cert.pem")
|
968
968
|
with_configured_fetcher(":ssl_ca_cert: #{temp_ca_cert}") do |fetcher|
|
969
969
|
fetcher.fetch_path("https://localhost:#{ssl_server.config[:Port]}/yaml")
|
970
970
|
end
|
@@ -975,8 +975,8 @@ PeIQQkFng2VVot/WAQbv3ePqWq07g1BBcwIBAg==
|
|
975
975
|
:SSLVerifyClient =>
|
976
976
|
OpenSSL::SSL::VERIFY_PEER | OpenSSL::SSL::VERIFY_FAIL_IF_NO_PEER_CERT })
|
977
977
|
|
978
|
-
temp_ca_cert = File.join(__dir__,
|
979
|
-
temp_client_cert = File.join(__dir__,
|
978
|
+
temp_ca_cert = File.join(__dir__, "ca_cert.pem")
|
979
|
+
temp_client_cert = File.join(__dir__, "client.pem")
|
980
980
|
|
981
981
|
with_configured_fetcher(
|
982
982
|
":ssl_ca_cert: #{temp_ca_cert}\n" +
|
@@ -990,8 +990,8 @@ PeIQQkFng2VVot/WAQbv3ePqWq07g1BBcwIBAg==
|
|
990
990
|
:SSLVerifyClient =>
|
991
991
|
OpenSSL::SSL::VERIFY_PEER | OpenSSL::SSL::VERIFY_FAIL_IF_NO_PEER_CERT })
|
992
992
|
|
993
|
-
temp_ca_cert = File.join(__dir__,
|
994
|
-
temp_client_cert = File.join(__dir__,
|
993
|
+
temp_ca_cert = File.join(__dir__, "ca_cert.pem")
|
994
|
+
temp_client_cert = File.join(__dir__, "invalid_client.pem")
|
995
995
|
|
996
996
|
with_configured_fetcher(
|
997
997
|
":ssl_ca_cert: #{temp_ca_cert}\n" +
|
@@ -1020,7 +1020,7 @@ PeIQQkFng2VVot/WAQbv3ePqWq07g1BBcwIBAg==
|
|
1020
1020
|
|
1021
1021
|
def test_do_not_follow_insecure_redirect
|
1022
1022
|
ssl_server = start_ssl_server
|
1023
|
-
temp_ca_cert = File.join(__dir__,
|
1023
|
+
temp_ca_cert = File.join(__dir__, "ca_cert.pem")
|
1024
1024
|
expected_error_message =
|
1025
1025
|
"redirecting to non-https resource: #{@server_uri} (https://localhost:#{ssl_server.config[:Port]}/insecure_redirect?to=#{@server_uri})"
|
1026
1026
|
|
@@ -1046,8 +1046,8 @@ PeIQQkFng2VVot/WAQbv3ePqWq07g1BBcwIBAg==
|
|
1046
1046
|
|
1047
1047
|
def with_configured_fetcher(config_str = nil, &block)
|
1048
1048
|
if config_str
|
1049
|
-
temp_conf = File.join @tempdir,
|
1050
|
-
File.open temp_conf,
|
1049
|
+
temp_conf = File.join @tempdir, ".gemrc"
|
1050
|
+
File.open temp_conf, "w" do |fp|
|
1051
1051
|
fp.puts config_str
|
1052
1052
|
end
|
1053
1053
|
Gem.configuration = Gem::ConfigFile.new %W[--config-file #{temp_conf}]
|
@@ -1136,9 +1136,9 @@ PeIQQkFng2VVot/WAQbv3ePqWq07g1BBcwIBAg==
|
|
1136
1136
|
:Logger => null_logger,
|
1137
1137
|
:AccessLog => [],
|
1138
1138
|
:SSLEnable => true,
|
1139
|
-
:SSLCACertificateFile => File.join(__dir__,
|
1140
|
-
:SSLCertificate => cert(
|
1141
|
-
:SSLPrivateKey => key(
|
1139
|
+
:SSLCACertificateFile => File.join(__dir__, "ca_cert.pem"),
|
1140
|
+
:SSLCertificate => cert("ssl_cert.pem"),
|
1141
|
+
:SSLPrivateKey => key("ssl_key.pem"),
|
1142
1142
|
:SSLVerifyClient => nil,
|
1143
1143
|
:SSLCertName => nil,
|
1144
1144
|
}.merge(config))
|
@@ -1146,7 +1146,7 @@ PeIQQkFng2VVot/WAQbv3ePqWq07g1BBcwIBAg==
|
|
1146
1146
|
res.body = "--- true\n"
|
1147
1147
|
end
|
1148
1148
|
server.mount_proc("/insecure_redirect") do |req, res|
|
1149
|
-
res.set_redirect(WEBrick::HTTPStatus::MovedPermanently, req.query[
|
1149
|
+
res.set_redirect(WEBrick::HTTPStatus::MovedPermanently, req.query["to"])
|
1150
1150
|
end
|
1151
1151
|
server.ssl_context.tmp_dh_callback = proc { TEST_KEY_DH2048 }
|
1152
1152
|
t = Thread.new do
|
@@ -1185,22 +1185,22 @@ PeIQQkFng2VVot/WAQbv3ePqWq07g1BBcwIBAg==
|
|
1185
1185
|
res.body = req["X-Captain"]
|
1186
1186
|
elsif @enable_yaml
|
1187
1187
|
res.body = data
|
1188
|
-
res[
|
1189
|
-
res[
|
1188
|
+
res["Content-Type"] = "text/plain"
|
1189
|
+
res["content-length"] = data.size
|
1190
1190
|
else
|
1191
1191
|
res.status = "404"
|
1192
1192
|
res.body = "<h1>NOT FOUND</h1>"
|
1193
|
-
res[
|
1193
|
+
res["Content-Type"] = "text/html"
|
1194
1194
|
end
|
1195
1195
|
end
|
1196
1196
|
s.mount_proc("/yaml.Z") do |req, res|
|
1197
1197
|
if @enable_zip
|
1198
1198
|
res.body = Zlib::Deflate.deflate(data)
|
1199
|
-
res[
|
1199
|
+
res["Content-Type"] = "text/plain"
|
1200
1200
|
else
|
1201
1201
|
res.status = "404"
|
1202
1202
|
res.body = "<h1>NOT FOUND</h1>"
|
1203
|
-
res[
|
1203
|
+
res["Content-Type"] = "text/html"
|
1204
1204
|
end
|
1205
1205
|
end
|
1206
1206
|
th = Thread.new do
|