Questions tagged [net-http]

An HTTP client API for Ruby. Net::HTTP provides a rich library which can be used to build HTTP user-agents.

450 questions
0
votes
1 answer

Ruby Net::HTTPS SSL handshake error

I have the following code uri = URI.parse( 'https://my.fancy.uri/with/some/path.ext' ) https = Net::HTTP.new( uri.host, uri.port ) https.use_ssl = true https.verify_mode = OpenSSL::SSL::VERIFY_PEER store = OpenSSL::X509::Store.new store.add_file(…
Seth
  • 558
  • 3
  • 6
0
votes
1 answer

Rails: timeout after doing HTTP POST from controller

Rails 3.1.3, ruby 1.9.3p374 I am trying to POST from a controller (which receives data via POST from client and then does some processing first) to another controller in the app, and am getting Timeout::Error. I have tried using Net::HTTP (long form…
rrw4
  • 61
  • 2
0
votes
1 answer

REST client example with Net::HTTP and Rails

Through all Google I found this example: http://adam.heroku.com/past/2008/8/8/ruby_libs_for_making_web/ I can't find more tutorial stuff on this subject: A step by step and nice tutorial to teach how to use Net::HTTP with Rails for creating a REST…
Bohn
  • 26,091
  • 61
  • 167
  • 254
0
votes
1 answer

Net::HTTP.post_form cannot send parameter

Hi I'm using rails and socket.io in node.js What I'm trying to do is send a param in rails model using Net::HTTP.post_form and get the param in node.js file which is server.js model send.rb def self.push(userid) url =…
Eun Bit Hwang
  • 151
  • 1
  • 9
0
votes
2 answers

net/http rails issue works only in console

in ruby on rails console 'net/http' works, but in controller it doesn't and gives timeout error. require 'net/http' uri = URI('http://localhost:3000/api_json.json') json = Net::HTTP.get(uri) parsed_json = ActiveSupport::JSON.decode(json)
user1844923
  • 179
  • 1
  • 11
0
votes
1 answer

Sinatra gives "Connection reset by peer" error when requesting Apple UK rss feed

This is the code I am using to get the xml data from Apple's UK Top 10 rss feed: xml = Net::HTTP.get_response(URI.parse('http://ax.itunes.apple.com/WebObjects/MZStoreServices.woa/ws/RSS/topsongs/limit=10/xml')).body Sinatra returns…
Amja
  • 1,315
  • 9
  • 25
0
votes
2 answers

Specifying IP for Some Domainname

I am calling a number of apis of a web service hosted on a number of servers. Requests get routed to these servers at random through a load balancer. All these servers reside on my local network and I want one particular api call to go to one…
azi
  • 929
  • 1
  • 11
  • 31
0
votes
1 answer

Ruby script to send image with net/http and POST request

On a ruby project I am trying to send a image to a server listening to POSTS requests. I would like to avoid using extra necessary gems. I am using ruby 1.9.3 and net/http Multiport is not supported by the server and the following code: require…
0
votes
2 answers

Heroku Scheduled Task that uses Net::HTTP library to make HTTP GET request - Ruby on Rails

I'm trying to use a Heroku Scheduled Task that makes an HTTP GET to a particular controller's action. Here's what the task looks like: require 'net/http' desc "This task is called by the Heroku scheduler add-on" task :send_notifications =>…
dougiebuckets
  • 2,383
  • 3
  • 27
  • 37
0
votes
1 answer

Recover net::ERR_CONNECTION_SET Mechanize Ruby

I'm creating a web crawler using Mechanize for ruby. I'll be running batches of 200k at a time and I want to be able to set an instance variable that the site is not valid and move on with the next site when the get request return an error. For…
Luis D Urraca
  • 2,024
  • 4
  • 24
  • 46
0
votes
1 answer

Ruby how to send data to input on other page and get result to my app?

In my Ruby on Rails application i need to send get request to another web page, after that on that page will be redirect and all search result's will be visible... But how can i do this in rails? I simple need send get-request and get to my app…
byCoder
  • 3,462
  • 6
  • 28
  • 49
0
votes
1 answer

Alllow for "bad" urls in in Rails

I have a simple script which checks for bad url's: def self.check_prod_links require 'net/http' results = [] Product.find_each(:conditions =>{:published => 1}) do |product| url = product.url id = product.id uri = URI(url) …
Yogzzz
  • 2,735
  • 5
  • 36
  • 56
0
votes
1 answer

Link checker in rails

I have the following stored in a rake task. Basically I need it update the "published" attribute to 0 from 1 if the response code from the url is not 200. When I run this take I get: undefined method 'request_uri' for #
Yogzzz
  • 2,735
  • 5
  • 36
  • 56
0
votes
1 answer

Ruby URL Validation

I wrote out this script to basically parse a textfile of URL's and return the http response code, however I cant get it to work. I'm able to import and parse the file, however unable to get the return code. Thanks in advance! require…
Yogzzz
  • 2,735
  • 5
  • 36
  • 56
-1
votes
1 answer

Better way to dynamically call namespaced methods

I was curious when building a method to call an endpoint using the Net::HTTP library in rails. As the endpoint I was calling accepted the same body but with multiple request methods, I wanted to dynamically call Net::HTTP. To do this, I used this…
bubbaspaarx
  • 616
  • 4
  • 15
1 2 3
29
30