ruby / ruby/net-http

No test coverage for ipaddr in HTTP.start

Open
#188 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Ruby
Stars
148
Forks
95
Avg merge
10h 54m
Merged PRs (30d)
4

Description

We use a code like this:

request = Net::HTTP::Get.new(uri.request_uri)

Net::HTTP.start(uri.hostname, uri.port, ipaddr: ip, use_ssl: true) do |http|
  http.request(request)
end

What I have noticed is that it is difficult to see if ipaddr is actually used for the request... If there is a change in the future the ipaddr param may be just ignored and nobody will notice.

Furthermore I have noticed that in the code of this gem there is no test coverage for the ipaddr parameter passed to HTTP.start.

  • Is there a more "solid" and "future-proof" solution to set the ipaddr in the above code?
  • Can you add test coverage for this parameter so that it won't break in future versions?

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start at the HTTP.start entry point and trace how its ipaddr argument reaches the request connection. Add test coverage demonstrating that the supplied ipaddr is used, then run the relevant HTTP.start tests and confirm the behavior remains covered in future changes.

Written by the indexing model from the issue text.

Assessment

Tech stack
ruby
Domain
backend, testing-qa
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.