Hi,

I've been trying to fix a problem when making a https request using
Net::HTTP
No matter how I tried I was getting and EOF error.

Then I tried with Mechanize gem and it worked like a charm.

The code I use now for Mechanize is:

agent = Mechanize.new
agent.keep_alive = true

page = agent.post("https://somewhereintime.bla";, {'tagid' => 'b6',
'source' => 'email' })

The code I was using with Net::HTTP was (gives me EOF error):

url = URI.parse("https://somewhereintime.bla";)
req = Net::HTTP::Post.new(url.path)
req.set_form_data({ 'tagid' => 'b6', 'source' => 'email' })
res = Net::HTTP.new(url.host, 443).start {|http| http.request(req)}
res.use_ssl = true

--------

So what is the price? Less code, works better. There must be a price.
I'm I using the wrong gem just to post a request?

Just wondering...

-- 
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 post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.

Reply via email to