bundler 2.2.29 → 2.5.16
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 +1129 -4
- data/README.md +4 -8
- data/bundler.gemspec +11 -11
- data/exe/bundle +5 -26
- data/exe/bundler +1 -1
- data/lib/bundler/.document +1 -0
- data/lib/bundler/build_metadata.rb +4 -4
- data/lib/bundler/capistrano.rb +1 -1
- data/lib/bundler/checksum.rb +254 -0
- data/lib/bundler/ci_detector.rb +75 -0
- data/lib/bundler/cli/add.rb +4 -4
- data/lib/bundler/cli/binstubs.rb +10 -6
- data/lib/bundler/cli/cache.rb +1 -1
- data/lib/bundler/cli/check.rb +3 -3
- data/lib/bundler/cli/common.rb +13 -3
- data/lib/bundler/cli/config.rb +18 -8
- data/lib/bundler/cli/console.rb +5 -4
- data/lib/bundler/cli/doctor.rb +12 -5
- data/lib/bundler/cli/exec.rb +1 -1
- data/lib/bundler/cli/fund.rb +1 -1
- data/lib/bundler/cli/gem.rb +141 -48
- data/lib/bundler/cli/info.rb +27 -17
- data/lib/bundler/cli/init.rb +6 -2
- data/lib/bundler/cli/install.rb +22 -39
- data/lib/bundler/cli/issue.rb +5 -4
- data/lib/bundler/cli/lock.rb +36 -29
- data/lib/bundler/cli/open.rb +9 -9
- data/lib/bundler/cli/outdated.rb +19 -12
- data/lib/bundler/cli/platform.rb +8 -6
- data/lib/bundler/cli/plugin.rb +9 -15
- data/lib/bundler/cli/pristine.rb +38 -30
- data/lib/bundler/cli/show.rb +3 -3
- data/lib/bundler/cli/update.rb +12 -7
- data/lib/bundler/cli/viz.rb +1 -1
- data/lib/bundler/cli.rb +266 -285
- data/lib/bundler/compact_index_client/cache.rb +53 -67
- data/lib/bundler/compact_index_client/cache_file.rb +153 -0
- data/lib/bundler/compact_index_client/gem_parser.rb +7 -3
- data/lib/bundler/compact_index_client/parser.rb +84 -0
- data/lib/bundler/compact_index_client/updater.rb +83 -76
- data/lib/bundler/compact_index_client.rb +59 -87
- data/lib/bundler/constants.rb +9 -2
- data/lib/bundler/current_ruby.rb +12 -16
- data/lib/bundler/definition.rb +509 -319
- data/lib/bundler/dependency.rb +33 -71
- data/lib/bundler/digest.rb +71 -0
- data/lib/bundler/dsl.rb +88 -69
- data/lib/bundler/endpoint_specification.rb +32 -15
- data/lib/bundler/env.rb +5 -7
- data/lib/bundler/environment_preserver.rb +8 -22
- data/lib/bundler/errors.rb +101 -13
- data/lib/bundler/feature_flag.rb +0 -2
- data/lib/bundler/fetcher/base.rb +11 -11
- data/lib/bundler/fetcher/compact_index.rb +32 -52
- data/lib/bundler/fetcher/dependency.rb +3 -7
- data/lib/bundler/fetcher/downloader.rb +17 -16
- data/lib/bundler/fetcher/gem_remote_fetcher.rb +16 -0
- data/lib/bundler/fetcher/index.rb +2 -29
- data/lib/bundler/fetcher.rb +87 -79
- data/lib/bundler/force_platform.rb +18 -0
- data/lib/bundler/friendly_errors.rb +29 -40
- data/lib/bundler/gem_helper.rb +11 -23
- data/lib/bundler/gem_helpers.rb +30 -6
- data/lib/bundler/gem_version_promoter.rb +68 -109
- data/lib/bundler/graph.rb +9 -9
- data/lib/bundler/index.rb +71 -79
- data/lib/bundler/injector.rb +23 -11
- data/lib/bundler/inline.rb +11 -23
- data/lib/bundler/installer/gem_installer.rb +18 -11
- data/lib/bundler/installer/parallel_installer.rb +17 -65
- data/lib/bundler/installer/standalone.rb +56 -15
- data/lib/bundler/installer.rb +35 -61
- data/lib/bundler/lazy_specification.rb +92 -61
- data/lib/bundler/lockfile_generator.rb +12 -3
- data/lib/bundler/lockfile_parser.rb +137 -70
- data/lib/bundler/man/bundle-add.1 +19 -26
- data/lib/bundler/man/bundle-add.1.ronn +16 -4
- data/lib/bundler/man/bundle-binstubs.1 +4 -16
- data/lib/bundler/man/bundle-cache.1 +9 -24
- data/lib/bundler/man/bundle-cache.1.ronn +9 -2
- data/lib/bundler/man/bundle-check.1 +5 -12
- data/lib/bundler/man/bundle-check.1.ronn +3 -0
- data/lib/bundler/man/bundle-clean.1 +4 -11
- data/lib/bundler/man/bundle-clean.1.ronn +1 -1
- data/lib/bundler/man/bundle-config.1 +47 -224
- data/lib/bundler/man/bundle-config.1.ronn +40 -28
- data/lib/bundler/man/bundle-console.1 +35 -0
- data/lib/bundler/man/bundle-console.1.ronn +44 -0
- data/lib/bundler/man/bundle-doctor.1 +4 -18
- data/lib/bundler/man/bundle-exec.1 +16 -77
- data/lib/bundler/man/bundle-exec.1.ronn +8 -9
- data/lib/bundler/man/bundle-gem.1 +45 -72
- data/lib/bundler/man/bundle-gem.1.ronn +32 -5
- data/lib/bundler/man/bundle-help.1 +9 -0
- data/lib/bundler/man/bundle-help.1.ronn +12 -0
- data/lib/bundler/man/bundle-info.1 +5 -11
- data/lib/bundler/man/bundle-info.1.ronn +3 -3
- data/lib/bundler/man/bundle-init.1 +6 -11
- data/lib/bundler/man/bundle-init.1.ronn +2 -0
- data/lib/bundler/man/bundle-inject.1 +8 -18
- data/lib/bundler/man/bundle-inject.1.ronn +3 -1
- data/lib/bundler/man/bundle-install.1 +32 -155
- data/lib/bundler/man/bundle-install.1.ronn +11 -33
- data/lib/bundler/man/bundle-list.1 +4 -19
- data/lib/bundler/man/bundle-lock.1 +5 -29
- data/lib/bundler/man/bundle-open.1 +18 -18
- data/lib/bundler/man/bundle-open.1.ronn +9 -1
- data/lib/bundler/man/bundle-outdated.1 +17 -72
- data/lib/bundler/man/bundle-outdated.1.ronn +13 -18
- data/lib/bundler/man/bundle-platform.1 +16 -28
- data/lib/bundler/man/bundle-platform.1.ronn +14 -7
- data/lib/bundler/man/bundle-plugin.1 +58 -0
- data/lib/bundler/man/bundle-plugin.1.ronn +63 -0
- data/lib/bundler/man/bundle-pristine.1 +5 -16
- data/lib/bundler/man/bundle-remove.1 +4 -14
- data/lib/bundler/man/bundle-show.1 +3 -10
- data/lib/bundler/man/bundle-update.1 +19 -138
- data/lib/bundler/man/bundle-update.1.ronn +2 -1
- data/lib/bundler/man/bundle-version.1 +22 -0
- data/lib/bundler/man/bundle-version.1.ronn +24 -0
- data/lib/bundler/man/bundle-viz.1 +6 -15
- data/lib/bundler/man/bundle-viz.1.ronn +2 -0
- data/lib/bundler/man/bundle.1 +17 -51
- data/lib/bundler/man/bundle.1.ronn +12 -7
- data/lib/bundler/man/gemfile.5 +130 -346
- data/lib/bundler/man/gemfile.5.ronn +121 -86
- data/lib/bundler/man/index.txt +4 -0
- data/lib/bundler/match_metadata.rb +17 -0
- data/lib/bundler/match_platform.rb +1 -2
- data/lib/bundler/match_remote_metadata.rb +29 -0
- data/lib/bundler/mirror.rb +8 -10
- data/lib/bundler/plugin/api/source.rb +9 -13
- data/lib/bundler/plugin/index.rb +13 -5
- data/lib/bundler/plugin/installer/git.rb +0 -4
- data/lib/bundler/plugin/installer/path.rb +18 -0
- data/lib/bundler/plugin/installer/rubygems.rb +0 -8
- data/lib/bundler/plugin/installer.rb +42 -19
- data/lib/bundler/plugin/source_list.rb +4 -4
- data/lib/bundler/plugin.rb +16 -7
- data/lib/bundler/process_lock.rb +1 -1
- data/lib/bundler/remote_specification.rb +11 -5
- data/lib/bundler/resolver/base.rb +111 -0
- data/lib/bundler/resolver/candidate.rb +82 -0
- data/lib/bundler/resolver/incompatibility.rb +15 -0
- data/lib/bundler/resolver/package.rb +81 -0
- data/lib/bundler/resolver/root.rb +25 -0
- data/lib/bundler/resolver/spec_group.rb +53 -66
- data/lib/bundler/resolver.rb +419 -307
- data/lib/bundler/retry.rb +1 -1
- data/lib/bundler/ruby_dsl.rb +42 -7
- data/lib/bundler/ruby_version.rb +16 -22
- data/lib/bundler/rubygems_ext.rb +250 -64
- data/lib/bundler/rubygems_gem_installer.rb +90 -64
- data/lib/bundler/rubygems_integration.rb +81 -190
- data/lib/bundler/runtime.rb +8 -13
- data/lib/bundler/safe_marshal.rb +31 -0
- data/lib/bundler/self_manager.rb +206 -0
- data/lib/bundler/settings.rb +139 -57
- data/lib/bundler/setup.rb +13 -1
- data/lib/bundler/shared_helpers.rb +67 -36
- data/lib/bundler/source/git/git_proxy.rb +285 -82
- data/lib/bundler/source/git.rb +81 -41
- data/lib/bundler/source/metadata.rb +17 -16
- data/lib/bundler/source/path/installer.rb +1 -22
- data/lib/bundler/source/path.rb +13 -25
- data/lib/bundler/source/rubygems/remote.rb +1 -1
- data/lib/bundler/source/rubygems.rb +164 -234
- data/lib/bundler/source/rubygems_aggregate.rb +1 -1
- data/lib/bundler/source.rb +7 -6
- data/lib/bundler/source_list.rb +40 -32
- data/lib/bundler/source_map.rb +15 -2
- data/lib/bundler/spec_set.rb +156 -46
- data/lib/bundler/stub_specification.rb +18 -5
- data/lib/bundler/templates/Executable +3 -5
- data/lib/bundler/templates/Executable.bundler +7 -12
- data/lib/bundler/templates/Executable.standalone +4 -4
- data/lib/bundler/templates/Gemfile +0 -2
- data/lib/bundler/templates/newgem/CODE_OF_CONDUCT.md.tt +77 -29
- data/lib/bundler/templates/newgem/Cargo.toml.tt +7 -0
- data/lib/bundler/templates/newgem/Gemfile.tt +8 -2
- data/lib/bundler/templates/newgem/README.md.tt +7 -11
- data/lib/bundler/templates/newgem/Rakefile.tt +28 -4
- data/lib/bundler/templates/newgem/bin/console.tt +0 -4
- data/lib/bundler/templates/newgem/circleci/config.yml.tt +12 -0
- data/lib/bundler/templates/newgem/ext/newgem/Cargo.toml.tt +15 -0
- data/lib/bundler/templates/newgem/ext/newgem/extconf-c.rb.tt +10 -0
- data/lib/bundler/templates/newgem/ext/newgem/extconf-rust.rb.tt +6 -0
- data/lib/bundler/templates/newgem/ext/newgem/newgem.c.tt +1 -1
- data/lib/bundler/templates/newgem/ext/newgem/src/lib.rs.tt +12 -0
- data/lib/bundler/templates/newgem/github/workflows/main.yml.tt +13 -3
- data/lib/bundler/templates/newgem/gitignore.tt +3 -0
- data/lib/bundler/templates/newgem/gitlab-ci.yml.tt +13 -4
- data/lib/bundler/templates/newgem/newgem.gemspec.tt +25 -17
- data/lib/bundler/templates/newgem/rubocop.yml.tt +0 -5
- data/lib/bundler/templates/newgem/sig/newgem.rbs.tt +8 -0
- data/lib/bundler/templates/newgem/standard.yml.tt +3 -0
- data/lib/bundler/templates/newgem/test/minitest/{newgem_test.rb.tt → test_newgem.rb.tt} +1 -1
- data/lib/bundler/ui/rg_proxy.rb +1 -1
- data/lib/bundler/ui/shell.rb +38 -15
- data/lib/bundler/ui/silent.rb +21 -5
- data/lib/bundler/uri_credentials_filter.rb +2 -2
- data/lib/bundler/uri_normalizer.rb +23 -0
- data/lib/bundler/vendor/.document +1 -0
- data/lib/bundler/vendor/connection_pool/.document +1 -0
- data/lib/bundler/vendor/connection_pool/LICENSE +20 -0
- data/lib/bundler/vendor/connection_pool/lib/connection_pool/timed_stack.rb +19 -21
- data/lib/bundler/vendor/connection_pool/lib/connection_pool/version.rb +1 -1
- data/lib/bundler/vendor/connection_pool/lib/connection_pool/wrapper.rb +56 -0
- data/lib/bundler/vendor/connection_pool/lib/connection_pool.rb +92 -78
- data/lib/bundler/vendor/fileutils/.document +1 -0
- data/lib/bundler/vendor/fileutils/LICENSE.txt +22 -0
- data/lib/bundler/vendor/fileutils/lib/fileutils.rb +1340 -410
- data/lib/bundler/vendor/net-http-persistent/.document +1 -0
- data/lib/bundler/vendor/net-http-persistent/README.rdoc +82 -0
- data/lib/bundler/vendor/net-http-persistent/lib/net/http/persistent/connection.rb +4 -3
- data/lib/bundler/vendor/net-http-persistent/lib/net/http/persistent/pool.rb +23 -11
- data/lib/bundler/vendor/net-http-persistent/lib/net/http/persistent/timed_stack_multi.rb +1 -1
- data/lib/bundler/vendor/net-http-persistent/lib/net/http/persistent.rb +57 -57
- data/lib/bundler/vendor/pub_grub/.document +1 -0
- data/lib/bundler/vendor/pub_grub/LICENSE.txt +21 -0
- data/lib/bundler/vendor/pub_grub/lib/pub_grub/assignment.rb +20 -0
- data/lib/bundler/vendor/pub_grub/lib/pub_grub/basic_package_source.rb +189 -0
- data/lib/bundler/vendor/pub_grub/lib/pub_grub/failure_writer.rb +182 -0
- data/lib/bundler/vendor/pub_grub/lib/pub_grub/incompatibility.rb +150 -0
- data/lib/bundler/vendor/pub_grub/lib/pub_grub/package.rb +43 -0
- data/lib/bundler/vendor/pub_grub/lib/pub_grub/partial_solution.rb +121 -0
- data/lib/bundler/vendor/pub_grub/lib/pub_grub/rubygems.rb +45 -0
- data/lib/bundler/vendor/pub_grub/lib/pub_grub/solve_failure.rb +19 -0
- data/lib/bundler/vendor/pub_grub/lib/pub_grub/static_package_source.rb +61 -0
- data/lib/bundler/vendor/pub_grub/lib/pub_grub/term.rb +105 -0
- data/lib/bundler/vendor/pub_grub/lib/pub_grub/version.rb +3 -0
- data/lib/bundler/vendor/pub_grub/lib/pub_grub/version_constraint.rb +129 -0
- data/lib/bundler/vendor/pub_grub/lib/pub_grub/version_range.rb +411 -0
- data/lib/bundler/vendor/pub_grub/lib/pub_grub/version_solver.rb +248 -0
- data/lib/bundler/vendor/pub_grub/lib/pub_grub/version_union.rb +178 -0
- data/lib/bundler/vendor/pub_grub/lib/pub_grub.rb +31 -0
- data/lib/bundler/vendor/thor/.document +1 -0
- data/lib/bundler/vendor/thor/LICENSE.md +20 -0
- data/lib/bundler/vendor/thor/lib/thor/actions/create_file.rb +3 -2
- data/lib/bundler/vendor/thor/lib/thor/actions/directory.rb +1 -1
- data/lib/bundler/vendor/thor/lib/thor/actions/empty_directory.rb +1 -1
- data/lib/bundler/vendor/thor/lib/thor/actions/file_manipulation.rb +12 -14
- data/lib/bundler/vendor/thor/lib/thor/actions/inject_into_file.rb +16 -6
- data/lib/bundler/vendor/thor/lib/thor/actions.rb +21 -17
- data/lib/bundler/vendor/thor/lib/thor/base.rb +140 -14
- data/lib/bundler/vendor/thor/lib/thor/command.rb +13 -4
- data/lib/bundler/vendor/thor/lib/thor/core_ext/hash_with_indifferent_access.rb +10 -0
- data/lib/bundler/vendor/thor/lib/thor/error.rb +16 -20
- data/lib/bundler/vendor/thor/lib/thor/group.rb +1 -1
- data/lib/bundler/vendor/thor/lib/thor/invocation.rb +1 -1
- data/lib/bundler/vendor/thor/lib/thor/nested_context.rb +2 -2
- data/lib/bundler/vendor/thor/lib/thor/parser/argument.rb +20 -1
- data/lib/bundler/vendor/thor/lib/thor/parser/arguments.rb +33 -17
- data/lib/bundler/vendor/thor/lib/thor/parser/option.rb +27 -8
- data/lib/bundler/vendor/thor/lib/thor/parser/options.rb +63 -7
- data/lib/bundler/vendor/thor/lib/thor/rake_compat.rb +2 -2
- data/lib/bundler/vendor/thor/lib/thor/runner.rb +40 -30
- data/lib/bundler/vendor/thor/lib/thor/shell/basic.rb +48 -154
- data/lib/bundler/vendor/thor/lib/thor/shell/color.rb +1 -46
- data/lib/bundler/vendor/thor/lib/thor/shell/column_printer.rb +29 -0
- data/lib/bundler/vendor/thor/lib/thor/shell/html.rb +0 -45
- data/lib/bundler/vendor/thor/lib/thor/shell/table_printer.rb +134 -0
- data/lib/bundler/vendor/thor/lib/thor/shell/terminal.rb +42 -0
- data/lib/bundler/vendor/thor/lib/thor/shell/wrapped_printer.rb +38 -0
- data/lib/bundler/vendor/thor/lib/thor/shell.rb +2 -2
- data/lib/bundler/vendor/thor/lib/thor/util.rb +9 -8
- data/lib/bundler/vendor/thor/lib/thor/version.rb +1 -1
- data/lib/bundler/vendor/thor/lib/thor.rb +155 -8
- data/lib/bundler/vendor/tsort/.document +1 -0
- data/lib/bundler/vendor/tsort/LICENSE.txt +22 -0
- data/lib/bundler/vendor/tsort/lib/tsort.rb +455 -0
- data/lib/bundler/vendor/uri/.document +1 -0
- data/lib/bundler/vendor/uri/LICENSE.txt +22 -0
- data/lib/bundler/vendor/uri/lib/uri/common.rb +316 -207
- data/lib/bundler/vendor/uri/lib/uri/file.rb +7 -1
- data/lib/bundler/vendor/uri/lib/uri/ftp.rb +2 -2
- data/lib/bundler/vendor/uri/lib/uri/generic.rb +33 -13
- data/lib/bundler/vendor/uri/lib/uri/http.rb +40 -3
- data/lib/bundler/vendor/uri/lib/uri/https.rb +2 -2
- data/lib/bundler/vendor/uri/lib/uri/ldap.rb +2 -2
- data/lib/bundler/vendor/uri/lib/uri/ldaps.rb +2 -1
- data/lib/bundler/vendor/uri/lib/uri/mailto.rb +2 -3
- data/lib/bundler/vendor/uri/lib/uri/rfc2396_parser.rb +16 -23
- data/lib/bundler/vendor/uri/lib/uri/rfc3986_parser.rb +105 -47
- data/lib/bundler/vendor/uri/lib/uri/version.rb +1 -1
- data/lib/bundler/vendor/uri/lib/uri/ws.rb +83 -0
- data/lib/bundler/vendor/uri/lib/uri/wss.rb +23 -0
- data/lib/bundler/vendor/uri/lib/uri.rb +3 -3
- data/lib/bundler/vendored_net_http.rb +23 -0
- data/lib/bundler/vendored_persistent.rb +0 -36
- data/lib/bundler/{vendored_molinillo.rb → vendored_pub_grub.rb} +1 -1
- data/lib/bundler/vendored_timeout.rb +12 -0
- data/lib/bundler/{vendored_tmpdir.rb → vendored_tsort.rb} +1 -1
- data/lib/bundler/vendored_uri.rb +18 -1
- data/lib/bundler/version.rb +5 -1
- data/lib/bundler/vlad.rb +1 -1
- data/lib/bundler/worker.rb +7 -9
- data/lib/bundler/yaml_serializer.rb +21 -12
- data/lib/bundler.rb +114 -121
- metadata +87 -41
- data/lib/bundler/dep_proxy.rb +0 -55
- data/lib/bundler/gemdeps.rb +0 -29
- data/lib/bundler/psyched_yaml.rb +0 -22
- data/lib/bundler/templates/gems.rb +0 -8
- data/lib/bundler/templates/newgem/ext/newgem/extconf.rb.tt +0 -5
- data/lib/bundler/templates/newgem/travis.yml.tt +0 -6
- data/lib/bundler/vendor/connection_pool/lib/connection_pool/monotonic_time.rb +0 -66
- data/lib/bundler/vendor/molinillo/lib/molinillo/delegates/resolution_state.rb +0 -57
- data/lib/bundler/vendor/molinillo/lib/molinillo/delegates/specification_provider.rb +0 -88
- data/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/action.rb +0 -36
- data/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/add_edge_no_circular.rb +0 -66
- data/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/add_vertex.rb +0 -62
- data/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/delete_edge.rb +0 -63
- data/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/detach_vertex_named.rb +0 -61
- data/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/log.rb +0 -126
- data/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/set_payload.rb +0 -46
- data/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/tag.rb +0 -36
- data/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/vertex.rb +0 -164
- data/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph.rb +0 -255
- data/lib/bundler/vendor/molinillo/lib/molinillo/errors.rb +0 -143
- data/lib/bundler/vendor/molinillo/lib/molinillo/gem_metadata.rb +0 -6
- data/lib/bundler/vendor/molinillo/lib/molinillo/modules/specification_provider.rb +0 -112
- data/lib/bundler/vendor/molinillo/lib/molinillo/modules/ui.rb +0 -67
- data/lib/bundler/vendor/molinillo/lib/molinillo/resolution.rb +0 -839
- data/lib/bundler/vendor/molinillo/lib/molinillo/resolver.rb +0 -46
- data/lib/bundler/vendor/molinillo/lib/molinillo/state.rb +0 -58
- data/lib/bundler/vendor/molinillo/lib/molinillo.rb +0 -11
- data/lib/bundler/vendor/tmpdir/lib/tmpdir.rb +0 -154
- data/lib/bundler/version_ranges.rb +0 -122
@@ -0,0 +1 @@
|
|
1
|
+
# Vendored files do not need to be documented
|
@@ -0,0 +1,82 @@
|
|
1
|
+
= net-http-persistent
|
2
|
+
|
3
|
+
home :: https://github.com/drbrain/net-http-persistent
|
4
|
+
rdoc :: https://rdoc.info/gems/net-http-persistent
|
5
|
+
|
6
|
+
== DESCRIPTION:
|
7
|
+
|
8
|
+
Manages persistent connections using Net::HTTP including a thread pool for
|
9
|
+
connecting to multiple hosts.
|
10
|
+
|
11
|
+
Using persistent HTTP connections can dramatically increase the speed of HTTP.
|
12
|
+
Creating a new HTTP connection for every request involves an extra TCP
|
13
|
+
round-trip and causes TCP congestion avoidance negotiation to start over.
|
14
|
+
|
15
|
+
Net::HTTP supports persistent connections with some API methods but does not
|
16
|
+
make setting up a single persistent connection or managing multiple
|
17
|
+
connections easy. Net::HTTP::Persistent wraps Net::HTTP and allows you to
|
18
|
+
focus on how to make HTTP requests.
|
19
|
+
|
20
|
+
== FEATURES/PROBLEMS:
|
21
|
+
|
22
|
+
* Supports TLS with secure defaults
|
23
|
+
* Thread-safe
|
24
|
+
* Pure ruby
|
25
|
+
|
26
|
+
== SYNOPSIS
|
27
|
+
|
28
|
+
The following example will make two requests to the same server. The
|
29
|
+
connection is kept alive between requests:
|
30
|
+
|
31
|
+
require 'net/http/persistent'
|
32
|
+
|
33
|
+
uri = URI 'http://example.com/awesome/web/service'
|
34
|
+
|
35
|
+
http = Net::HTTP::Persistent.new name: 'my_app_name'
|
36
|
+
|
37
|
+
# perform a GET
|
38
|
+
response = http.request uri
|
39
|
+
|
40
|
+
# create a POST
|
41
|
+
post_uri = uri + 'create'
|
42
|
+
post = Net::HTTP::Post.new post_uri.path
|
43
|
+
post.set_form_data 'some' => 'cool data'
|
44
|
+
|
45
|
+
# perform the POST, the URI is always required
|
46
|
+
response = http.request post_uri, post
|
47
|
+
|
48
|
+
# if you are done making http requests, or won't make requests for several
|
49
|
+
# minutes
|
50
|
+
http.shutdown
|
51
|
+
|
52
|
+
Please see the documentation on Net::HTTP::Persistent for more information,
|
53
|
+
including SSL connection verification, header handling and tunable options.
|
54
|
+
|
55
|
+
== INSTALL:
|
56
|
+
|
57
|
+
gem install net-http-persistent
|
58
|
+
|
59
|
+
== LICENSE:
|
60
|
+
|
61
|
+
(The MIT License)
|
62
|
+
|
63
|
+
Copyright (c) Eric Hodel, Aaron Patterson
|
64
|
+
|
65
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
66
|
+
a copy of this software and associated documentation files (the
|
67
|
+
'Software'), to deal in the Software without restriction, including
|
68
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
69
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
70
|
+
permit persons to whom the Software is furnished to do so, subject to
|
71
|
+
the following conditions:
|
72
|
+
|
73
|
+
The above copyright notice and this permission notice shall be
|
74
|
+
included in all copies or substantial portions of the Software.
|
75
|
+
|
76
|
+
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
|
77
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
78
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
79
|
+
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
80
|
+
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
81
|
+
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
82
|
+
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
@@ -1,8 +1,8 @@
|
|
1
1
|
##
|
2
|
-
# A Net::HTTP connection wrapper that holds extra information for managing the
|
2
|
+
# A Gem::Net::HTTP connection wrapper that holds extra information for managing the
|
3
3
|
# connection's lifetime.
|
4
4
|
|
5
|
-
class
|
5
|
+
class Gem::Net::HTTP::Persistent::Connection # :nodoc:
|
6
6
|
|
7
7
|
attr_accessor :http
|
8
8
|
|
@@ -25,9 +25,10 @@ class Bundler::Persistent::Net::HTTP::Persistent::Connection # :nodoc:
|
|
25
25
|
ensure
|
26
26
|
reset
|
27
27
|
end
|
28
|
+
alias_method :close, :finish
|
28
29
|
|
29
30
|
def reset
|
30
|
-
@last_use =
|
31
|
+
@last_use = Gem::Net::HTTP::Persistent::EPOCH
|
31
32
|
@requests = 0
|
32
33
|
end
|
33
34
|
|
@@ -1,4 +1,4 @@
|
|
1
|
-
class
|
1
|
+
class Gem::Net::HTTP::Persistent::Pool < Bundler::ConnectionPool # :nodoc:
|
2
2
|
|
3
3
|
attr_reader :available # :nodoc:
|
4
4
|
attr_reader :key # :nodoc:
|
@@ -6,25 +6,37 @@ class Bundler::Persistent::Net::HTTP::Persistent::Pool < Bundler::ConnectionPool
|
|
6
6
|
def initialize(options = {}, &block)
|
7
7
|
super
|
8
8
|
|
9
|
-
@available =
|
9
|
+
@available = Gem::Net::HTTP::Persistent::TimedStackMulti.new(@size, &block)
|
10
10
|
@key = "current-#{@available.object_id}"
|
11
11
|
end
|
12
12
|
|
13
13
|
def checkin net_http_args
|
14
|
-
|
14
|
+
if net_http_args.is_a?(Hash) && net_http_args.size == 1 && net_http_args[:force]
|
15
|
+
# Bundler::ConnectionPool 2.4+ calls `checkin(force: true)` after fork.
|
16
|
+
# When this happens, we should remove all connections from Thread.current
|
17
|
+
if stacks = Thread.current[@key]
|
18
|
+
stacks.each do |http_args, connections|
|
19
|
+
connections.each do |conn|
|
20
|
+
@available.push conn, connection_args: http_args
|
21
|
+
end
|
22
|
+
connections.clear
|
23
|
+
end
|
24
|
+
end
|
25
|
+
else
|
26
|
+
stack = Thread.current[@key][net_http_args] ||= []
|
15
27
|
|
16
|
-
|
17
|
-
|
28
|
+
raise Bundler::ConnectionPool::Error, 'no connections are checked out' if
|
29
|
+
stack.empty?
|
18
30
|
|
19
|
-
|
31
|
+
conn = stack.pop
|
20
32
|
|
21
|
-
|
22
|
-
|
33
|
+
if stack.empty?
|
34
|
+
@available.push conn, connection_args: net_http_args
|
23
35
|
|
24
|
-
|
25
|
-
|
36
|
+
Thread.current[@key].delete(net_http_args)
|
37
|
+
Thread.current[@key] = nil if Thread.current[@key].empty?
|
38
|
+
end
|
26
39
|
end
|
27
|
-
|
28
40
|
nil
|
29
41
|
end
|
30
42
|
|
@@ -1,14 +1,14 @@
|
|
1
|
-
|
2
|
-
require_relative '
|
1
|
+
require_relative '../../../../../vendored_net_http'
|
2
|
+
require_relative '../../../../../vendored_uri'
|
3
3
|
require 'cgi' # for escaping
|
4
4
|
require_relative '../../../../connection_pool/lib/connection_pool'
|
5
5
|
|
6
6
|
autoload :OpenSSL, 'openssl'
|
7
7
|
|
8
8
|
##
|
9
|
-
# Persistent connections for Net::HTTP
|
9
|
+
# Persistent connections for Gem::Net::HTTP
|
10
10
|
#
|
11
|
-
#
|
11
|
+
# Gem::Net::HTTP::Persistent maintains persistent connections across all the
|
12
12
|
# servers you wish to talk to. For each host:port you communicate with a
|
13
13
|
# single persistent connection is created.
|
14
14
|
#
|
@@ -22,34 +22,34 @@ autoload :OpenSSL, 'openssl'
|
|
22
22
|
#
|
23
23
|
# require 'bundler/vendor/net-http-persistent/lib/net/http/persistent'
|
24
24
|
#
|
25
|
-
# uri =
|
25
|
+
# uri = Gem::URI 'http://example.com/awesome/web/service'
|
26
26
|
#
|
27
|
-
# http =
|
27
|
+
# http = Gem::Net::HTTP::Persistent.new
|
28
28
|
#
|
29
29
|
# # perform a GET
|
30
30
|
# response = http.request uri
|
31
31
|
#
|
32
32
|
# # or
|
33
33
|
#
|
34
|
-
# get = Net::HTTP::Get.new uri.request_uri
|
34
|
+
# get = Gem::Net::HTTP::Get.new uri.request_uri
|
35
35
|
# response = http.request get
|
36
36
|
#
|
37
37
|
# # create a POST
|
38
38
|
# post_uri = uri + 'create'
|
39
|
-
# post = Net::HTTP::Post.new post_uri.path
|
39
|
+
# post = Gem::Net::HTTP::Post.new post_uri.path
|
40
40
|
# post.set_form_data 'some' => 'cool data'
|
41
41
|
#
|
42
|
-
# # perform the POST, the
|
42
|
+
# # perform the POST, the Gem::URI is always required
|
43
43
|
# response http.request post_uri, post
|
44
44
|
#
|
45
45
|
# Note that for GET, HEAD and other requests that do not have a body you want
|
46
|
-
# to use
|
46
|
+
# to use Gem::URI#request_uri not Gem::URI#path. The request_uri contains the query
|
47
47
|
# params which are sent in the body for other requests.
|
48
48
|
#
|
49
49
|
# == TLS/SSL
|
50
50
|
#
|
51
51
|
# TLS connections are automatically created depending upon the scheme of the
|
52
|
-
#
|
52
|
+
# Gem::URI. TLS connections are automatically verified against the default
|
53
53
|
# certificate store for your computer. You can override this by changing
|
54
54
|
# verify_mode or by specifying an alternate cert_store.
|
55
55
|
#
|
@@ -72,7 +72,7 @@ autoload :OpenSSL, 'openssl'
|
|
72
72
|
# == Proxies
|
73
73
|
#
|
74
74
|
# A proxy can be set through #proxy= or at initialization time by providing a
|
75
|
-
# second argument to ::new. The proxy may be the
|
75
|
+
# second argument to ::new. The proxy may be the Gem::URI of the proxy server or
|
76
76
|
# <code>:ENV</code> which will consult environment variables.
|
77
77
|
#
|
78
78
|
# See #proxy= and #proxy_from_env for details.
|
@@ -92,7 +92,7 @@ autoload :OpenSSL, 'openssl'
|
|
92
92
|
#
|
93
93
|
# === Segregation
|
94
94
|
#
|
95
|
-
# Each
|
95
|
+
# Each Gem::Net::HTTP::Persistent instance has its own pool of connections. There
|
96
96
|
# is no sharing with other instances (as was true in earlier versions).
|
97
97
|
#
|
98
98
|
# === Idle Timeout
|
@@ -131,7 +131,7 @@ autoload :OpenSSL, 'openssl'
|
|
131
131
|
#
|
132
132
|
# === Connection Termination
|
133
133
|
#
|
134
|
-
# If you are done using the
|
134
|
+
# If you are done using the Gem::Net::HTTP::Persistent instance you may shut down
|
135
135
|
# all the connections in the current thread with #shutdown. This is not
|
136
136
|
# recommended for normal use, it should only be used when it will be several
|
137
137
|
# minutes before you make another HTTP request.
|
@@ -141,7 +141,7 @@ autoload :OpenSSL, 'openssl'
|
|
141
141
|
# Ruby will automatically garbage collect and shutdown your HTTP connections
|
142
142
|
# when the thread terminates.
|
143
143
|
|
144
|
-
class
|
144
|
+
class Gem::Net::HTTP::Persistent
|
145
145
|
|
146
146
|
##
|
147
147
|
# The beginning of Time
|
@@ -172,12 +172,12 @@ class Bundler::Persistent::Net::HTTP::Persistent
|
|
172
172
|
end
|
173
173
|
|
174
174
|
##
|
175
|
-
# The version of
|
175
|
+
# The version of Gem::Net::HTTP::Persistent you are using
|
176
176
|
|
177
|
-
VERSION = '4.0.
|
177
|
+
VERSION = '4.0.2'
|
178
178
|
|
179
179
|
##
|
180
|
-
# Error class for errors raised by
|
180
|
+
# Error class for errors raised by Gem::Net::HTTP::Persistent. Various
|
181
181
|
# SystemCallErrors are re-raised with a human-readable message under this
|
182
182
|
# class.
|
183
183
|
|
@@ -197,10 +197,10 @@ class Bundler::Persistent::Net::HTTP::Persistent
|
|
197
197
|
# NOTE: This may not work on ruby > 1.9.
|
198
198
|
|
199
199
|
def self.detect_idle_timeout uri, max = 10
|
200
|
-
uri =
|
200
|
+
uri = Gem::URI uri unless Gem::URI::Generic === uri
|
201
201
|
uri += '/'
|
202
202
|
|
203
|
-
req = Net::HTTP::Head.new uri.request_uri
|
203
|
+
req = Gem::Net::HTTP::Head.new uri.request_uri
|
204
204
|
|
205
205
|
http = new 'net-http-persistent detect_idle_timeout'
|
206
206
|
|
@@ -214,7 +214,7 @@ class Bundler::Persistent::Net::HTTP::Persistent
|
|
214
214
|
|
215
215
|
$stderr.puts "HEAD #{uri} => #{response.code}" if $DEBUG
|
216
216
|
|
217
|
-
unless Net::HTTPOK === response then
|
217
|
+
unless Gem::Net::HTTPOK === response then
|
218
218
|
raise Error, "bad response code #{response.code} detecting idle timeout"
|
219
219
|
end
|
220
220
|
|
@@ -238,7 +238,7 @@ class Bundler::Persistent::Net::HTTP::Persistent
|
|
238
238
|
attr_reader :certificate
|
239
239
|
|
240
240
|
##
|
241
|
-
# For Net::HTTP parity
|
241
|
+
# For Gem::Net::HTTP parity
|
242
242
|
|
243
243
|
alias cert certificate
|
244
244
|
|
@@ -266,7 +266,7 @@ class Bundler::Persistent::Net::HTTP::Persistent
|
|
266
266
|
attr_reader :ciphers
|
267
267
|
|
268
268
|
##
|
269
|
-
# Sends debug_output to this IO via Net::HTTP#set_debug_output.
|
269
|
+
# Sends debug_output to this IO via Gem::Net::HTTP#set_debug_output.
|
270
270
|
#
|
271
271
|
# Never use this method in production code, it causes a serious security
|
272
272
|
# hole.
|
@@ -279,7 +279,7 @@ class Bundler::Persistent::Net::HTTP::Persistent
|
|
279
279
|
attr_reader :generation # :nodoc:
|
280
280
|
|
281
281
|
##
|
282
|
-
# Headers that are added to every request using Net::HTTP#add_field
|
282
|
+
# Headers that are added to every request using Gem::Net::HTTP#add_field
|
283
283
|
|
284
284
|
attr_reader :headers
|
285
285
|
|
@@ -304,7 +304,7 @@ class Bundler::Persistent::Net::HTTP::Persistent
|
|
304
304
|
##
|
305
305
|
# Number of retries to perform if a request fails.
|
306
306
|
#
|
307
|
-
# See also #max_retries=, Net::HTTP#max_retries=.
|
307
|
+
# See also #max_retries=, Gem::Net::HTTP#max_retries=.
|
308
308
|
|
309
309
|
attr_reader :max_retries
|
310
310
|
|
@@ -325,12 +325,12 @@ class Bundler::Persistent::Net::HTTP::Persistent
|
|
325
325
|
attr_reader :name
|
326
326
|
|
327
327
|
##
|
328
|
-
# Seconds to wait until a connection is opened. See Net::HTTP#open_timeout
|
328
|
+
# Seconds to wait until a connection is opened. See Gem::Net::HTTP#open_timeout
|
329
329
|
|
330
330
|
attr_accessor :open_timeout
|
331
331
|
|
332
332
|
##
|
333
|
-
# Headers that are added to every request using Net::HTTP#[]=
|
333
|
+
# Headers that are added to every request using Gem::Net::HTTP#[]=
|
334
334
|
|
335
335
|
attr_reader :override_headers
|
336
336
|
|
@@ -340,7 +340,7 @@ class Bundler::Persistent::Net::HTTP::Persistent
|
|
340
340
|
attr_reader :private_key
|
341
341
|
|
342
342
|
##
|
343
|
-
# For Net::HTTP parity
|
343
|
+
# For Gem::Net::HTTP parity
|
344
344
|
|
345
345
|
alias key private_key
|
346
346
|
|
@@ -360,12 +360,12 @@ class Bundler::Persistent::Net::HTTP::Persistent
|
|
360
360
|
attr_reader :pool # :nodoc:
|
361
361
|
|
362
362
|
##
|
363
|
-
# Seconds to wait until reading one block. See Net::HTTP#read_timeout
|
363
|
+
# Seconds to wait until reading one block. See Gem::Net::HTTP#read_timeout
|
364
364
|
|
365
365
|
attr_accessor :read_timeout
|
366
366
|
|
367
367
|
##
|
368
|
-
# Seconds to wait until writing one block. See Net::HTTP#write_timeout
|
368
|
+
# Seconds to wait until writing one block. See Gem::Net::HTTP#write_timeout
|
369
369
|
|
370
370
|
attr_accessor :write_timeout
|
371
371
|
|
@@ -450,18 +450,18 @@ class Bundler::Persistent::Net::HTTP::Persistent
|
|
450
450
|
attr_reader :verify_mode
|
451
451
|
|
452
452
|
##
|
453
|
-
# Creates a new
|
453
|
+
# Creates a new Gem::Net::HTTP::Persistent.
|
454
454
|
#
|
455
455
|
# Set a +name+ for fun. Your library name should be good enough, but this
|
456
456
|
# otherwise has no purpose.
|
457
457
|
#
|
458
|
-
# +proxy+ may be set to a
|
458
|
+
# +proxy+ may be set to a Gem::URI::HTTP or :ENV to pick up proxy options from
|
459
459
|
# the environment. See proxy_from_env for details.
|
460
460
|
#
|
461
|
-
# In order to use a
|
462
|
-
# beyond
|
461
|
+
# In order to use a Gem::URI for the proxy you may need to do some extra work
|
462
|
+
# beyond Gem::URI parsing if the proxy requires a password:
|
463
463
|
#
|
464
|
-
# proxy =
|
464
|
+
# proxy = Gem::URI 'http://proxy.example'
|
465
465
|
# proxy.user = 'AzureDiamond'
|
466
466
|
# proxy.password = 'hunter2'
|
467
467
|
#
|
@@ -492,8 +492,8 @@ class Bundler::Persistent::Net::HTTP::Persistent
|
|
492
492
|
@socket_options << [Socket::IPPROTO_TCP, Socket::TCP_NODELAY, 1] if
|
493
493
|
Socket.const_defined? :TCP_NODELAY
|
494
494
|
|
495
|
-
@pool =
|
496
|
-
|
495
|
+
@pool = Gem::Net::HTTP::Persistent::Pool.new size: pool_size do |http_args|
|
496
|
+
Gem::Net::HTTP::Persistent::Connection.new Gem::Net::HTTP, http_args, @ssl_generation
|
497
497
|
end
|
498
498
|
|
499
499
|
@certificate = nil
|
@@ -510,7 +510,7 @@ class Bundler::Persistent::Net::HTTP::Persistent
|
|
510
510
|
@verify_mode = nil
|
511
511
|
@cert_store = nil
|
512
512
|
|
513
|
-
@generation = 0 # incremented when proxy
|
513
|
+
@generation = 0 # incremented when proxy Gem::URI changes
|
514
514
|
|
515
515
|
if HAVE_OPENSSL then
|
516
516
|
@verify_mode = OpenSSL::SSL::VERIFY_PEER
|
@@ -529,7 +529,7 @@ class Bundler::Persistent::Net::HTTP::Persistent
|
|
529
529
|
reconnect_ssl
|
530
530
|
end
|
531
531
|
|
532
|
-
# For Net::HTTP parity
|
532
|
+
# For Gem::Net::HTTP parity
|
533
533
|
alias cert= certificate=
|
534
534
|
|
535
535
|
##
|
@@ -648,7 +648,7 @@ class Bundler::Persistent::Net::HTTP::Persistent
|
|
648
648
|
end
|
649
649
|
|
650
650
|
##
|
651
|
-
# Starts the Net::HTTP +connection+
|
651
|
+
# Starts the Gem::Net::HTTP +connection+
|
652
652
|
|
653
653
|
def start http
|
654
654
|
http.set_debug_output @debug_output if @debug_output
|
@@ -666,7 +666,7 @@ class Bundler::Persistent::Net::HTTP::Persistent
|
|
666
666
|
end
|
667
667
|
|
668
668
|
##
|
669
|
-
# Finishes the Net::HTTP +connection+
|
669
|
+
# Finishes the Gem::Net::HTTP +connection+
|
670
670
|
|
671
671
|
def finish connection
|
672
672
|
connection.finish
|
@@ -716,16 +716,16 @@ class Bundler::Persistent::Net::HTTP::Persistent
|
|
716
716
|
reconnect_ssl
|
717
717
|
end
|
718
718
|
|
719
|
-
# For Net::HTTP parity
|
719
|
+
# For Gem::Net::HTTP parity
|
720
720
|
alias key= private_key=
|
721
721
|
|
722
722
|
##
|
723
|
-
# Sets the proxy server. The +proxy+ may be the
|
723
|
+
# Sets the proxy server. The +proxy+ may be the Gem::URI of the proxy server,
|
724
724
|
# the symbol +:ENV+ which will read the proxy from the environment or nil to
|
725
725
|
# disable use of a proxy. See #proxy_from_env for details on setting the
|
726
726
|
# proxy from the environment.
|
727
727
|
#
|
728
|
-
# If the proxy
|
728
|
+
# If the proxy Gem::URI is set after requests have been made, the next request
|
729
729
|
# will shut-down and re-open all connections.
|
730
730
|
#
|
731
731
|
# The +no_proxy+ query parameter can be used to specify hosts which shouldn't
|
@@ -736,9 +736,9 @@ class Bundler::Persistent::Net::HTTP::Persistent
|
|
736
736
|
def proxy= proxy
|
737
737
|
@proxy_uri = case proxy
|
738
738
|
when :ENV then proxy_from_env
|
739
|
-
when
|
739
|
+
when Gem::URI::HTTP then proxy
|
740
740
|
when nil then # ignore
|
741
|
-
else raise ArgumentError, 'proxy must be :ENV or a
|
741
|
+
else raise ArgumentError, 'proxy must be :ENV or a Gem::URI::HTTP'
|
742
742
|
end
|
743
743
|
|
744
744
|
@no_proxy.clear
|
@@ -763,13 +763,13 @@ class Bundler::Persistent::Net::HTTP::Persistent
|
|
763
763
|
end
|
764
764
|
|
765
765
|
##
|
766
|
-
# Creates a
|
766
|
+
# Creates a Gem::URI for an HTTP proxy server from ENV variables.
|
767
767
|
#
|
768
768
|
# If +HTTP_PROXY+ is set a proxy will be returned.
|
769
769
|
#
|
770
|
-
# If +HTTP_PROXY_USER+ or +HTTP_PROXY_PASS+ are set the
|
770
|
+
# If +HTTP_PROXY_USER+ or +HTTP_PROXY_PASS+ are set the Gem::URI is given the
|
771
771
|
# indicated user and password unless HTTP_PROXY contains either of these in
|
772
|
-
# the
|
772
|
+
# the Gem::URI.
|
773
773
|
#
|
774
774
|
# The +NO_PROXY+ ENV variable can be used to specify hosts which shouldn't
|
775
775
|
# be reached via proxy; if set it should be a comma separated list of
|
@@ -785,7 +785,7 @@ class Bundler::Persistent::Net::HTTP::Persistent
|
|
785
785
|
|
786
786
|
return nil if env_proxy.nil? or env_proxy.empty?
|
787
787
|
|
788
|
-
uri =
|
788
|
+
uri = Gem::URI normalize_uri env_proxy
|
789
789
|
|
790
790
|
env_no_proxy = ENV['no_proxy'] || ENV['NO_PROXY']
|
791
791
|
|
@@ -835,7 +835,7 @@ class Bundler::Persistent::Net::HTTP::Persistent
|
|
835
835
|
end
|
836
836
|
|
837
837
|
##
|
838
|
-
# Finishes then restarts the Net::HTTP +connection+
|
838
|
+
# Finishes then restarts the Gem::Net::HTTP +connection+
|
839
839
|
|
840
840
|
def reset connection
|
841
841
|
http = connection.http
|
@@ -854,16 +854,16 @@ class Bundler::Persistent::Net::HTTP::Persistent
|
|
854
854
|
end
|
855
855
|
|
856
856
|
##
|
857
|
-
# Makes a request on +uri+. If +req+ is nil a Net::HTTP::Get is performed
|
857
|
+
# Makes a request on +uri+. If +req+ is nil a Gem::Net::HTTP::Get is performed
|
858
858
|
# against +uri+.
|
859
859
|
#
|
860
|
-
# If a block is passed #request behaves like Net::HTTP#request (the body of
|
860
|
+
# If a block is passed #request behaves like Gem::Net::HTTP#request (the body of
|
861
861
|
# the response will not have been read).
|
862
862
|
#
|
863
|
-
# +req+ must be a Net::HTTPGenericRequest subclass (see Net::HTTP for a list).
|
863
|
+
# +req+ must be a Gem::Net::HTTPGenericRequest subclass (see Gem::Net::HTTP for a list).
|
864
864
|
|
865
865
|
def request uri, req = nil, &block
|
866
|
-
uri =
|
866
|
+
uri = Gem::URI uri
|
867
867
|
req = request_setup req || uri
|
868
868
|
response = nil
|
869
869
|
|
@@ -896,14 +896,14 @@ class Bundler::Persistent::Net::HTTP::Persistent
|
|
896
896
|
end
|
897
897
|
|
898
898
|
##
|
899
|
-
# Creates a GET request if +req_or_uri+ is a
|
899
|
+
# Creates a GET request if +req_or_uri+ is a Gem::URI and adds headers to the
|
900
900
|
# request.
|
901
901
|
#
|
902
902
|
# Returns the request.
|
903
903
|
|
904
904
|
def request_setup req_or_uri # :nodoc:
|
905
905
|
req = if req_or_uri.respond_to? 'request_uri' then
|
906
|
-
Net::HTTP::Get.new req_or_uri.request_uri
|
906
|
+
Gem::Net::HTTP::Get.new req_or_uri.request_uri
|
907
907
|
else
|
908
908
|
req_or_uri
|
909
909
|
end
|
@@ -0,0 +1 @@
|
|
1
|
+
# Vendored files do not need to be documented
|
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2018 John Hawthorn
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
13
|
+
all copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
21
|
+
THE SOFTWARE.
|
@@ -0,0 +1,20 @@
|
|
1
|
+
module Bundler::PubGrub
|
2
|
+
class Assignment
|
3
|
+
attr_reader :term, :cause, :decision_level, :index
|
4
|
+
def initialize(term, cause, decision_level, index)
|
5
|
+
@term = term
|
6
|
+
@cause = cause
|
7
|
+
@decision_level = decision_level
|
8
|
+
@index = index
|
9
|
+
end
|
10
|
+
|
11
|
+
def self.decision(package, version, decision_level, index)
|
12
|
+
term = Term.new(VersionConstraint.exact(package, version), true)
|
13
|
+
new(term, :decision, decision_level, index)
|
14
|
+
end
|
15
|
+
|
16
|
+
def decision?
|
17
|
+
cause == :decision
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|