如何解决RestClient.get仅在Rails控制台内引发SSLCertificateNotVerified
最近,我正在处理的项目中发生了一些更改,使得我在使用RestClient时无法向https://
网站发送请求。
当我运行bundle exec rails console
并尝试进行RestClient.get("https://www.google.com")
时,我得到了RestClient::SSLCertificateNotVerified
。我也尝试使用HTTParty和Faraday。两者都返回类似的错误。
但是,当我使用来自RVM的相同的ruby / gemset二进制文件运行irb
并调用RestClient.get("https://www.google.com")
时,它将返回HTTP 200。
在两种情况下,使用Net::HTTP
均可。这使我相信这是由Gemfile中安装的一些gem引起的问题。这是当前的Gemfile.lock。
GEM
remote: https://rubygems.org/
specs:
actioncable (5.2.4.3)
actionpack (= 5.2.4.3)
nio4r (~> 2.0)
websocket-driver (>= 0.6.1)
actionmailer (5.2.4.3)
actionpack (= 5.2.4.3)
actionview (= 5.2.4.3)
activejob (= 5.2.4.3)
mail (~> 2.5,>= 2.5.4)
rails-dom-testing (~> 2.0)
actionpack (5.2.4.3)
actionview (= 5.2.4.3)
activesupport (= 5.2.4.3)
rack (~> 2.0,>= 2.0.8)
rack-test (>= 0.6.3)
rails-dom-testing (~> 2.0)
rails-html-sanitizer (~> 1.0,>= 1.0.2)
actionpack-action_caching (1.2.1)
actionpack (>= 4.0.0)
actionview (5.2.4.3)
activesupport (= 5.2.4.3)
builder (~> 3.1)
erubi (~> 1.4)
rails-dom-testing (~> 2.0)
rails-html-sanitizer (~> 1.0,>= 1.0.3)
activejob (5.2.4.3)
activesupport (= 5.2.4.3)
globalid (>= 0.3.6)
activemodel (5.2.4.3)
activesupport (= 5.2.4.3)
activemodel-serializers-xml (1.0.2)
activemodel (> 5.x)
activesupport (> 5.x)
builder (~> 3.1)
activerecord (5.2.4.3)
activemodel (= 5.2.4.3)
activesupport (= 5.2.4.3)
arel (>= 9.0)
activestorage (5.2.4.3)
actionpack (= 5.2.4.3)
activerecord (= 5.2.4.3)
marcel (~> 0.3.1)
activesupport (5.2.4.3)
concurrent-ruby (~> 1.0,>= 1.0.2)
i18n (>= 0.7,< 2)
minitest (~> 5.1)
tzinfo (~> 1.1)
addressable (2.6.0)
public_suffix (>= 2.0.2,< 4.0)
arel (9.0.0)
ast (2.4.0)
aws-eventstream (1.0.3)
aws-partitions (1.236.0)
aws-sdk-core (3.76.0)
aws-eventstream (~> 1.0,>= 1.0.2)
aws-partitions (~> 1,>= 1.228.0)
aws-sigv4 (~> 1.1)
jmespath (~> 1.0)
aws-sdk-rails (2.1.0)
aws-sdk-ses (~> 1)
railties (>= 3)
aws-sdk-ses (1.27.0)
aws-sdk-core (~> 3,>= 3.71.0)
aws-sigv4 (~> 1.1)
aws-sigv4 (1.1.0)
aws-eventstream (~> 1.0,>= 1.0.2)
axiom-types (0.1.1)
descendants_tracker (~> 0.0.4)
ice_nine (~> 0.11.0)
thread_safe (~> 0.3,>= 0.3.1)
backport (1.1.1)
bcrypt (3.1.13)
bindex (0.8.1)
bootsnap (1.4.7)
msgpack (~> 1.0)
browser (2.6.0)
builder (3.2.4)
byebug (11.0.1)
capybara (2.18.0)
addressable
mini_mime (>= 0.1.3)
nokogiri (>= 1.3.3)
rack (>= 1.0.0)
rack-test (>= 0.5.4)
xpath (>= 2.0,< 4.0)
cf-autoconfig (0.2.1)
cf-runtime (= 0.2.0)
cf-runtime (0.2.0)
childprocess (1.0.1)
rake (< 13.0)
choice (0.2.0)
coderay (1.1.2)
coercible (1.0.0)
descendants_tracker (~> 0.0.1)
coffee-rails (4.2.2)
coffee-script (>= 2.2.0)
railties (>= 4.0.0)
coffee-script (2.4.1)
coffee-script-source
execjs
coffee-script-source (1.12.2)
concurrent-ruby (1.1.6)
connection_pool (2.2.2)
consistency_fail (0.3.7)
crack (0.4.3)
safe_yaml (~> 1.0.0)
crass (1.0.6)
database_cleaner (1.7.0)
declarative (0.0.20)
declarative-option (0.1.0)
descendants_tracker (0.0.4)
thread_safe (~> 0.3,>= 0.3.1)
devise (4.6.2)
bcrypt (~> 3.0)
orm_adapter (~> 0.1)
railties (>= 4.1.0,< 6.0)
responders
warden (~> 1.2.3)
diff-lcs (1.3)
digest-crc (0.6.0)
discard (1.1.0)
activerecord (>= 4.2,< 7)
docile (1.3.2)
domain_name (0.5.20190701)
unf (>= 0.0.5,< 1.0.0)
dotenv (2.7.5)
dotenv-rails (2.7.5)
dotenv (= 2.7.5)
railties (>= 3.2,< 6.1)
equalizer (0.0.11)
erubi (1.9.0)
et-orbi (1.2.2)
tzinfo
execjs (2.7.0)
factory_bot (5.0.2)
activesupport (>= 4.2.0)
factory_bot_rails (5.0.2)
factory_bot (~> 5.0.2)
railties (>= 4.2.0)
faker (1.9.6)
i18n (>= 0.7)
faraday (0.15.4)
multipart-post (>= 1.2,< 3)
ffi (1.11.1)
firebase (0.2.8)
googleauth
httpclient (>= 2.5.3)
json
formatador (0.2.5)
fugit (1.3.3)
et-orbi (~> 1.1,>= 1.1.8)
raabro (~> 1.1)
globalid (0.4.2)
activesupport (>= 4.2.0)
google-api-client (0.32.1)
addressable (~> 2.5,>= 2.5.1)
googleauth (>= 0.5,< 0.10.0)
httpclient (>= 2.8.1,< 3.0)
mini_mime (~> 1.0)
representable (~> 3.0)
retriable (>= 2.0,< 4.0)
signet (~> 0.10)
google-cloud-core (1.5.0)
google-cloud-env (~> 1.0)
google-cloud-errors (~> 1.0)
google-cloud-env (1.3.0)
faraday (~> 0.11)
google-cloud-errors (1.0.1)
google-cloud-storage (1.21.1)
addressable (~> 2.5)
digest-crc (~> 0.4)
google-api-client (~> 0.26)
google-cloud-core (~> 1.2)
googleauth (>= 0.6.2,< 0.10.0)
mini_mime (~> 1.0)
googleauth (0.8.1)
faraday (~> 0.12)
jwt (>= 1.4,< 3.0)
memoist (~> 0.16)
multi_json (~> 1.11)
os (>= 0.9,< 2.0)
signet (~> 0.7)
guard (2.15.0)
formatador (>= 0.2.4)
listen (>= 2.7,< 4.0)
lumberjack (>= 1.0.12,< 2.0)
nenv (~> 0.1)
notiffany (~> 0.0)
pry (>= 0.9.12)
shellany (~> 0.0)
thor (>= 0.18.1)
guard-compat (1.2.1)
guard-rspec (4.7.3)
guard (~> 2.1)
guard-compat (~> 1.1)
rspec (>= 2.99.0,< 4.0)
haml (5.1.2)
temple (>= 0.8.0)
tilt
hashdiff (1.0.0)
htmlentities (4.3.4)
http-cookie (1.0.3)
domain_name (~> 0.5)
httparty (0.18.1)
mime-types (~> 3.0)
multi_xml (>= 0.5.2)
httpclient (2.8.3)
i18n (1.8.5)
concurrent-ruby (~> 1.0)
ice_nine (0.11.2)
inflecto (0.0.2)
iugu (1.0.8)
rest-client
jaro_winkler (1.5.3)
jbuilder (2.9.1)
activesupport (>= 4.2.0)
jmespath (1.4.0)
jquery-rails (4.3.5)
rails-dom-testing (>= 1,< 3)
railties (>= 4.2.0)
thor (>= 0.14,< 2.0)
jquery-ui-rails (6.0.1)
railties (>= 3.2.16)
json (2.2.0)
json_matchers (0.11.1)
json_schema
json_schema (0.20.8)
jwt (2.2.1)
kaminari (1.1.1)
activesupport (>= 4.1.0)
kaminari-actionview (= 1.1.1)
kaminari-activerecord (= 1.1.1)
kaminari-core (= 1.1.1)
kaminari-actionview (1.1.1)
actionview
kaminari-core (= 1.1.1)
kaminari-activerecord (1.1.1)
activerecord
kaminari-core (= 1.1.1)
kaminari-core (1.1.1)
konduto-ruby (2.1.0)
kramdown (1.17.0)
listen (3.1.5)
rb-fsevent (~> 0.9,>= 0.9.4)
rb-inotify (~> 0.9,>= 0.9.7)
ruby_dep (~> 1.2)
loofah (2.6.0)
crass (~> 1.0.2)
nokogiri (>= 1.5.9)
lumberjack (1.0.13)
mail (2.7.1)
mini_mime (>= 0.1.1)
marcel (0.3.3)
mimemagic (~> 0.3.2)
memoist (0.16.0)
method_source (0.9.2)
mime-types (3.2.2)
mime-types-data (~> 3.2015)
mime-types-data (3.2019.0331)
mimemagic (0.3.5)
mini_mime (1.0.2)
mini_portile2 (2.4.0)
minitest (5.14.1)
minitest-ci (3.4.0)
minitest (>= 5.0.6)
monetize (1.9.4)
money (~> 6.12)
money (6.13.7)
i18n (>= 0.6.4,<= 2)
money-rails (1.13.3)
activesupport (>= 3.0)
monetize (~> 1.9.0)
money (~> 6.13.2)
railties (>= 3.0)
msgpack (1.3.3)
multi_json (1.13.1)
multi_xml (0.6.0)
multipart-post (2.1.1)
nenv (0.3.0)
nested_form (0.3.2)
netrc (0.11.0)
newrelic_rpm (6.5.0.357)
nio4r (2.5.2)
nokogiri (1.10.10)
mini_portile2 (~> 2.4.0)
notiffany (0.1.1)
nenv (~> 0.1)
shellany (~> 0.0)
orm_adapter (0.5.0)
os (1.0.1)
parallel (1.17.0)
parser (2.6.3.0)
ast (~> 2.4.0)
pg (0.21.0)
pry (0.12.2)
coderay (~> 1.1.0)
method_source (~> 0.9.0)
public_suffix (3.1.1)
puma (3.12.1)
raabro (1.1.6)
rack (2.2.3)
rack-cors (1.1.1)
rack (>= 2.0.0)
rack-pjax (1.1.0)
nokogiri (~> 1.5)
rack (>= 1.1)
rack-protection (2.0.8.1)
rack
rack-test (1.1.0)
rack (>= 1.0,< 3)
rails (5.2.4.3)
actioncable (= 5.2.4.3)
actionmailer (= 5.2.4.3)
actionpack (= 5.2.4.3)
actionview (= 5.2.4.3)
activejob (= 5.2.4.3)
activemodel (= 5.2.4.3)
activerecord (= 5.2.4.3)
activestorage (= 5.2.4.3)
activesupport (= 5.2.4.3)
bundler (>= 1.3.0)
railties (= 5.2.4.3)
sprockets-rails (>= 2.0.0)
rails-controller-testing (1.0.4)
actionpack (>= 5.0.1.x)
actionview (>= 5.0.1.x)
activesupport (>= 5.0.1.x)
rails-dom-testing (2.0.3)
activesupport (>= 4.2.0)
nokogiri (>= 1.6)
rails-erd (1.6.0)
activerecord (>= 4.2)
activesupport (>= 4.2)
choice (~> 0.2.0)
ruby-graphviz (~> 1.2)
rails-html-sanitizer (1.3.0)
loofah (~> 2.3)
rails_12factor (0.0.3)
rails_serve_static_assets
rails_stdout_logging
rails_admin (2.0.1)
activemodel-serializers-xml (>= 1.0)
builder (~> 3.1)
haml (>= 4.0,< 6)
jquery-rails (>= 3.0,< 5)
jquery-ui-rails (>= 5.0,< 7)
kaminari (>= 0.14,< 2.0)
nested_form (~> 0.3)
rack-pjax (>= 0.7)
rails (>= 5.0,< 7)
remotipart (~> 1.3)
sassc-rails (>= 1.3,< 3)
rails_serve_static_assets (0.0.5)
rails_stdout_logging (0.0.5)
railties (5.2.4.3)
actionpack (= 5.2.4.3)
activesupport (= 5.2.4.3)
method_source
rake (>= 0.8.7)
thor (>= 0.19.0,< 2.0)
rainbow (3.0.0)
rake (12.3.3)
rb-fsevent (0.10.3)
rb-inotify (0.10.0)
ffi (~> 1.0)
redis (4.1.3)
remotipart (1.4.4)
representable (3.0.4)
declarative (< 0.1.0)
declarative-option (< 0.2.0)
uber (< 0.2.0)
responders (3.0.0)
actionpack (>= 5.0)
railties (>= 5.0)
rest-client (2.0.2)
http-cookie (>= 1.0.2,< 2.0)
mime-types (>= 1.16,< 4.0)
netrc (~> 0.8)
retriable (3.1.2)
reverse_markdown (1.1.0)
nokogiri
rspec (3.8.0)
rspec-core (~> 3.8.0)
rspec-expectations (~> 3.8.0)
rspec-mocks (~> 3.8.0)
rspec-core (3.8.2)
rspec-support (~> 3.8.0)
rspec-expectations (3.8.4)
diff-lcs (>= 1.2.0,< 2.0)
rspec-support (~> 3.8.0)
rspec-mocks (3.8.1)
diff-lcs (>= 1.2.0,< 2.0)
rspec-support (~> 3.8.0)
rspec-rails (3.8.2)
actionpack (>= 3.0)
activesupport (>= 3.0)
railties (>= 3.0)
rspec-core (~> 3.8.0)
rspec-expectations (~> 3.8.0)
rspec-mocks (~> 3.8.0)
rspec-support (~> 3.8.0)
rspec-support (3.8.2)
rspec_junit_formatter (0.4.1)
rspec-core (>= 2,< 4,!= 2.12.0)
rubocop (0.72.0)
jaro_winkler (~> 1.5.1)
parallel (~> 1.10)
parser (>= 2.6)
rainbow (>= 2.2.2,< 4.0)
ruby-progressbar (~> 1.7)
unicode-display_width (>= 1.4.0,< 1.7)
rubocop-rspec (1.33.0)
rubocop (>= 0.60.0)
ruby-graphviz (1.2.4)
ruby-progressbar (1.10.1)
ruby_dep (1.5.0)
rubyzip (1.2.3)
safe_yaml (1.0.5)
sass (3.7.4)
sass-listen (~> 4.0.0)
sass-listen (4.0.0)
rb-fsevent (~> 0.9,>= 0.9.7)
sass-rails (5.0.7)
railties (>= 4.0.0,< 6)
sass (~> 3.1)
sprockets (>= 2.8,< 4.0)
sprockets-rails (>= 2.0,< 4.0)
tilt (>= 1.1,< 3)
sassc (2.2.1)
ffi (~> 1.9)
sassc-rails (2.1.2)
railties (>= 4.0.0)
sassc (>= 2.0)
sprockets (> 3.0)
sprockets-rails
tilt
selenium-webdriver (3.142.3)
childprocess (>= 0.5,< 2.0)
rubyzip (~> 1.2,>= 1.2.2)
sentry-raven (2.9.0)
faraday (>= 0.7.6,< 1.0)
shellany (0.0.1)
shoulda-matchers (4.1.0)
activesupport (>= 4.2.0)
sidekiq (6.0.4)
connection_pool (>= 2.2.2)
rack (>= 2.0.0)
rack-protection (>= 2.0.0)
redis (>= 4.1.0)
sidekiq-cron (1.1.0)
fugit (~> 1.1)
sidekiq (>= 4.2.1)
signet (0.11.0)
addressable (~> 2.3)
faraday (~> 0.9)
jwt (>= 1.5,< 3.0)
multi_json (~> 1.10)
simple_command (0.1.0)
simple_form (4.1.0)
actionpack (>= 5.0)
activemodel (>= 5.0)
simplecov (0.17.0)
docile (~> 1.1)
json (>= 1.8,< 3)
simplecov-html (~> 0.10.0)
simplecov-html (0.10.2)
social-share-button (1.2.1)
coffee-rails
solargraph (0.34.3)
backport (~> 1.1)
bundler (>= 1.17.2)
htmlentities (~> 4.3,>= 4.3.4)
jaro_winkler (~> 1.5)
kramdown (~> 1.16)
parser (~> 2.3)
reverse_markdown (~> 1.0,>= 1.0.5)
rubocop (~> 0.52)
thor (~> 0.19,>= 0.19.4)
tilt (~> 2.0)
yard (~> 0.9)
spring (2.1.0)
spring-watcher-listen (2.0.1)
listen (>= 2.7,< 4.0)
spring (>= 1.2,< 3.0)
sprockets (3.7.2)
concurrent-ruby (~> 1.0)
rack (> 1,< 3)
sprockets-rails (3.2.1)
actionpack (>= 4.0)
activesupport (>= 4.0)
sprockets (>= 3.0.0)
telegram-bot-ruby (0.12.0)
faraday
inflecto
virtus
temple (0.8.2)
thor (0.20.3)
thread_safe (0.3.6)
tilt (2.0.9)
timecop (0.9.1)
tzinfo (1.2.7)
thread_safe (~> 0.1)
uber (0.1.0)
uglifier (4.1.20)
execjs (>= 0.3.0,< 3)
unf (0.1.4)
unf_ext
unf_ext (0.0.7.6)
unicode-display_width (1.6.0)
vcr (5.0.0)
virtus (1.0.5)
axiom-types (~> 0.1)
coercible (~> 1.0)
descendants_tracker (~> 0.0,>= 0.0.3)
equalizer (~> 0.0,>= 0.0.9)
warden (1.2.8)
rack (>= 2.0.6)
web-console (3.7.0)
actionview (>= 5.0)
activemodel (>= 5.0)
bindex (>= 0.4.0)
railties (>= 5.0)
webmock (3.6.0)
addressable (>= 2.3.6)
crack (>= 0.3.2)
hashdiff (>= 0.4.0,< 2.0.0)
websocket-driver (0.7.3)
websocket-extensions (>= 0.1.0)
websocket-extensions (0.1.5)
xpath (3.2.0)
nokogiri (~> 1.8)
yard (0.9.20)
PLATFORMS
ruby
DEPENDENCIES
actionpack-action_caching
aws-sdk-rails
bcrypt (~> 3.1.7)
bootsnap (~> 1.4,>= 1.4.7)
browser
byebug
capybara (~> 2.13)
cf-autoconfig (= 0.2.1)
coffee-rails (~> 4.2)
consistency_fail
database_cleaner
devise
discard (~> 1.1)
dotenv-rails (~> 2.7,>= 2.7.5)
factory_bot_rails
faker
firebase
google-cloud-storage (~> 1.11)
guard-rspec
httparty (~> 0.18.1)
iugu
jbuilder (~> 2.5)
json_matchers
jwt
kaminari
konduto-ruby
listen (>= 3.0.5,< 3.2)
minitest-ci
money-rails (~> 1.12)
newrelic_rpm
pg (~> 0.18)
puma (~> 3.7)
rack-cors
rails (~> 5.2)
rails-controller-testing
rails-erd
rails_12factor
rails_admin (~> 2.0)
rest-client
rspec-rails (~> 3.7)
rspec_junit_formatter
rubocop
rubocop-rspec
sass-rails (~> 5.0)
selenium-webdriver
sentry-raven (~> 2.9)
shoulda-matchers
sidekiq
sidekiq-cron (~> 1.1)
simple_command
simple_form
simplecov
social-share-button
solargraph
spring
spring-watcher-listen (~> 2.0.0)
telegram-bot-ruby (~> 0.12.0)
timecop (~> 0.9.1)
tzinfo-data
uglifier (>= 1.3.0)
vcr
web-console (>= 3.3.0)
webmock
RUBY VERSION
ruby 2.6.2p47
BUNDLED WITH
1.17.3
重要,我不想使用verify_ssl: false
。
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。