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
4
votes
4 answers
Ruby example of Net::HTTP for GET, POST, PUT, DELETE
I'm trying to learn Ruby for the first time. I have some experience in PHP and in PHP, I made a function like
function call_api(endpoint,method,arr_parameters='')
{
// do a CURL call
}
Which I would use…

John
- 32,403
- 80
- 251
- 422
4
votes
1 answer
Facing issue with Net::HTTP Get in Ruby
This is the curl request which I want to convert in ruby:
curl -k --get --data 'session.id=48d59b37-5875-4e49-8d79-6cf097d740f&ajax=executeFlow&project=test&flow=two' https://localhost:8443/executor
I am supposed to the response like this:
{
…

Prachi g
- 849
- 3
- 9
- 23
4
votes
1 answer
How to send form-data in Ruby http post
I'd like to send a post from my Rails app to an API. I can get this to work using POSTMAN:
If I click on Preview in POSTMAN, it shows this as the request:
POST /api/users/status HTTP/1.1
Host:
Cache-Control:…

user1280971
- 105
- 1
- 9
4
votes
2 answers
SSL_connect returned=1 errno=0 state=SSLv3 read server certificate B: certificate verify failed ONLY WHEN PROXYING
This post nearly duplicates a number of other posts, including Rails 4 and Ruby 2 Net/HTTP SSL Request: OpenSSL::SSL::SSLError: SSL_connect returned=1 errno=0 state=SSLv2/v3 read server hello A: unknown protocol and SSL_connect returned=1 errno=0…

fearless_fool
- 33,645
- 23
- 135
- 217
4
votes
2 answers
Net::HTTP get timeout in Ruby
How can I set a larger timeout in net/http?
What I'm doing is this:
rta = JSON.parse(Net::HTTP.get(URI(url)))
I've tried:
uri = URI(url)
http = Net::HTTP.new(uri.host, uri.port)
http.open_timeout = 5* 60
http.read_timeout = 5* 60
rta =…

mar_sanbas
- 833
- 2
- 12
- 20
4
votes
1 answer
Am I doing it wrong or is it a bug in net/http?
I'm using Ruby Net::HTTP under a NginX/Phusion Passenger server, attempting to POST a JSON string to the server. It appears that my POST, only when sending as 'application/json', prematurely closes the session to the server. I.E.:
On the server…

Jim
- 1,499
- 1
- 24
- 43
4
votes
1 answer
Using NetHTTP within Rails to hit Rails
We have a very unique use case where we want a Rails controller to access a route within the Rails app using Net::HTTP. Can this be done? I'm currently receiving a timeout when attempting to do so. The current code works when the uri is a separate…

Rebitzele
- 3,252
- 1
- 20
- 21
4
votes
1 answer
post image with faraday as parameter
I have a old service and new service with images on it. I want to migrate the images from old to new. for that I need to get image from my old service and then post it to new sinatra service.
I was able to post image in the format i want using…

goyalankit
- 843
- 8
- 23
4
votes
1 answer
Ruby Asynchronous Net::HTTP?
Does Net::HTTP support an asynchronous syntax?
I'm looking for something like the code below.
The block would get called on the main thread after Net::HTTP has either received the response from the server (in which case,error would be nil) or…

ma11hew28
- 121,420
- 116
- 450
- 651
4
votes
1 answer
Can I reference a complete Ruby Net::HTTP request as a string before sending?
I'm using Net::HTTP in Ruby 1.9.2p290 to handle some, obviously, networking calls.
I now have a need to see the complete request that is sent to the server (as one long big String conforming to HTTP 1.0/1.1.
In other words, I want Net::HTTP to…

makdad
- 6,402
- 3
- 31
- 56
3
votes
1 answer
On ruby-1.9.3 getting OpenSSL::SSL::SSLError from net-https (Mac OSX 10.6)
I have seen a lot of people with this error and no solution seems to fix it for me:
ruby-1.9.3-p0/lib/ruby/1.9.1/net/http.rb:799:in `connect': SSL_connect returned=1 errno=0 state=SSLv3 read server certificate B: certificate verify failed…

Richard Jordan
- 8,066
- 3
- 39
- 45
3
votes
3 answers
Persistent Ruby segfaulting after a clean install
Ruby keeps segfaulting when using the Koala gem to talk over HTTP:
/Users/pawel/.rvm/rubies/ruby-1.9.3-p0/lib/ruby/1.9.1/net/http.rb:799: [BUG] Segmentation fault
I've tried the following:
Run which -a ruby which showed multiple Rubies via…

Simpleton
- 6,285
- 11
- 53
- 87
3
votes
1 answer
ruby jiraSOAP net-http ssl verify
How can I specify for net/http to not verify the SSL certificate, when loading through Handsoap and jiraSOAP.. see code below:
require 'jiraSOAP'
Handsoap.http_driver = :net_http
api = JIRA::JIRAService.new…

nictrix
- 1,483
- 1
- 17
- 34
3
votes
2 answers
Ruby 2.7.4 Net Constant Warnings
I'm getting repetitive warnings upon running a ruby script in a crontab, as well as manually in the terminal.
/Users/rich/.rbenv/versions/2.7.4/lib/ruby/2.7.0/net/protocol.rb:66: warning: already initialized constant…

Rich_F
- 1,830
- 3
- 24
- 45
3
votes
1 answer
How do I catch this exception in Ruby?
I'm a ruby beginner so bear with me.
I am using the selenium-webdriver and rb-appscript gems to do some webscraping. The navigation to websites seems to be driven by the Net::Http object, which has a rbuf_fill method.
Running the following…

Kotsu
- 374
- 1
- 5
- 22