data = ""
https.start{|h|
h.get2(url) {|resp|
data = resp.body
}
}
now my question: is it possible to turn https.verify_mode =
OpenSSL::SSL::VERIFY_NONE on for all new Net::HTTP instances? I want to
prevent getting that warning while I run my tests.
> data = ""
> https.start{|h|
> h.get2(url) {|resp|
> data = resp.body
> }
> }
now my question: is it possible to turn https.verify_mode =
OpenSSL::SSL::VERIFY_NONE on for all new Net::HTTP instances? I want to
prevent getting that warning while I run my tests.
thanks, but that just solves the problem if you already have a net/http
instance var, in that case @http.
I need to solve this for all my Net::HTTP instances.
Best, Rob
···
On 4/19/07, celldee <celldee@gmail.com> wrote:
On Apr 19, 10:43 am, "Robert MannI" <rob...@gmail.com> wrote:
> Hi!
>
> In my rails tests, I get the warnings: warning: peer certificate won't
be
> verified in this SSL session
>
> I found this on the ruby list:
>
> Hi,
>
> I've got a little Ruby script that needs to use SSL but doesn't really
> worry about authentication at all. Here's the relevant code:
>
> https = Net::HTTP.new(URL, 443)
> https.use_ssl = true
> data = ""
> https.start{|h|
> h.get2(url) {|resp|
> data = resp.body
> }
> }
>
> When I run this, it works great but gives me (on STDERR):
> peer certificate won't be verified in this SSL session
>
> I don't really care about the verification, so how should I turn this
> warning off or otherwise prevent it from printing?
>
> Thanks,
> Keith
>
> and the response:
>
> > https = Net::HTTP.new(URL, 443)
> > https.use_ssl = true
>
> https.verify_mode = OpenSSL::SSL::VERIFY_NONE
>
> > data = ""
> > https.start{|h|
> > h.get2(url) {|resp|
> > data = resp.body
> > }
> > }
>
> now my question: is it possible to turn https.verify_mode =
> OpenSSL::SSL::VERIFY_NONE on for all new Net::HTTP instances? I want to
> prevent getting that warning while I run my tests.
>
> Thanks, Rob
> Hi Celldee,
>
> thanks, but that just solves the problem if you already have a net/http
> instance var, in that case @http.
>
> I need to solve this for all my Net::HTTP instances.
>
> Best, Rob
>
Firstly:
Q: Why is top-quoting bad?
Secondly:
Subclass Net::HTTP, and enhance the initialize method in your application?
···
A: Because it makes it difficult to associate responses.