- xml - AJAX/Jquery XML 解析
- 具有多重继承的 XML 模式
- .net - 枚举序列化 Json 与 XML
- XML 简单类型、简单内容、复杂类型、复杂内容
我正在尝试下载 https://fbcdn-profile-a.akamaihd.net/hprofile-ak-snc4/174043_1701680_6450592_q.jpg使用 ruby,但出现连接重置错误。它在浏览器中可以正常下载,但在 Ruby 中却不行。这是 Ruby 中的错误吗? Facebook 的错误?
这适用于大多数其他 Facebook 用户。我使用的是 Ruby 1.8.7 和 Rails 2.3.11。
>> http = Net::HTTP.new("graph.facebook.com", Net::HTTP.https_default_port)
=> #<Net::HTTP graph.facebook.com:443 open=false>
>> http.use_ssl = true
=> true
>> http.start do |http|
?> response = Net::HTTP.get_response(URI.parse('https://fbcdn-profile-a.akamaihd.net/hprofile-ak-snc4/174043_1701680_6450592_q.jpg'))
>> end
warning: peer certificate won't be verified in this SSL session
Errno::ECONNRESET: An existing connection was forcibly closed by the remote host.
from c:/Ruby187/lib/ruby/1.8/net/protocol.rb:135:in `sysread'
from c:/Ruby187/lib/ruby/1.8/net/protocol.rb:135:in `rbuf_fill'
from c:/Ruby187/lib/ruby/1.8/timeout.rb:67:in `timeout'
from c:/Ruby187/lib/ruby/1.8/timeout.rb:101:in `timeout'
from c:/Ruby187/lib/ruby/1.8/net/protocol.rb:134:in `rbuf_fill'
from c:/Ruby187/lib/ruby/1.8/net/protocol.rb:116:in `readuntil'
from c:/Ruby187/lib/ruby/1.8/net/protocol.rb:126:in `readline'
from c:/Ruby187/lib/ruby/1.8/net/http.rb:2028:in `read_status_line'
from c:/Ruby187/lib/ruby/1.8/net/http.rb:2017:in `read_new'
from c:/Ruby187/lib/ruby/1.8/net/http.rb:1051:in `request'
from c:/Ruby187/lib/ruby/1.8/net/http.rb:948:in `request_get'
from c:/Ruby187/lib/ruby/1.8/net/http.rb:380:in `get_response'
from c:/Ruby187/lib/ruby/1.8/net/http.rb:543:in `start'
from c:/Ruby187/lib/ruby/1.8/net/http.rb:379:in `get_response'
from (irb):5
from c:/Ruby187/lib/ruby/1.8/net/http.rb:543:in `start'
from (irb):4>>
最佳答案
这是一个稍微修改过的版本...
require 'uri'
require 'net/https'
url = URI.parse 'https://fbcdn-profile-a.akamaihd.net/hprofile-ak-snc4/174043_1701680_6450592_q.jpg'
http = Net::HTTP.new url.host, url.port
http.verify_mode = OpenSSL::SSL::VERIFY_NONE
http.use_ssl = true
http.start do |agent|
p agent.get(url.path).read_body.length
end
然后……
so ross$ ruby fbi 1974
关于ruby-on-rails - ruby 网 :HTTP SSL bug or is it me?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5721535/
我正在寻找的服务器是: 轻量级, 非 buggy , 支持.NET, 在客户端上运行以进行测试, 在Windows上运行 Cassinni太过马车,IIS太昂贵,Apache很难安装,XSP仅是lin
所以我有大约10个短的css文件,可以与mvc应用程序一起使用。 有像 error.css login.css 等等... 仅有一些非常短的CSS文件,这些文件使更新和编辑变得容易(至少对我而言)。我
我正在编写程序来自动化 win32 表单。我正在使用 Microsoft UI 自动化库。我不知道如何获取和调用该表单上的预定义快捷键。现在我只需获取 MenuItem 的 AutomationEle
我有一个在后台线程上运行的及时操作。运行时,我当前将光标置于等待状态: Mouse.OverrideCursor = Cursors.Wait 我刚刚实现了一项功能,允许用户在厌倦等待时单击“取消”按
如何找到所有可能直接或间接调用给定方法的单元测试?当我更改方法时,我希望知道要运行的最佳测试;必须有一个工具! 因为我们有很多接口(interface),所以我对所有调用接口(interface)方法
我想知道,一个类会被装箱吗?我一直假设每个类都有一个虚拟表,可以用来标识类,所以它需要装箱吗? 最佳答案 只有值类型(结构)被装箱。类实例不会被装箱。 关于.net - 类是盒装的吗? 。网,我们在S
所以接下来有一个按钮调用(页面)。它的 href 链接是 site/blah/#。所以我知道它真正运行的 javascript 代码。在我解析完第一页后,我想解析下一页。我如何模拟鼠标点击,以便我可以
我想知道是否有人对解决以下设计问题有好的建议/模式。我有一个命令类的层次结构。在最抽象的层面上,我有一个 ICommand 接口(interface)。执行 ICommand 的 RunCommand
我在资源(xsd 文件)中有几个文件可用于验证收到的 xml 消息。我使用的资源文件名为 AppResources.resx,它包含一个名为 clientModels.xsd 的文件。当我尝试使用这样
关闭。这个问题不符合Stack Overflow guidelines .它目前不接受答案。 要求提供代码的问题必须表现出对所解决问题的最低限度理解。包括尝试过的解决方案、为什么它们不起作用,以及预
(最后的简短版本) 我目前正在开发的软件需要跟踪任意数量的 MS Office 文件,现在需要提供将所有这些文件一起打印的功能,以及一些应用程序数据(可能会发送到打印机作为 .xps、.html 或
我想在不指定命名空间或程序集的情况下按名称(字符串)实例化一个类。像这样(Unity 语法): var processor = container.Resolve("SpecialProcessor"
我有一些代码可以对 64 位整数进行大量比较,但是它必须考虑数字的长度,就好像它被格式化为字符串一样。我无法更改调用代码,只能更改函数。 最简单的方法(除了 .ToString().Length 之外
使用遗留代码,我发现我有很多这样的语句(超过 500 个) bool isAEqualsB = (a == b) ? true : false; 这样重写有意义吗? bool isAEqualsB =
我有这个: AudioPlayer player = new AudioPlayer(); player.Directory = vc.Directory; player.StartTime = vc
我已经阅读了很多关于双重检查锁定的危险的文章,我会努力远离它,但话虽如此,我认为他们的阅读非常有趣。 我正在阅读 Joe Duffy 的这篇关于使用双重检查锁定实现单例的文章: http://www.
对于可变类型,值类型和引用类型之间的行为差异很明显: // Mutable value type PointMutStruct pms1 = new PointMutStruct(1, 2); P
关闭。这个问题需要更多 focused .它目前不接受答案。 想要改进这个问题吗? 更新问题,使其只关注一个问题 editing this post . 关闭 6 年前。 Improve this q
我有一个 Cordova pp 我在 Controller 中调用post方法 它可以在浏览器中工作,但是在构建和调试apk时出现错误 ionic.bundle.js:23826 POST http:
我们正在尝试将时间戳附加到某些 URL 以让内容缓存但在它们发生更改时更新它们。我们有代码可以归结为: DateTime ts = File.GetLastWriteTime(absPath); 其中
我是一名优秀的程序员,十分优秀!