机械化获取"Errno :: ECONNRESET:由对等方重置连接-SSL_connect" [英] Mechanize getting "Errno::ECONNRESET: Connection reset by peer - SSL_connect"

查看:132
本文介绍了机械化获取"Errno :: ECONNRESET:由对等方重置连接-SSL_connect"的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我无法使Mechanize加载以前可以正常工作的页面-可靠地失败,并显示Errno: ECONNRESET: Connection reset by peer - SSL_connect消息.关于我应该尝试什么或应该关注的细节有什么建议吗? (请参阅下面的我尝试过的方法" ...)

I'm unable to get Mechanize to load a page that used to work -- it's reliably failing with a Errno: ECONNRESET: Connection reset by peer - SSL_connect message. Any suggestions as to what I should try or details I should look at? (Please see "what I've tried" below...)

相关的S.O中获得提示.帖子,我尝试使用Net::HTTP直接访问该网站.设置http.ssl_version = :TLSv1时,得到的是重定向而不是错误(应该如此).所以我的问题变成了:如何从Mechanize内部配置Net :: HTTP的基础ssl_version参数?

Taking a hint from a related S.O. post, I tried accessing the site directly with Net::HTTP. When I set http.ssl_version = :TLSv1, I get a redirect rather than an error (as it should be). So my question becomes: how can I configure Net::HTTP's underlying ssl_version parameters from within Mechanize?

谢谢...

$ rails console
>> a = Mechanize.new
=> #<Mechanize:0x007fd26789b8e0 ...>
>> p = a.get("http://sce.com")
# (...after a long pause...)
Errno::ECONNRESET: Connection reset by peer - SSL_connect
from /sandbox/usr/lib/ruby/2.0.0/net/http.rb:918:in `connect'
from /sandbox/usr/lib/ruby/2.0.0/net/http.rb:918:in `block in connect'
from /sandbox/usr/lib/ruby/2.0.0/timeout.rb:52:in `timeout'
from /sandbox/usr/lib/ruby/2.0.0/net/http.rb:918:in `connect'
from /sandbox/usr/lib/ruby/2.0.0/net/http.rb:862:in `do_start'
from /sandbox/usr/lib/ruby/2.0.0/net/http.rb:857:in `start'
from /sandbox/usr/lib/ruby/gems/2.0.0/gems/net-http-persistent-2.9/lib/net/http/persistent.rb:691:in `start'
from /sandbox/usr/lib/ruby/gems/2.0.0/gems/net-http-persistent-2.9/lib/net/http/persistent.rb:631:in `connection_for'
    ...
from /sandbox/usr/lib/ruby/gems/2.0.0/gems/mechanize-2.7.2/lib/mechanize/http/agent.rb:257:in `fetch'
from /sandbox/usr/lib/ruby/gems/2.0.0/gems/mechanize-2.7.2/lib/mechanize/http/agent.rb:974:in `response_redirect'
from /sandbox/usr/lib/ruby/gems/2.0.0/gems/mechanize-2.7.2/lib/mechanize/http/agent.rb:298:in `fetch'
from /sandbox/usr/lib/ruby/gems/2.0.0/gems/mechanize-2.7.2/lib/mechanize.rb:432:in `get'
from (irb):3

环境:

$ rake about
About your application's environment
Ruby version              2.0.0 (x86_64-darwin12.4.0)
RubyGems version          2.1.9
Rack version              1.5
Rails version             4.0.0
JavaScript Runtime        JavaScriptCore
Active Record version     4.0.0
Action Pack version       4.0.0
Action Mailer version     4.0.0
Active Support version    4.0.0
Middleware                ActionDispatch::Static, Rack::Lock, #<ActiveSupport::Cache::Strategy::LocalCache::Middleware:0x007ffd423c50e0>, Rack::Runtime, Rack::MethodOverride, ActionDispatch::RequestId, Rails::Rack::Logger, ActionDispatch::ShowExceptions, ActionDispatch::DebugExceptions, ActionDispatch::RemoteIp, ActionDispatch::Reloader, ActionDispatch::Callbacks, ActiveRecord::Migration::CheckPending, ActiveRecord::ConnectionAdapters::ConnectionManagement, ActiveRecord::QueryCache, ActionDispatch::Cookies, ActionDispatch::Session::CookieStore, ActionDispatch::Flash, ActionDispatch::ParamsParser, Rack::Head, Rack::ConditionalGet, Rack::ETag
Application root          /Users/me/MyProject
Environment               development
Database adapter          postgresql
Database schema version   20131017201057

$ openssl version
OpenSSL 1.0.1e 11 Feb 2013

$ system_profiler -detailLevel mini SPSoftwareDataType

System Software Overview:

  System Version: OS X 10.8.5 (12F45)
  Kernel Version: Darwin 12.5.0
  Time since boot: 8 days 7:40

我尝试过的事情:

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆