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
0
votes
1 answer
Uploading data via HTTP PUT without multi-part gutter
I'm trying to upload static HTML+friends content to a raw Nexus 3 repository. As far as the documentation goes, the only way to upload files is using HTTP PUT. Sure enough,
curl -v --user 'user:pw' --upload-file my_file.html \
…

Raphael
- 9,779
- 5
- 63
- 94
0
votes
0 answers
cert appears to stick around after the request it was used in
I create a http client and make a http request with an attached (self-signed) cert object. I add InsecureSkipVerify: true to the client's TLSClientConfig to avoid errors.
Later I make another, unrelated request without a cert, which fails due…

Lewington
- 63
- 1
- 4
0
votes
0 answers
Net::HTTP and Nokogiri - undefined method `body' for nil:NilClass (NoMethodError)
Thanks for your time. Somewhat new to OOP and Ruby and after synthesizing solutions from a few different stack overflow answers I've got myself turned around.
My goal is to write a script that parses a CSV of URLs using Nokogiri library. After…

user2308493
- 11
- 1
0
votes
1 answer
Using Ruby Script to perform a login
my goal is to use a ruby script to perform a login.
The website uses javascript to render the login form therefore I cannot use mechanize. I want to avoid using selenium,
If I were to login with false data, I can see under the network section, that…

K Nugal
- 134
- 9
0
votes
3 answers
Request part of a Rails model from URL
I have a Rails model called Tasks, which has just one attribute: resource_id. This refers to the ID of a Resource (another model) on another Rails website running on a different URL with a different database.
When you request a Resource (e.g.…

Pal Kerecsenyi
- 560
- 4
- 18
0
votes
1 answer
Automatically get the default port for request
I currently have the following code:
if protocol == 'http'
port = Net::HTTP.http_default_port()
endpoint = Net::HTTP.new(host, port)
else
port = Net::HTTP.https_default_port()
endpoint = Net::HTTP.new(host, port)
…

0x777C
- 993
- 7
- 21
0
votes
0 answers
What is the equivalent of HTTP request using “curl … --data-binary string” in Go?
for example the curl code:
curl "http://example.com" --data-binary $'abc\r\ndef' --compressed
how to translate it to Go code?
What I have try is:
body := []byte("abc\r\ndef")
req, _ := http.NewRequest("POST", "http://example.com",…

oohcode
- 431
- 2
- 6
0
votes
1 answer
Ruby Net/Http how to get body of page with status code 3xx
I use net/http ruby's library to get the html response, but i can't get the body of the page with the status code 3xx
Page Body:
Il tuo indirizzo email è stato modificato…

MattVoid
- 1
- 2
0
votes
1 answer
ASCII ruby net/http changing request uri
I need to perform a very specific request on a legacy system and discovered that during a get request the http libraries are changing any %2C back to a ,.
Same issue with net-http, httparty, faraday, and open-uri using different…

Mro
- 3
- 3
0
votes
3 answers
How to get a list of website (url) cookies with Ruby
I'd like to know if there's a clean way of getting a list of cookies that website (URL) uses?
Scenario: User writes down URL of his website, and Ruby on Rails application checks for all cookies that website uses and returns them. For now, let's…

JohnDoeTheOne
- 141
- 1
- 2
- 16
0
votes
1 answer
Using ruby net/http library I cannot authenticate http request with basic auth going to the IIS server
The IIS server has basic auth enabled alongside Negotiate and NTLM. Here's Response headers:
{"content-type"=>["text/html"], "server"=>["Microsoft-IIS/10.0"], "www-authenticate"=>["Negotiate", "NTLM", "Basic realm=\"my_realm\""],…

G_89
- 101
- 3
0
votes
0 answers
Trying to Post an xml document to a server
I'm on an mission create an XML file and then POST this file to a server address. However I cant crack why it wont send, im currently stuck getting a "TypeError in CatalogController#gen_xml" > "String can't be coerced into Integer".
However im quite…

Tom Haythorn
- 37
- 6
0
votes
1 answer
Getting 301 redirect when using Net::HTTP.new in Ruby
I am testing the use of proxy with Net::HTTP in Ruby and found out that I keep getting 301 redirect with the code even though I type the address in the url correctly. With the same URI object the code works if I use get_response() but doesn't work…

Kelvin Lam
- 11
- 3
0
votes
2 answers
Ruby 2.3/Rails - net uri not working anymore after update to Ubuntu 16.04
I used to have a working code in my Admin Panel , checking if a url inputed existed and giving a friendly message to the Administrator in case it did not..
def get_url_response(url)
uri = URI(url)
request = Net::HTTP.get_response(uri)
…

Mathieu
- 4,587
- 11
- 57
- 112
0
votes
1 answer
Ruby return's HTTPVersionNotSupported object
I'm trying to make a get request to a service of mine with a valid URL string (if I put it into my browser, I get the expected response). However, when I run the following function:
def dispatch_uri(url)
uri = Addressable::URI.parse(url)
http =…

RafaelCruz
- 60
- 5