HTTPS and HTTParty - Timeout and EOF

ferparra picture ferparra · Jul 23, 2009 · Viewed 8.9k times · Source

I'm trying to post something to an HTTPS resource, but it seems it doesn't work.

My code look something like this:

require 'httparty'   
class MyClass
    include HTTParty
    base_uri "https://mydomain.com:8085/search"
    basic_auth 'admin', 'changeme'
    format :xml
    def mymethod
      self.class.post('/job', :query => {:search => "*"})
    end
end

As you can see, I've defined an URI with 'https' included, so it should set the use_ssl property for the Net::HTTPS library automatically. For some reason, Net::HTTP is requested, and I never get in touch with the server, so I end up with an EOF.

Any clues?

Answer

Peter picture Peter · Nov 24, 2010

As read at http://railstips.org/blog/archives/2008/07/29/it-s-an-httparty-and-everyone-is-invited/

"HTTPS is in. If the uri has port 443 it automatically turns https on."