红宝石机械化 + https 链接导致 ruby 段错误(安装了 rvm)
我按照指南中指定的说明使用 mechanize,但是当我尝试获取 HTTPS 页面时,出现段错误。
require 'rubygems'
require 'mechanize'
agent = Mechanize.new
ruby-1.9.3-p0 :005 > agent.get("https://google.com")
/Users/wlue/.rvm/gems/ruby-1.9.3-p0/gems/net-http-persistent-2.3.3/lib/net/http/persistent/ssl_reuse.rb:70: [BUG] Segmentation fault
我想知道我的 rvm 是否配置不正确,但我不知道如何测试。我的顶级 .rvmrc 中也有这个,如果这有帮助的话,
export rvm_path="/Users/wlue/.rvm"
我不认为这是一个 ruby bug,因为没有其他人在 https 页面上调用 get 时遇到问题,但我不知道如何来调试这个。
编辑:事实证明它实际上是由与 Rails 的交互引起的。当我直接进入 IRB 时,它工作正常,但 Rails 控制台却不行。
I followed the instructions specified in the GUIDE to use mechanize, but when I try to get an HTTPS page, I get a segfault.
require 'rubygems'
require 'mechanize'
agent = Mechanize.new
ruby-1.9.3-p0 :005 > agent.get("https://google.com")
/Users/wlue/.rvm/gems/ruby-1.9.3-p0/gems/net-http-persistent-2.3.3/lib/net/http/persistent/ssl_reuse.rb:70: [BUG] Segmentation fault
I'm wondering if I have rvm incorrectly configured somehow, but I don't know how to test that. I also have this in my top level .rvmrc, if that helps
export rvm_path="/Users/wlue/.rvm"
I don't think this is a ruby bug, because no one else has had problems with calling get on an https page, but I'm at a loss as to how to debug this.
edit: Turns out it's actually caused by an interaction with Rails. When I go directly to IRB it works fine, but rails console doesn't.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我遇到了这个问题,但现在似乎可以在 ruby 1.9.3p194 中工作
I was having this problem, but it seems to work now in ruby 1.9.3p194