使用 Shoes 并通过 https 下载会出现 ssl 错误

发布于 2024-07-10 05:48:18 字数 986 浏览 6 评论 0原文

在鞋子应用程序中,我尝试从一些内部网站下载东西。 我收到此错误

Error in /tmp/selfgz14214/ruby/lib/net/protocol.rb line 66
undefined method 'closed?' for #<OpenSSL::SSL::SSLSocket:0xb6af94f0>

我收到此代码的上述错误。 如果从 Shoes 使用,则会出现上述错误。

require 'net/http'
require 'net/https'
require 'rexml/document'

class Blogs
  attr_reader :Connection

  def initialize
    @Connection = Net::HTTP::new("someInternalWebSite", 443)
    @Connection.use_ssl = true
  end

  def get_blogs
    doc = REXML::Document.new @Connection.get('/weblogs/feed/entries/atom').body
    blogs = Array.new
    # ----- some crap to parse the blogs
    return blogs
  end

end

请注意,只有从鞋内跑步时才会出现此问题。

此外,在鞋子中使用内置的下载方法,它不会返回,甚至不会引发启动事件。 以下是该操作的代码

download "https://internalWebsite/weblogs/feed/entries/atom",
:start => lambda {
  alert "hello"
},
:progress => lambda {
  alert "progress"
},
:finish => lambda {
  alert "finish"
}

In a shoes application am trying to download stuff from some internal websites. I get this error

Error in /tmp/selfgz14214/ruby/lib/net/protocol.rb line 66
undefined method 'closed?' for #<OpenSSL::SSL::SSLSocket:0xb6af94f0>

I got the above error for this code. This give the above error if used from Shoes.

require 'net/http'
require 'net/https'
require 'rexml/document'

class Blogs
  attr_reader :Connection

  def initialize
    @Connection = Net::HTTP::new("someInternalWebSite", 443)
    @Connection.use_ssl = true
  end

  def get_blogs
    doc = REXML::Document.new @Connection.get('/weblogs/feed/entries/atom').body
    blogs = Array.new
    # ----- some crap to parse the blogs
    return blogs
  end

end

Note this problem only happens when run from inside shoes.

Also using the inbuilt download method in shoes it doesn't return, not even start event gets raised. The following is the code for that

download "https://internalWebsite/weblogs/feed/entries/atom",
:start => lambda {
  alert "hello"
},
:progress => lambda {
  alert "progress"
},
:finish => lambda {
  alert "finish"
}

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

帅的被狗咬 2024-07-17 05:48:18

我没有使用过(或者确实听说过)鞋子,但是当我在 Ruby 中通过 HTTPS 访问内容时遇到问题,通常是因为没有正确设置证书。

我的经验是几年前的事了,但可能值得做一些实验来检查您是否确实可以使用该代码建立常规的 SSL 连接。 我希望您至少需要告诉它在哪里可以找到客户端证书,或者它根本不需要客户端证书。

我还记得我需要使用 http-access2 而不是常规的 http 库。

正如我所说,我确信自从我尝试这样做以来事情已经发生了变化,但我发现的大多数与 ssl 连接相关的问题都与证书相关。

I haven't worked with ( or indeed heard of ) shoes, but when I have had problems with accessing stuff over HTTPS in Ruby it has often been a case of not having the certificate set up properly.

My experience with this was a couple of years ago now but it may be worth doing a bit of experimentation just to check that you can actually make a regular SSL connection with that code. I would expect that you would at least need to tell it where to find the client certificate or that it doesn't need a client certificate at all.

I also recall that I needed to use http-access2 rather than the regular http library.

As I say, I'm sure things have moved on since I was trying to do this, but most of the problems I found relating to ssl connections were certificate related.

等往事风中吹 2024-07-17 05:48:18

Shoes 当前版本不支持 HTTPS。

Shoes doesn't support HTTPS in the current version.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文