Project

General

Profile

Feature #11195

Add "no_proxy" parameter to Net::HTTP.new

Added by headius (Charles Nutter) about 4 years ago. Updated almost 2 years ago.

Status:
Closed
Priority:
Normal
Assignee:
-
Target version:
-
[ruby-core:69402]

Description

Net::HTTP.new currently accepts parameters for proxy host, proxy port, proxy username, and proxy password.

It does not accept an argument for non-proxied addresses, and as a result specifying a proxy host will use that proxy unconditionally.

Compare this with the default ENV behavior, which does honor the "no_proxy" env var. So the only way you can set up a proxy AND have it honor non-proxied addresses is to use ENV.

I propose that we add one more trailing argument for non-proxied hosts, since this is an unavoidable part of http proxying.

I would have made the change myself, but it involved a bit more work than just adding the param; the logic for honoring "no_proxy" only exists in the ENV logic, and when specified directly there's no affordance for non-proxied addresses in the rest of net/http.

This might be easier if we make uri/generic.rb's find_proxy accept an optional hash from which to look up these values. Then we just store them in Net::HTTP as a local version of ENV.

Associated revisions

Revision ec7c76c4
Added by naruse (Yui NARUSE) almost 2 years ago

URI::Generic: Separate no_proxy handling

To share with Net::HTTP. see #11195

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60053 b2dd03c8-39d4-4d8f-98ff-823fe69b080e

Revision 60053
Added by naruse (Yui NARUSE) almost 2 years ago

URI::Generic: Separate no_proxy handling

To share with Net::HTTP. see #11195

Revision 60053
Added by naruse (Yui NARUSE) almost 2 years ago

URI::Generic: Separate no_proxy handling

To share with Net::HTTP. see #11195

Revision 60053
Added by naruse (Yui NARUSE) almost 2 years ago

URI::Generic: Separate no_proxy handling

To share with Net::HTTP. see #11195

Revision c4130b09
Added by naruse (Yui NARUSE) almost 2 years ago

Net::HTTP.new: Support no_proxy parameter [Feature #11195]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60054 b2dd03c8-39d4-4d8f-98ff-823fe69b080e

Revision 60054
Added by naruse (Yui NARUSE) almost 2 years ago

Net::HTTP.new: Support no_proxy parameter [Feature #11195]

Revision 60054
Added by naruse (Yui NARUSE) almost 2 years ago

Net::HTTP.new: Support no_proxy parameter [Feature #11195]

Revision 60054
Added by naruse (Yui NARUSE) almost 2 years ago

Net::HTTP.new: Support no_proxy parameter [Feature #11195]

History

Updated by chucke (Tiago Cardoso) about 3 years ago

+1, I'm also having issues with this.

Updated by shyouhei (Shyouhei Urabe) about 3 years ago

  • Status changed from Open to Feedback

We looked at this issue at yesterday's developer meeting. We agreed this feature is good, but sadly no active mentor was there for Net::HTTP.

Maybe could someone propose us a patch to implement this?

Updated by roeme (Roman Bigler) almost 3 years ago

+1, I'm sure this costs quite a few people in $BIGCORPs som time to work around

Shyouhei Urabe wrote:

We looked at this issue at yesterday's developer meeting. We agreed this feature is good, but sadly no active mentor was there for Net::HTTP.

Maybe could someone propose us a patch to implement this?

No promises, and an absolute noob when it comes to this, but I'll have a look.

Edit: Sorry for the noise, but I just discovered that the necessary code seems to be present in 2.2.x. Not sure if this could be closed then (backports).

Updated by shyouhei (Shyouhei Urabe) almost 3 years ago

We looked at this issue in developer meeting today.

This feature is not implemented yet. And attendees wondered if Net::HTTP is the right place to implement no_proxy because it is the lowest layer of HTTP processing in Ruby.

uri/generic has find_proxy already so refactoring this library sounds more reasonable.

Roman, would you mind if I ask you about a pull request (against ruby/ruby), following that way?

#6

Updated by naruse (Yui NARUSE) almost 2 years ago

  • Backport deleted (2.0.0: UNKNOWN, 2.1: UNKNOWN, 2.2: UNKNOWN)
  • Tracker changed from Bug to Feature
#7

Updated by naruse (Yui NARUSE) almost 2 years ago

  • Status changed from Feedback to Closed

Applied in changeset trunk|r60054.


Net::HTTP.new: Support no_proxy parameter [Feature #11195]

Also available in: Atom PDF