There's no need to reproduce the logic of net/http. We can instead just pass the error message through.
In my case, I am having an issue with bundler. I haven't figured it out yet, but this error message was misleading. Here's the exception returned from Net::HTTP:
#<Errno::EHOSTDOWN: Host is down - connect(2) for "gems.contribsys.com" port 443>
Then net-http-persistent rescued that, and raised it like this:
Fix exception message to not guess whether proxy or real port (or address) was tried (and failed) by net/http.
The actual determination of whether a proxy was tried is here: https://github.com/ruby/ruby/blob/3471d0f6d6619b41b7054bd7bb87e929156abde2/lib/net/http.rb#L1079-L1081
There's no need to reproduce the logic of net/http. We can instead just pass the error message through.
In my case, I am having an issue with bundler. I haven't figured it out yet, but this error message was misleading. Here's the exception returned from Net::HTTP:
Then net-http-persistent rescued that, and raised it like this:
That port=80 is incorrect. This PR allows the original message to pass through.