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
-1
votes
1 answer

how to get go net/http/client connection info

The go official library provides net/http/client which internally implements a thread-safe connection pool. I want to query the current connection pool status: how many connections, how many are idle, etc. during the program running process
-1
votes
1 answer

Need help in debugging a tiny ruby script

I get the following error, when i run my script. fetch_scores.rb:20:in `
': undefined local variable or method `__EVENTTARGET' for main:Object (NameError) Hereś the script: #fetch_scores.rb require 'net/http' require 'open-uri' #define a…
nikhil
  • 8,925
  • 21
  • 62
  • 102
-1
votes
1 answer

A POST request after the login request, still asks for a permission

I am trying to send two PostForm requests to a specified URL(webpage), which one of them is "login" and another one is "create a product". The problem is the second request(create a product) runs apart from the first request(login). That is why…
Amid
  • 442
  • 2
  • 8
  • 15
-1
votes
3 answers

rails to_json remove quote

I am working the the LogMeIn Central API and in the body of my request I need to send some Json. I have this: host_ids = LmiHost.all.collect {|lmi| lmi.host_id}.join ', ' create_servicetag_report_request.body = {hostIds: host_ids, fields:…
Devon Quick
  • 348
  • 1
  • 17
-1
votes
2 answers

Request only the header in http call

Is there a ruby library, with which I can request the web server to return only the header response and no content? This will help me speed up a script in which all I care is the response code. I am now using…
anyavacy
  • 1,618
  • 5
  • 21
  • 43
-1
votes
2 answers

Ruby writing zip file works on Mac but not on windows / How to recieve zip file in Net::HTTP

actually i'm writing a ruby script which accesses an API based on HTTP-POST calls. The API returns a zip file containing textdocuments when i call it with specific POST-Parameters. At the moment i'm doing that with the Net::HTTP Package. Now my…
-1
votes
1 answer

Construct NET::HTTP header files

I am required to make an http request with a header similar to the one quoted below. POST /approval HTTP/1.1 Content-Type:text/xml Content-Length:569 Host:127.0.0.1 Authorization: WSSE realm="SDP", profile="UsernameToken" X-WSSE: UsernameToken…
acacia
  • 1,375
  • 1
  • 14
  • 40
-1
votes
1 answer

Ruby - WebCrawler how to visit the links of the found links?

I try to make a WebCrawler which find links from a homepage and visit the found links again and again.. Now i have written a code w9ith a parser which shows me the found links and print there statistics of some tags of this homepage but i dont get…
Faculty
  • 69
  • 7
-1
votes
1 answer

Wrapping a Rails app as an API, accessing parameters not working

I'm wrapping a Rails app into an api, and this is part of the API app: # Merge existing yaml with post params def merge_config(yaml, params) if params['post'].has_key? 'yaml' params['post']['yaml'].each do |key, value| if value ==…
-1
votes
1 answer

Net::HTTP - How can I open a link with adress?

I need to open this link with Net::HTTP: "http://localhost:9292/something" Terminal: http = Net::HTTP.new("http://localhost",9292) => # How can I open this link, any idea?
Kurt Russell
  • 225
  • 1
  • 3
  • 15
-1
votes
1 answer

Stack Level Too Deep - Ruby

I have a stack overflow problem I can't seem to solve in a ruby project. In the file movie.rb, at the line 44-47, I call a function contained in the file mmc.rb. When I test the file alone, mmc.rb works fine, but called several time in a loop, it…
Simon
  • 619
  • 2
  • 9
  • 23
-2
votes
1 answer

Doubts about the source code of connection on net/http in golang

I am learning source code about golang , at the source code create new connection for each request in net/http, like: // Create new connection from rwc. func (srv *Server) newConn(rwc net.Conn) (c *conn, err error) { c = new(conn) …
sope
  • 1,619
  • 5
  • 19
  • 37
-4
votes
1 answer

Go program exits after a connection refused

I'm Sending get requests to websites and get the statuscodes inside a loop, when the loop sends get request to a non-exist website, it breaks the program. go version go1.12.6 darwin/amd64 func getRequest(url string) int { …
Ozan Temel
  • 47
  • 1
  • 5
-4
votes
1 answer

Equivalent ruby code for python

What is the equivalent ruby code for the following python code. I surfed net and find net/http' is the correct method. But I am new to ruby, I am unable to use this method effectively. Can anybody help me to write this in python? Python url =…
Sam
  • 5,040
  • 12
  • 43
  • 95
-5
votes
2 answers

How to download file in ruby with link like https://data.gov.in/resources/all-india-pincode-directory/download

I want to download file which gets downloaded on opening the page with link https://data.gov.in/resources/all-india-pincode-directory/download in ruby
1 2 3
29
30