opt
/
alt
/
ruby26
/
lib64
/
ruby
/
2.6.0
/
rubygems
/
Go to Home Directory
+
Upload
Create File
root@0UT1S:~$
Execute
By Order of Mr.0UT1S
[DIR] ..
N/A
[DIR] commands
N/A
[DIR] core_ext
N/A
[DIR] ext
N/A
[DIR] package
N/A
[DIR] request
N/A
[DIR] request_set
N/A
[DIR] resolver
N/A
[DIR] security
N/A
[DIR] source
N/A
[DIR] ssl_certs
N/A
[DIR] util
N/A
available_set.rb
3.02 KB
Rename
Delete
basic_specification.rb
7.34 KB
Rename
Delete
bundler_version_finder.rb
2.78 KB
Rename
Delete
command.rb
14.06 KB
Rename
Delete
command_manager.rb
4.99 KB
Rename
Delete
compatibility.rb
1014 bytes
Rename
Delete
config_file.rb
12.61 KB
Rename
Delete
defaults.rb
4.91 KB
Rename
Delete
dependency.rb
8.42 KB
Rename
Delete
dependency_installer.rb
14.37 KB
Rename
Delete
dependency_list.rb
5.52 KB
Rename
Delete
deprecate.rb
1.73 KB
Rename
Delete
doctor.rb
3.06 KB
Rename
Delete
errors.rb
4.63 KB
Rename
Delete
exceptions.rb
6.62 KB
Rename
Delete
ext.rb
460 bytes
Rename
Delete
gem_runner.rb
2.18 KB
Rename
Delete
gemcutter_utilities.rb
5.20 KB
Rename
Delete
indexer.rb
11.27 KB
Rename
Delete
install_default_message.rb
336 bytes
Rename
Delete
install_message.rb
310 bytes
Rename
Delete
install_update_options.rb
6.26 KB
Rename
Delete
installer.rb
26.37 KB
Rename
Delete
installer_test_case.rb
4.12 KB
Rename
Delete
local_remote_options.rb
3.54 KB
Rename
Delete
mock_gem_ui.rb
1.38 KB
Rename
Delete
name_tuple.rb
2.41 KB
Rename
Delete
package.rb
17.52 KB
Rename
Delete
package_task.rb
3.80 KB
Rename
Delete
path_support.rb
1.87 KB
Rename
Delete
platform.rb
6.25 KB
Rename
Delete
psych_additions.rb
300 bytes
Rename
Delete
psych_tree.rb
794 bytes
Rename
Delete
rdoc.rb
523 bytes
Rename
Delete
remote_fetcher.rb
11.38 KB
Rename
Delete
request.rb
8.69 KB
Rename
Delete
request_set.rb
11.93 KB
Rename
Delete
requirement.rb
7.38 KB
Rename
Delete
resolver.rb
9.44 KB
Rename
Delete
safe_yaml.rb
1.55 KB
Rename
Delete
security.rb
21.24 KB
Rename
Delete
security_option.rb
1.06 KB
Rename
Delete
server.rb
22.72 KB
Rename
Delete
source.rb
5.20 KB
Rename
Delete
source_list.rb
2.53 KB
Rename
Delete
source_local.rb
274 bytes
Rename
Delete
source_specific_file.rb
272 bytes
Rename
Delete
spec_fetcher.rb
6.51 KB
Rename
Delete
specification.rb
72.70 KB
Rename
Delete
specification_policy.rb
10.69 KB
Rename
Delete
stub_specification.rb
4.81 KB
Rename
Delete
syck_hack.rb
2.12 KB
Rename
Delete
test_case.rb
43.33 KB
Rename
Delete
test_utilities.rb
8.39 KB
Rename
Delete
text.rb
1.86 KB
Rename
Delete
uninstaller.rb
8.91 KB
Rename
Delete
uri_formatter.rb
792 bytes
Rename
Delete
user_interaction.rb
13.29 KB
Rename
Delete
util.rb
2.70 KB
Rename
Delete
validator.rb
4.21 KB
Rename
Delete
version.rb
12.22 KB
Rename
Delete
version_option.rb
2.02 KB
Rename
Delete
# frozen_string_literal: true require 'net/http' require 'time' require 'rubygems/user_interaction' class Gem::Request extend Gem::UserInteraction include Gem::UserInteraction ### # Legacy. This is used in tests. def self.create_with_proxy(uri, request_class, last_modified, proxy) # :nodoc: cert_files = get_cert_files proxy ||= get_proxy_from_env(uri.scheme) pool = ConnectionPools.new proxy_uri(proxy), cert_files new(uri, request_class, last_modified, pool.pool_for(uri)) end def self.proxy_uri(proxy) # :nodoc: case proxy when :no_proxy then nil when URI::HTTP then proxy else URI.parse(proxy) end end def initialize(uri, request_class, last_modified, pool) @uri = uri @request_class = request_class @last_modified = last_modified @requests = Hash.new 0 @user_agent = user_agent @connection_pool = pool end def proxy_uri; @connection_pool.proxy_uri; end def cert_files; @connection_pool.cert_files; end def self.get_cert_files pattern = File.expand_path("./ssl_certs/*/*.pem", File.dirname(__FILE__)) Dir.glob(pattern) end def self.configure_connection_for_https(connection, cert_files) require 'net/https' connection.use_ssl = true connection.verify_mode = Gem.configuration.ssl_verify_mode || OpenSSL::SSL::VERIFY_PEER store = OpenSSL::X509::Store.new if Gem.configuration.ssl_client_cert pem = File.read Gem.configuration.ssl_client_cert connection.cert = OpenSSL::X509::Certificate.new pem connection.key = OpenSSL::PKey::RSA.new pem end store.set_default_paths cert_files.each do |ssl_cert_file| store.add_file ssl_cert_file end if Gem.configuration.ssl_ca_cert if File.directory? Gem.configuration.ssl_ca_cert store.add_path Gem.configuration.ssl_ca_cert else store.add_file Gem.configuration.ssl_ca_cert end end connection.cert_store = store connection.verify_callback = proc do |preverify_ok, store_context| verify_certificate store_context unless preverify_ok preverify_ok end connection rescue LoadError => e raise unless (e.respond_to?(:path) && e.path == 'openssl') || e.message =~ / -- openssl$/ raise Gem::Exception.new( 'Unable to require openssl, install OpenSSL and rebuild Ruby (preferred) or use non-HTTPS sources') end def self.verify_certificate(store_context) depth = store_context.error_depth error = store_context.error_string number = store_context.error cert = store_context.current_cert ui.alert_error "SSL verification error at depth #{depth}: #{error} (#{number})" extra_message = verify_certificate_message number, cert ui.alert_error extra_message if extra_message end def self.verify_certificate_message(error_number, cert) return unless cert case error_number when OpenSSL::X509::V_ERR_CERT_HAS_EXPIRED then "Certificate #{cert.subject} expired at #{cert.not_after.iso8601}" when OpenSSL::X509::V_ERR_CERT_NOT_YET_VALID then "Certificate #{cert.subject} not valid until #{cert.not_before.iso8601}" when OpenSSL::X509::V_ERR_CERT_REJECTED then "Certificate #{cert.subject} is rejected" when OpenSSL::X509::V_ERR_CERT_UNTRUSTED then "Certificate #{cert.subject} is not trusted" when OpenSSL::X509::V_ERR_DEPTH_ZERO_SELF_SIGNED_CERT then "Certificate #{cert.issuer} is not trusted" when OpenSSL::X509::V_ERR_INVALID_CA then "Certificate #{cert.subject} is an invalid CA certificate" when OpenSSL::X509::V_ERR_INVALID_PURPOSE then "Certificate #{cert.subject} has an invalid purpose" when OpenSSL::X509::V_ERR_SELF_SIGNED_CERT_IN_CHAIN then "Root certificate is not trusted (#{cert.subject})" when OpenSSL::X509::V_ERR_UNABLE_TO_GET_ISSUER_CERT_LOCALLY then "You must add #{cert.issuer} to your local trusted store" when OpenSSL::X509::V_ERR_UNABLE_TO_VERIFY_LEAF_SIGNATURE then "Cannot verify certificate issued by #{cert.issuer}" end end ## # Creates or an HTTP connection based on +uri+, or retrieves an existing # connection, using a proxy if needed. def connection_for(uri) @connection_pool.checkout rescue defined?(OpenSSL::SSL) ? OpenSSL::SSL::SSLError : Errno::EHOSTDOWN, Errno::EHOSTDOWN => e raise Gem::RemoteFetcher::FetchError.new(e.message, uri) end def fetch request = @request_class.new @uri.request_uri unless @uri.nil? || @uri.user.nil? || @uri.user.empty? request.basic_auth Gem::UriFormatter.new(@uri.user).unescape, Gem::UriFormatter.new(@uri.password).unescape end request.add_field 'User-Agent', @user_agent request.add_field 'Connection', 'keep-alive' request.add_field 'Keep-Alive', '30' if @last_modified request.add_field 'If-Modified-Since', @last_modified.httpdate end yield request if block_given? perform_request request end ## # Returns a proxy URI for the given +scheme+ if one is set in the # environment variables. def self.get_proxy_from_env(scheme = 'http') _scheme = scheme.downcase _SCHEME = scheme.upcase env_proxy = ENV["#{_scheme}_proxy"] || ENV["#{_SCHEME}_PROXY"] no_env_proxy = env_proxy.nil? || env_proxy.empty? return get_proxy_from_env 'http' if no_env_proxy and _scheme != 'http' return :no_proxy if no_env_proxy uri = URI(Gem::UriFormatter.new(env_proxy).normalize) if uri and uri.user.nil? and uri.password.nil? user = ENV["#{_scheme}_proxy_user"] || ENV["#{_SCHEME}_PROXY_USER"] password = ENV["#{_scheme}_proxy_pass"] || ENV["#{_SCHEME}_PROXY_PASS"] uri.user = Gem::UriFormatter.new(user).escape uri.password = Gem::UriFormatter.new(password).escape end uri end def perform_request(request) # :nodoc: connection = connection_for @uri retried = false bad_response = false begin @requests[connection.object_id] += 1 verbose "#{request.method} #{@uri}" file_name = File.basename(@uri.path) # perform download progress reporter only for gems if request.response_body_permitted? && file_name =~ /\.gem$/ reporter = ui.download_reporter response = connection.request(request) do |incomplete_response| if Net::HTTPOK === incomplete_response reporter.fetch(file_name, incomplete_response.content_length) downloaded = 0 data = String.new incomplete_response.read_body do |segment| data << segment downloaded += segment.length reporter.update(downloaded) end reporter.done if incomplete_response.respond_to? :body= incomplete_response.body = data else incomplete_response.instance_variable_set(:@body, data) end end end else response = connection.request request end verbose "#{response.code} #{response.message}" rescue Net::HTTPBadResponse verbose "bad response" reset connection raise Gem::RemoteFetcher::FetchError.new('too many bad responses', @uri) if bad_response bad_response = true retry rescue Net::HTTPFatalError verbose "fatal error" raise Gem::RemoteFetcher::FetchError.new('fatal error', @uri) # HACK work around EOFError bug in Net::HTTP # NOTE Errno::ECONNABORTED raised a lot on Windows, and make impossible # to install gems. rescue EOFError, Timeout::Error, Errno::ECONNABORTED, Errno::ECONNRESET, Errno::EPIPE requests = @requests[connection.object_id] verbose "connection reset after #{requests} requests, retrying" raise Gem::RemoteFetcher::FetchError.new('too many connection resets', @uri) if retried reset connection retried = true retry end response ensure @connection_pool.checkin connection end ## # Resets HTTP connection +connection+. def reset(connection) @requests.delete connection.object_id connection.finish connection.start end def user_agent ua = "RubyGems/#{Gem::VERSION} #{Gem::Platform.local}".dup ruby_version = RUBY_VERSION ruby_version += 'dev' if RUBY_PATCHLEVEL == -1 ua << " Ruby/#{ruby_version} (#{RUBY_RELEASE_DATE}" if RUBY_PATCHLEVEL >= 0 ua << " patchlevel #{RUBY_PATCHLEVEL}" elsif defined?(RUBY_REVISION) ua << " revision #{RUBY_REVISION}" end ua << ")" ua << " #{RUBY_ENGINE}" if defined?(RUBY_ENGINE) and RUBY_ENGINE != 'ruby' ua end end require 'rubygems/request/http_pool' require 'rubygems/request/https_pool' require 'rubygems/request/connection_pools'
Save