No test coverage for ipaddr in HTTP.start

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

Nobody has claimed this yet.

Assessment

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

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.

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?
Dominant language
Ruby
Stars
148
Forks
95
Avg merge
10h 54m
Merged PRs (30d)
4

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.

More from ruby/net-http

All issues in ruby/net-http

Similar issues

More Ruby issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.