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
Net::HTTP not sending request
I have the following method in our Ruby 1.8.7 project:
def self.ping_server
request_data = get_request_data
uri = 'another_server.our_company.com'
https = Net::HTTP.new(uri)
https.use_ssl = true
path = "/our_service"
data =…

Kevin
- 14,655
- 24
- 74
- 124
2
votes
1 answer
Is Timeout::timeout safe to use in JRuby 1.7?
I've read this post about how inherently unsafe ruby's timeout method is, but I it looks like JRuby has natively implemented the Timeout class and I was wondering if those issues are still relevant in JRuby 1.7? From what I can decipher from the…

Mohamed Hafez
- 8,621
- 7
- 41
- 49
2
votes
1 answer
How to avoid jruby's Bad File Descriptor on openssl?
I'm in a java swing application which has its WebService client implemented in jruby.
The use case is User clicks on a button, the corresponding controller opens a new Thread and this thread takes a list from a local DB and for each item of the list…

tramuntanal
- 41
- 6
2
votes
1 answer
Ruby - increasing proxy request timeout
I'm trying to access some contents via some proxy servers but I get:
I modified the code and tried to increase the timeout as below:
require 'open-uri'
require 'net/http'
response =…

tokhi
- 21,044
- 23
- 95
- 105
2
votes
1 answer
How to download a binary file via Net::HTTP::Get?
I am trying to download a binary file via HTTP using the following Ruby script.
#!/usr/bin/env ruby
require 'net/http'
require 'uri'
def http_download(resource, filename, debug = false)
uri = URI.parse(resource)
puts "Starting HTTP download…

JJD
- 50,076
- 60
- 203
- 339
2
votes
2 answers
Creating Gist from a Ruby script
Is there a way to create an Anonymous (public or private) gist using net/http or net/https?

Aggelos Avgerinos
- 556
- 2
- 11
2
votes
1 answer
Comparing local file against checksum using Net::HTTP in Ruby without downloading full file
Without being able to control or add headers server-side, is it possible to compare a local checksum against a remote file without downloading the entire file and comparing checksums using Ruby and Net::HTTP?
I'm populating a disk with files using a…
user559633
2
votes
2 answers
http_request.set_form_data : Getting undefined method map for string for the json parameter
I am trying to pass a json representation to a set_form_data and am running into following error:
undefined method `map' for "{\"first_name\":\"bill\",\"last_name\":\"gates\"}":String
Here is how I create the request:
…

codeObserver
- 6,521
- 16
- 76
- 121
2
votes
1 answer
Rails http request - don't wait for response
I am coding in Ruby-on-Rails
I would like to send a http request to another service but not wait for a response.
Pseudocode:
def notification
require 'net/http'
...
# send net/http request
Net::HTTP.post_form(url, params)
…

Harry
- 1,659
- 5
- 19
- 34
2
votes
2 answers
HTTP request path is empty in working with Net::HTTP
So I jut created a controller like this:
require 'net/http'
class HowdyController < ApplicationController
def show
url = URI.parse("http://google.com")
req = Net::HTTP::Get.new(url.path)
@resp = Net::HTTP.new(url.host, url.port).start…
user1899082
2
votes
1 answer
Adjusting timeouts for Nokogiri connections
Why nokogiri waits for couple of secongs (3-5) when the server is busy and I'm requesting pages one by one, but when these request are in a loop, nokogiri does not wait and throws the timeout message.
I'm using timeout block wrapping the request,…

Snake Sanders
- 2,641
- 2
- 31
- 42
2
votes
1 answer
Net::HTTP::Post::Multipart file parameter with file on the fly
I'm trying to do a Net::HTTP:POST::Multiport and send some text in a file format to an API.
I get the data from my database, and I don't want to create physical files, I want to create a file on the fly with the data and send it to the API.
Right…

Matilda
- 1,708
- 3
- 25
- 33
2
votes
2 answers
Reusing connections between threads in Ruby / replacement for Net::HTTP::Persistent
I'm running a multithreaded daemon where an instance of ruby Mechanize (which contains a Net::HTTP::Persistent object), might be used and run by one of many threads. I'm running into tons of problems because Net::HTTP::Persistent opens a new…

Mohamed Hafez
- 8,621
- 7
- 41
- 49
1
vote
1 answer
Net HTTP unescapes characters?
Does Ruby Net HTTP unescape characters (for example 龅 to 龅)? I send a request using HTTParty with 龅 but the request parameters on the request server show 龅 instead.

Artem Kalinchuk
- 6,502
- 7
- 43
- 57
1
vote
1 answer
Using mechanize (or even Net::HTTP) with ruby 1.9 returns 'OpenSSL::SSL::SSLError' - how to force SSLv3?
For the past 2 days, I think I've been through every single available (google'able) post about this SSL-Error in connection with Net::HTTP:
OpenSSL::SSL::SSLError: SSL_connect SYSCALL returned=5 errno=0 state=SSLv2/v3 read server hello A
What I…

astera
- 31
- 1
- 4