Paulo Castro
2013-Aug-29 12:33 UTC
Weird behaviour using ssl connection (OpenSSL::SSL::SSLError)
Hi guys when I execute the piece of code bellow on RoR console it works fine: url = URI.parse("https://us1.api.mailchimp.com/2.0/helper/ping") request = Net::HTTP::Post.new(url.path) http = Net::HTTP.new(url.host, url.port) http.use_ssl = true http.verify_mode = OpenSSL::SSL::VERIFY_NONE request.body = "{\"apikey\": \"myapikey\"}" response = http.start {|http| http.request(request) } But when I try to use it on my RoR app I get the following error: OpenSSL::SSL::SSLError (SSL_connect returned=1 errno=0 state=unknown state: sslv3 alert handshake failure) Someone know what could be happening? Thank you all in advance! Best regards Paulo -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/b7472c6fe9b75962b1a1982bc035643f%40ruby-forum.com. For more options, visit https://groups.google.com/groups/opt_out.
Paulo Castro
2013-Aug-30 13:40 UTC
Re: Weird behaviour using ssl connection (OpenSSL::SSL::SSLError)
I mean, when I execute the code bellow from web browser.. I''m using apache+phusionpassenger Please, anyone has any idea? I couldn''t find anything to help yet!! Thank you all in advance! Paulo Castro wrote in post #1119935:> Hi guys > > when I execute the piece of code bellow on RoR console it works fine: > > url = URI.parse("https://us1.api.mailchimp.com/2.0/helper/ping") > request = Net::HTTP::Post.new(url.path) > http = Net::HTTP.new(url.host, url.port) > http.use_ssl = true > http.verify_mode = OpenSSL::SSL::VERIFY_NONE > request.body = "{\"apikey\": \"myapikey\"}" > > response = http.start {|http| http.request(request) } > > > But when I try to use it on my RoR app I get the following error: > > OpenSSL::SSL::SSLError (SSL_connect returned=1 errno=0 state=unknown > state: sslv3 alert handshake failure) > > Someone know what could be happening? > > Thank you all in advance! > > Best regards > > Paulo-- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/cb5e7be2093001259cb7970923515a06%40ruby-forum.com. For more options, visit https://groups.google.com/groups/opt_out.
Colin Law
2013-Aug-30 13:46 UTC
Re: Re: Weird behaviour using ssl connection (OpenSSL::SSL::SSLError)
On 30 August 2013 14:40, Paulo Castro <lists-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org> wrote:> I mean, when I execute the code bellow from web browser..How are you executing it from a browser? Colin> I''m using apache+phusionpassenger > > Please, anyone has any idea? I couldn''t find anything to help yet!! > > Thank you all in advance! > > > > Paulo Castro wrote in post #1119935: >> Hi guys >> >> when I execute the piece of code bellow on RoR console it works fine: >> >> url = URI.parse("https://us1.api.mailchimp.com/2.0/helper/ping") >> request = Net::HTTP::Post.new(url.path) >> http = Net::HTTP.new(url.host, url.port) >> http.use_ssl = true >> http.verify_mode = OpenSSL::SSL::VERIFY_NONE >> request.body = "{\"apikey\": \"myapikey\"}" >> >> response = http.start {|http| http.request(request) } >> >> >> But when I try to use it on my RoR app I get the following error: >> >> OpenSSL::SSL::SSLError (SSL_connect returned=1 errno=0 state=unknown >> state: sslv3 alert handshake failure) >> >> Someone know what could be happening? >> >> Thank you all in advance! >> >> Best regards >> >> Paulo > > -- > Posted via http://www.ruby-forum.com/. > > -- > You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. > To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/cb5e7be2093001259cb7970923515a06%40ruby-forum.com. > For more options, visit https://groups.google.com/groups/opt_out.-- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/CAL%3D0gLu76Waz3F4FrXFd288jO7VjgjTOb09KTVZFeyCFC0rj3g%40mail.gmail.com. For more options, visit https://groups.google.com/groups/opt_out.
Jordon Bedwell
2013-Aug-30 13:47 UTC
Re: Re: Weird behaviour using ssl connection (OpenSSL::SSL::SSLError)
On Fri, Aug 30, 2013 at 8:40 AM, Paulo Castro <lists-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org> wrote:> I mean, when I execute the code bellow from web browser.. > I''m using apache+phusionpassenger > > Please, anyone has any idea? I couldn''t find anything to help yet!!First make sure your OpenSSL is working fine, then make sure you''ve the SSL headers installed and recompile Ruby. Also, see if the simplest form of connection works: require "net/https" Net::HTTP.get(URI.parse("https://us1.api.mailchimp.com/2.0/helper/ping")) -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/CAM5XQny_q-Ob07tz2WqSkFzeZu4UA%2BjTg4Hda1fWTHQcB%3D6Syg%40mail.gmail.com. For more options, visit https://groups.google.com/groups/opt_out.
Paulo Castro
2013-Aug-30 14:14 UTC
Re: Re: Weird behaviour using ssl connection (OpenSSL::SSL::SSLError)
Hi Jordon, thank you very much for your response! I''m assuming that my OpenSSL is working fine and my Ruby is already compiled with SSL headers, since when I execute using Rails console it works fine. Your code doesn''t work because this endpoint don''t allow http connection, only https. If I include the .use_ssl = true in your code, I get the same problem. When I run this app using WEBrick it also works fine. This problem only happens on Apache+PhusionPassenger... Best regards Paulo Jordon Bedwell wrote in post #1120092:> On Fri, Aug 30, 2013 at 8:40 AM, Paulo Castro <lists-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org> > wrote: >> I mean, when I execute the code bellow from web browser.. >> I''m using apache+phusionpassenger >> >> Please, anyone has any idea? I couldn''t find anything to help yet!! > > First make sure your OpenSSL is working fine, then make sure you''ve > the SSL headers installed and recompile Ruby. Also, see if the > simplest form of connection works: > > require "net/https" > Net::HTTP.get(URI.parse("https://us1.api.mailchimp.com/2.0/helper/ping"))-- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/75ff93a231a4825e709e0809f96027a5%40ruby-forum.com. For more options, visit https://groups.google.com/groups/opt_out.