An HTTP client API for Ruby. Net::HTTP provides a rich library which can be used to build HTTP user-agents.
Questions tagged [net-http]
450 questions
2
votes
1 answer
Getting OpenSSL::SSL::SSLError: SSL_set_tlsext_host_name when trying to make a post request through https
I'm trying to send a post request through https using net/http class in ruby and I'm getting this error:
OpenSSL::SSL::SSLError: SSL_set_tlsext_host_name
from C:/RailsInstaller/Ruby2.1.0/lib/ruby/2.1.0/net/http.rb:920:in `connect'
…

Daniel89
- 23
- 7
2
votes
1 answer
golang webservice crashes unexpectedly without error
I'm developping a webservice with golang. It uses the net/http package and others packages like github.com/go-sql-driver/mysql and redigo (redis).
I have no problem when I develop it, no bugs.
When I put it on a server in production as a service in…

GuillaumeP
- 504
- 5
- 19
2
votes
0 answers
Ruby Net::Http split write and read operation for non-blocking
I'm fairly new to Ruby and I'm looking at using the Net::Http class to post some data and then read in the response once I'm ready for it. Ideally I'd like to be able to split the code into two functions, one which connects and writes the request,…

testy
- 21
- 2
2
votes
1 answer
If open-uri works, why does net/http return an empty string?
I am attempting to download a page from Wikipedia. For such a task, I am using gems. When using net/http, all I get is an empty string. So I tried with open-uri and it works fine.
Nevertheless, I prefer the first option because it gives me a much…

gcarbonell
- 63
- 3
- 8
2
votes
0 answers
ruby net/http sysread_nonblock: end of file reached (EOFError)
I have the following code:
#!/usr/bin/env ruby
require 'net/http'
token = File.read("code.txt")
uri = URI("https://private.http.server.with.self.signed.certs")
http = Net::HTTP.new(uri.host, uri.port)
http.use_ssl = true
http.verify_mode =…

Luca
- 315
- 4
- 13
2
votes
0 answers
Generating Google Api access_token slow in heroku
On one of our app hosted on Heroku we do a backend call (in Ruby) to generate access token:
require "uri"
require "net/http"
parameters = {
code: params[:code],
client_id: "my_client_id",
client_secret: "my_client_secret",
…

Julien Hobeika
- 323
- 2
- 7
2
votes
1 answer
SocketError : HiPay Integration in Rails app (Payment API)
I'm trying to implement HiPay API for my checkout process.
In my controller i do :
http = Net::HTTP.new("https://test-www.hipay.com/")
@response = http.post("/order", xml)
and i have this error :
SocketError in XController#new
getaddrinfo:…
getaddrinfo:…

Hiro
- 29
- 1
- 6
2
votes
1 answer
Net::http and HTTParty work locally but not on Heroku - RoR3
I am working on some RoR3 app and I have to make a HTTP request to some server.
I tried Ruby's Net::HTTP lib and is working locally but not on Heroku. I then tried HTTParty and get it to work locally but it still doesn't work on Heroku. I get…

Jaka Dirnbek
- 155
- 9
2
votes
1 answer
How to scrape a website with the socksify gem (proxy)
I am reading through the documentation of the socksify gem on Rubyforge. I have installed the gem successfully, and I have run this documented code with success to test that my local implementation can replicate it:
require 'socksify/http'
uri =…

JohnSmith1976
- 536
- 2
- 12
- 35
2
votes
1 answer
Monkey patching use_ssl= method works for Net:HTTP but not for OpenURI in Ruby 1.9.3?
Background:
Ruby 1.9.3
Rails 3.2.16
Windows 7 x64
Issue
I'm trying to fix the infamous
SSL_connect returned=1 errno=0 state=SSLv3 read server certificate B: certificate verify failed
error by including my certificates in each HTTP request I…

rwb
- 4,309
- 8
- 36
- 59
2
votes
1 answer
Why do Ruby Net::HTTP.get_response and Net::HTTP.new(uri.host).request return different things?
These 2 requests should have the same result, but the first one returns a 200 (OK) and the second one returns a 404 (Not Found). Why is that?
require 'net/http'
url = "http://readwrite.com/2013/12/04/google-compute-engine"
uri =…

sebagon
- 21
- 1
- 2
2
votes
1 answer
Getting random "read_nonblock': end of file reached (EOFError)" with Net::HTTP.start
When I execute the following code...
http = Net::HTTP.start('jigsaw.w3.org')
http.request_post('/css-validator/validator', ' ', 'Content-type' => "multipart/form-data")
...then I very often get the following error:
EOFError: end of file…

Joshua Muheim
- 12,617
- 9
- 76
- 152
2
votes
1 answer
Need assistance with sending xml property list as HTTP body with Ruby net/http
The below script works however, I'm receiving a 400 "Bad Request" response because the POST must include the below XML data into the HTTP body. I've been trying different ways to get this done with no success. Could someone point me in the right…

nanotechz9l
- 141
- 2
- 10
2
votes
1 answer
Errno::ECONNRESET (Connection reset by peer - SSL_connect) OpenSSL certificates? Ruby on Rails 2.3.15
Hi all this is my first post so sorry if I do anything wrong.
I am using Ruby 1.8.7, Rails 2.3.15 on a centOS 6.5 VPS with openssl 1.01e ruby-gems 1.8.25, mongrel_rails server. My app needs to connect to an API using Net::HTTP over SSL with…

bruceman200
- 21
- 1
- 2
2
votes
1 answer
If Net::HTTP's open_timeout and read_timeout are not set, will it wait indefinitely?
If Net::HTTP's open_timeout and read_timeout are not set, will it wait indefinitely?
According to the docs, open_timeout is defined as:
Number of seconds to wait for the connection to open. Any number may
be used, including Floats for fractional…

esilver
- 27,713
- 23
- 122
- 168