我正在使用chrome.sockets.tcp API来创建安全连接。使用可信证书连接时不会遇到任何错误。
但是,当我尝试连接到具有自签名/不可信证书的服务器时,我将面临错误-202(CERT_AUTHORITY_INVALID)(以及其他可能的[证书错误] [2])。
是否可以警告用户无效证书并提供继续连接的选项? (类似于Chrome处理此类情况的方式)
答案 0 :(得分:1)
在文档(和SocketsTcpSecureFunction::AsyncWorkStart()
,chrome.sockets.tcp.secure
Failure/Error: visit root_url
NoMethodError:
Could not render layout: undefined method `[]' for nil:NilClass
# /home/nick/.rvm/gems/ruby-2.0.0-p598/gems/actionpack-3.2.13/lib/abstract_controller/layouts.rb:408:in `rescue in _default_layout'
# /home/nick/.rvm/gems/ruby-2.0.0-p598/gems/actionpack-3.2.13/lib/abstract_controller/layouts.rb:405:in `_default_layout'
# /home/nick/.rvm/gems/ruby-2.0.0-p598/gems/actionpack-3.2.13/lib/abstract_controller/layouts.rb:383:in `block in _layout_for_option'
# /home/nick/.rvm/gems/ruby-2.0.0-p598/gems/actionpack-3.2.13/lib/action_view/renderer/template_renderer.rb:86:in `call'
# /home/nick/.rvm/gems/ruby-2.0.0-p598/gems/actionpack-3.2.13/lib/action_view/renderer/template_renderer.rb:86:in `resolve_layout'
# /home/nick/.rvm/gems/ruby-2.0.0-p598/gems/actionpack-3.2.13/lib/action_view/renderer/template_renderer.rb:69:in `block in find_layout'
# /home/nick/.rvm/gems/ruby-2.0.0-p598/gems/actionpack-3.2.13/lib/action_view/lookup_context.rb:228:in `with_layout_format'
# /home/nick/.rvm/gems/ruby-2.0.0-p598/gems/actionpack-3.2.13/lib/action_view/renderer/abstract_renderer.rb:3:in `with_layout_format'
# /home/nick/.rvm/gems/ruby-2.0.0-p598/gems/actionpack-3.2.13/lib/action_view/renderer/template_renderer.rb:69:in `find_layout'
# /home/nick/.rvm/gems/ruby-2.0.0-p598/gems/actionpack-3.2.13/lib/action_view/renderer/template_renderer.rb:53:in `render_with_layout'
# /home/nick/.rvm/gems/ruby-2.0.0-p598/gems/actionpack-3.2.13/lib/action_view/renderer/template_renderer.rb:45:in `render_template'
# /home/nick/.rvm/gems/ruby-2.0.0-p598/gems/actionpack-3.2.13/lib/action_view/renderer/template_renderer.rb:18:in `render'
# /home/nick/.rvm/gems/ruby-2.0.0-p598/gems/actionpack-3.2.13/lib/action_view/renderer/renderer.rb:36:in `render_template'
# /home/nick/.rvm/gems/ruby-2.0.0-p598/gems/actionpack-3.2.13/lib/action_view/renderer/renderer.rb:17:in `render'
# /home/nick/.rvm/gems/ruby-2.0.0-p598/gems/actionpack-3.2.13/lib/abstract_controller/rendering.rb:110:in `_render_template'
# /home/nick/.rvm/gems/ruby-2.0.0-p598/gems/actionpack-3.2.13/lib/action_controller/metal/streaming.rb:225:in `_render_template'
# /home/nick/.rvm/gems/ruby-2.0.0-p598/gems/actionpack-3.2.13/lib/abstract_controller/rendering.rb:103:in `render_to_body'
# /home/nick/.rvm/gems/ruby-2.0.0-p598/gems/actionpack-3.2.13/lib/action_controller/metal/renderers.rb:28:in `render_to_body'
# /home/nick/.rvm/gems/ruby-2.0.0-p598/gems/actionpack-3.2.13/lib/action_controller/metal/compatibility.rb:50:in `render_to_body'
# /home/nick/.rvm/gems/ruby-2.0.0-p598/gems/actionpack-3.2.13/lib/abstract_controller/rendering.rb:88:in `render'
# /home/nick/.rvm/gems/ruby-2.0.0-p598/gems/actionpack-3.2.13/lib/action_controller/metal/rendering.rb:16:in `render'
# /home/nick/.rvm/gems/ruby-2.0.0-p598/gems/actionpack-3.2.13/lib/action_controller/metal/instrumentation.rb:40:in `block (2 levels) in render'
# /home/nick/.rvm/gems/ruby-2.0.0-p598/gems/activesupport-3.2.13/lib/active_support/core_ext/benchmark.rb:5:in `block in ms'
# /home/nick/.rvm/gems/ruby-2.0.0-p598/gems/activesupport-3.2.13/lib/active_support/core_ext/benchmark.rb:5:in `ms'
# /home/nick/.rvm/gems/ruby-2.0.0-p598/gems/actionpack-3.2.13/lib/action_controller/metal/instrumentation.rb:40:in `block in render'
# /home/nick/.rvm/gems/ruby-2.0.0-p598/gems/actionpack-3.2.13/lib/action_controller/metal/instrumentation.rb:83:in `cleanup_view_runtime'
# /home/nick/.rvm/gems/ruby-2.0.0-p598/gems/searchkick-0.8.7/lib/searchkick/logging.rb:112:in `cleanup_view_runtime'
# /home/nick/.rvm/gems/ruby-2.0.0-p598/gems/activerecord-3.2.13/lib/active_record/railties/controller_runtime.rb:24:in `cleanup_view_runtime'
# /home/nick/.rvm/gems/ruby-2.0.0-p598/gems/actionpack-3.2.13/lib/action_controller/metal/instrumentation.rb:39:in `render'
# /home/nick/.rvm/gems/ruby-2.0.0-p598/gems/actionpack-3.2.13/lib/action_controller/metal/implicit_render.rb:10:in `default_render'
# /home/nick/.rvm/gems/ruby-2.0.0-p598/gems/actionpack-3.2.13/lib/action_controller/metal/implicit_render.rb:5:in `send_action'
# /home/nick/.rvm/gems/ruby-2.0.0-p598/gems/actionpack-3.2.13/lib/abstract_controller/base.rb:167:in `process_action'
# /home/nick/.rvm/gems/ruby-2.0.0-p598/gems/actionpack-3.2.13/lib/action_controller/metal/rendering.rb:10:in `process_action'
# /home/nick/.rvm/gems/ruby-2.0.0-p598/gems/actionpack-3.2.13/lib/abstract_controller/callbacks.rb:18:in `block in process_action'
# /home/nick/.rvm/gems/ruby-2.0.0-p598/gems/activesupport-3.2.13/lib/active_support/callbacks.rb:458:in `_run__2579600683761487977__process_action__3403611544666025924__callbacks'
# /home/nick/.rvm/gems/ruby-2.0.0-p598/gems/activesupport-3.2.13/lib/active_support/callbacks.rb:405:in `__run_callback'
# /home/nick/.rvm/gems/ruby-2.0.0-p598/gems/activesupport-3.2.13/lib/active_support/callbacks.rb:385:in `_run_process_action_callbacks'
# /home/nick/.rvm/gems/ruby-2.0.0-p598/gems/activesupport-3.2.13/lib/active_support/callbacks.rb:81:in `run_callbacks'
# /home/nick/.rvm/gems/ruby-2.0.0-p598/gems/actionpack-3.2.13/lib/abstract_controller/callbacks.rb:17:in `process_action'
# /home/nick/.rvm/gems/ruby-2.0.0-p598/gems/actionpack-3.2.13/lib/action_controller/metal/rescue.rb:29:in `process_action'
# /home/nick/.rvm/gems/ruby-2.0.0-p598/gems/actionpack-3.2.13/lib/action_controller/metal/instrumentation.rb:30:in `block in process_action'
# /home/nick/.rvm/gems/ruby-2.0.0-p598/gems/activesupport-3.2.13/lib/active_support/notifications.rb:123:in `block in instrument'
# /home/nick/.rvm/gems/ruby-2.0.0-p598/gems/activesupport-3.2.13/lib/active_support/notifications/instrumenter.rb:20:in `instrument'
# /home/nick/.rvm/gems/ruby-2.0.0-p598/gems/activesupport-3.2.13/lib/active_support/notifications.rb:123:in `instrument'
# /home/nick/.rvm/gems/ruby-2.0.0-p598/gems/actionpack-3.2.13/lib/action_controller/metal/instrumentation.rb:29:in `process_action'
# /home/nick/.rvm/gems/ruby-2.0.0-p598/gems/actionpack-3.2.13/lib/action_controller/metal/params_wrapper.rb:207:in `process_action'
# /home/nick/.rvm/gems/ruby-2.0.0-p598/gems/searchkick-0.8.7/lib/searchkick/logging.rb:107:in `process_action'
# /home/nick/.rvm/gems/ruby-2.0.0-p598/gems/activerecord-3.2.13/lib/active_record/railties/controller_runtime.rb:18:in `process_action'
# /home/nick/.rvm/gems/ruby-2.0.0-p598/gems/actionpack-3.2.13/lib/abstract_controller/base.rb:121:in `process'
# /home/nick/.rvm/gems/ruby-2.0.0-p598/gems/actionpack-3.2.13/lib/abstract_controller/rendering.rb:45:in `process'
# /home/nick/.rvm/gems/ruby-2.0.0-p598/gems/actionpack-3.2.13/lib/action_controller/metal.rb:203:in `dispatch'
# /home/nick/.rvm/gems/ruby-2.0.0-p598/gems/actionpack-3.2.13/lib/action_controller/metal/rack_delegation.rb:14:in `dispatch'
# /home/nick/.rvm/gems/ruby-2.0.0-p598/gems/actionpack-3.2.13/lib/action_controller/metal.rb:246:in `block in action'
# /home/nick/.rvm/gems/ruby-2.0.0-p598/gems/actionpack-3.2.13/lib/action_dispatch/routing/route_set.rb:73:in `call'
# /home/nick/.rvm/gems/ruby-2.0.0-p598/gems/actionpack-3.2.13/lib/action_dispatch/routing/route_set.rb:73:in `dispatch'
# /home/nick/.rvm/gems/ruby-2.0.0-p598/gems/actionpack-3.2.13/lib/action_dispatch/routing/route_set.rb:36:in `call'
# /home/nick/.rvm/gems/ruby-2.0.0-p598/gems/journey-1.0.4/lib/journey/router.rb:68:in `block in call'
# /home/nick/.rvm/gems/ruby-2.0.0-p598/gems/journey-1.0.4/lib/journey/router.rb:56:in `each'
# /home/nick/.rvm/gems/ruby-2.0.0-p598/gems/journey-1.0.4/lib/journey/router.rb:56:in `call'
# /home/nick/.rvm/gems/ruby-2.0.0-p598/gems/actionpack-3.2.13/lib/action_dispatch/routing/route_set.rb:612:in `call'
# /home/nick/.rvm/gems/ruby-2.0.0-p598/gems/omniauth-1.2.2/lib/omniauth/strategy.rb:186:in `call!'
# /home/nick/.rvm/gems/ruby-2.0.0-p598/gems/omniauth-1.2.2/lib/omniauth/strategy.rb:164:in `call'
# /home/nick/.rvm/gems/ruby-2.0.0-p598/gems/omniauth-1.2.2/lib/omniauth/builder.rb:59:in `call'
# /home/nick/.rvm/gems/ruby-2.0.0-p598/gems/warden-1.2.3/lib/warden/manager.rb:35:in `block in call'
# /home/nick/.rvm/gems/ruby-2.0.0-p598/gems/warden-1.2.3/lib/warden/manager.rb:34:in `catch'
# /home/nick/.rvm/gems/ruby-2.0.0-p598/gems/warden-1.2.3/lib/warden/manager.rb:34:in `call'
# /home/nick/.rvm/gems/ruby-2.0.0-p598/gems/actionpack-3.2.13/lib/action_dispatch/middleware/best_standards_support.rb:17:in `call'
# /home/nick/.rvm/gems/ruby-2.0.0-p598/gems/rack-1.4.7/lib/rack/etag.rb:23:in `call'
# /home/nick/.rvm/gems/ruby-2.0.0-p598/gems/rack-1.4.7/lib/rack/conditionalget.rb:25:in `call'
# /home/nick/.rvm/gems/ruby-2.0.0-p598/gems/actionpack-3.2.13/lib/action_dispatch/middleware/head.rb:14:in `call'
# /home/nick/.rvm/gems/ruby-2.0.0-p598/gems/actionpack-3.2.13/lib/action_dispatch/middleware/params_parser.rb:21:in `call'
# /home/nick/.rvm/gems/ruby-2.0.0-p598/gems/actionpack-3.2.13/lib/action_dispatch/middleware/flash.rb:242:in `call'
# /home/nick/.rvm/gems/ruby-2.0.0-p598/gems/rack-1.4.7/lib/rack/session/abstract/id.rb:210:in `context'
# /home/nick/.rvm/gems/ruby-2.0.0-p598/gems/rack-1.4.7/lib/rack/session/abstract/id.rb:205:in `call'
# /home/nick/.rvm/gems/ruby-2.0.0-p598/gems/actionpack-3.2.13/lib/action_dispatch/middleware/cookies.rb:341:in `call'
# /home/nick/.rvm/gems/ruby-2.0.0-p598/gems/activerecord-3.2.13/lib/active_record/query_cache.rb:64:in `call'
# /home/nick/.rvm/gems/ruby-2.0.0-p598/gems/activerecord-3.2.13/lib/active_record/connection_adapters/abstract/connection_pool.rb:479:in `call'
# /home/nick/.rvm/gems/ruby-2.0.0-p598/gems/actionpack-3.2.13/lib/action_dispatch/middleware/callbacks.rb:28:in `block in call'
# /home/nick/.rvm/gems/ruby-2.0.0-p598/gems/activesupport-3.2.13/lib/active_support/callbacks.rb:405:in `_run__1697078018072327880__call__1713325954849929917__callbacks'
# /home/nick/.rvm/gems/ruby-2.0.0-p598/gems/activesupport-3.2.13/lib/active_support/callbacks.rb:405:in `__run_callback'
# /home/nick/.rvm/gems/ruby-2.0.0-p598/gems/activesupport-3.2.13/lib/active_support/callbacks.rb:385:in `_run_call_callbacks'
# /home/nick/.rvm/gems/ruby-2.0.0-p598/gems/activesupport-3.2.13/lib/active_support/callbacks.rb:81:in `run_callbacks'
# /home/nick/.rvm/gems/ruby-2.0.0-p598/gems/actionpack-3.2.13/lib/action_dispatch/middleware/callbacks.rb:27:in `call'
# /home/nick/.rvm/gems/ruby-2.0.0-p598/gems/actionpack-3.2.13/lib/action_dispatch/middleware/remote_ip.rb:31:in `call'
# /home/nick/.rvm/gems/ruby-2.0.0-p598/gems/actionpack-3.2.13/lib/action_dispatch/middleware/debug_exceptions.rb:16:in `call'
# /home/nick/.rvm/gems/ruby-2.0.0-p598/gems/actionpack-3.2.13/lib/action_dispatch/middleware/show_exceptions.rb:56:in `call'
# /home/nick/.rvm/gems/ruby-2.0.0-p598/gems/railties-3.2.13/lib/rails/rack/logger.rb:32:in `call_app'
# /home/nick/.rvm/gems/ruby-2.0.0-p598/gems/railties-3.2.13/lib/rails/rack/logger.rb:16:in `block in call'
# /home/nick/.rvm/gems/ruby-2.0.0-p598/gems/activesupport-3.2.13/lib/active_support/tagged_logging.rb:22:in `tagged'
# /home/nick/.rvm/gems/ruby-2.0.0-p598/gems/railties-3.2.13/lib/rails/rack/logger.rb:16:in `call'
# /home/nick/.rvm/gems/ruby-2.0.0-p598/gems/request_store-1.1.0/lib/request_store/middleware.rb:8:in `call'
# /home/nick/.rvm/gems/ruby-2.0.0-p598/gems/actionpack-3.2.13/lib/action_dispatch/middleware/request_id.rb:22:in `call'
# /home/nick/.rvm/gems/ruby-2.0.0-p598/gems/rack-1.4.7/lib/rack/methodoverride.rb:21:in `call'
# /home/nick/.rvm/gems/ruby-2.0.0-p598/gems/rack-1.4.7/lib/rack/runtime.rb:17:in `call'
# /home/nick/.rvm/gems/ruby-2.0.0-p598/gems/activesupport-3.2.13/lib/active_support/cache/strategy/local_cache.rb:72:in `call'
# /home/nick/.rvm/gems/ruby-2.0.0-p598/gems/rack-1.4.7/lib/rack/lock.rb:15:in `call'
# /home/nick/.rvm/gems/ruby-2.0.0-p598/gems/actionpack-3.2.13/lib/action_dispatch/middleware/static.rb:63:in `call'
# /home/nick/.rvm/gems/ruby-2.0.0-p598/gems/railties-3.2.13/lib/rails/engine.rb:479:in `call'
# /home/nick/.rvm/gems/ruby-2.0.0-p598/gems/railties-3.2.13/lib/rails/application.rb:223:in `call'
# /home/nick/.rvm/gems/ruby-2.0.0-p598/gems/rack-1.4.7/lib/rack/builder.rb:134:in `call'
# /home/nick/.rvm/gems/ruby-2.0.0-p598/gems/rack-1.4.7/lib/rack/urlmap.rb:64:in `block in call'
# /home/nick/.rvm/gems/ruby-2.0.0-p598/gems/rack-1.4.7/lib/rack/urlmap.rb:49:in `each'
# /home/nick/.rvm/gems/ruby-2.0.0-p598/gems/rack-1.4.7/lib/rack/urlmap.rb:49:in `call'
# /home/nick/.rvm/gems/ruby-2.0.0-p598/gems/rack-test-0.6.3/lib/rack/mock_session.rb:30:in `request'
# /home/nick/.rvm/gems/ruby-2.0.0-p598/gems/rack-test-0.6.3/lib/rack/test.rb:244:in `process_request'
# /home/nick/.rvm/gems/ruby-2.0.0-p598/gems/rack-test-0.6.3/lib/rack/test.rb:58:in `get'
# /home/nick/.rvm/gems/ruby-2.0.0-p598/gems/capybara-2.4.4/lib/capybara/rack_test/browser.rb:60:in `process'
# /home/nick/.rvm/gems/ruby-2.0.0-p598/gems/capybara-2.4.4/lib/capybara/rack_test/browser.rb:38:in `block in process_and_follow_redirects'
# /home/nick/.rvm/gems/ruby-2.0.0-p598/gems/capybara-2.4.4/lib/capybara/rack_test/browser.rb:37:in `times'
# /home/nick/.rvm/gems/ruby-2.0.0-p598/gems/capybara-2.4.4/lib/capybara/rack_test/browser.rb:37:in `process_and_follow_redirects'
# /home/nick/.rvm/gems/ruby-2.0.0-p598/gems/capybara-2.4.4/lib/capybara/rack_test/browser.rb:21:in `visit'
# /home/nick/.rvm/gems/ruby-2.0.0-p598/gems/capybara-2.4.4/lib/capybara/rack_test/driver.rb:42:in `visit'
# /home/nick/.rvm/gems/ruby-2.0.0-p598/gems/capybara-2.4.4/lib/capybara/session.rb:227:in `visit'
# /home/nick/.rvm/gems/ruby-2.0.0-p598/gems/capybara-2.4.4/lib/capybara/dsl.rb:51:in `block (2 levels) in <module:DSL>'
# ./spec/requests/customers_spec.rb:5:in `block (2 levels) in <top (required)>'
中看不到任何主题,只验证证书但不尝试处理错误,它只会报告他们回来了)我得出结论,没有办法以交互方式处理这种困境。
也许您可以在客户端计算机上导入证书,但它不会帮助网站的其他用户,除非他们愿意这样做。