Per-request proxy configuration #189

Closed
wants to merge 1 commit into
from

Conversation

Projects
None yet
10 participants
@danielfm

danielfm commented Jun 4, 2013

One of my projects uses a couple of API client gems which are developed on top of rest-client. Everything worked great (thank you btw :-) until I needed to set a proxy for the calls going to one API but not to the others.

Since the proxy is configured via the global setting RestClient.proxy, I figured it would be nice to be able to set the proxy for a specific RestClient::Request (or bypass the globally configured proxy if necessary).

That way, I wouldn't need to resort to "dirty" tricks like this:

old_proxy = RestClient.proxy

begin
  # Change or bypass proxy
  RestClient.proxy = new_proxy

  # Do work
ensure
  RestClient.proxy = old_proxy
end

I added test cases for the new parameter and updated the README accordingly.

Daniel Fernandes Martins
Now it's possible to make a request bypassing the global proxy config…
…uration, or use a different proxy when needed.
@L2G

This comment has been minimized.

Show comment Hide comment
@L2G

L2G Jun 5, 2013

Owner

Excellent, thanks. There's a tickle in the back of my brain telling me that someone else was working on this, too, but maybe that's a false memory. Anyway, this sounds like a worthy new feature.

Owner

L2G commented Jun 5, 2013

Excellent, thanks. There's a tickle in the back of my brain telling me that someone else was working on this, too, but maybe that's a false memory. Anyway, this sounds like a worthy new feature.

@ajahongir

This comment has been minimized.

Show comment Hide comment
@ajahongir

ajahongir Jun 5, 2013

nice feature, in my application I use multithread queries with different proxies so
I was searching a few days ago BUT couldnt find and used another http client.
I cant wait when this request will be released.

nice feature, in my application I use multithread queries with different proxies so
I was searching a few days ago BUT couldnt find and used another http client.
I cant wait when this request will be released.

@moonmaster9000

This comment has been minimized.

Show comment Hide comment
@moonmaster9000

moonmaster9000 Jun 12, 2013

went to check on the status of my PR for thread-safe proxy configuration (#191) and discovered this one!

My PR not only adds support for per-RestClient::Request proxies, but also exposes per-request functionality directly in the RestClient module, which is the primary way RestClient is used.

went to check on the status of my PR for thread-safe proxy configuration (#191) and discovered this one!

My PR not only adds support for per-RestClient::Request proxies, but also exposes per-request functionality directly in the RestClient module, which is the primary way RestClient is used.

@barmstrong

This comment has been minimized.

Show comment Hide comment
@barmstrong

barmstrong Jun 25, 2013

👍 we just hit a case where this would be useful

👍 we just hit a case where this would be useful

@moonmaster9000

This comment has been minimized.

Show comment Hide comment
@moonmaster9000

moonmaster9000 Jun 25, 2013

Any chance this or PR #191 could get merged in and released soon? I'd like to release my new library which depends on rest-client, but may have to release a forked rest client as a gem to do so if one of these PR's don't get merged in soon.

Sent from my iPhone

On Jun 24, 2013, at 9:22 PM, Brian Armstrong notifications@github.com wrote:

we just hit a case where this would be useful


Reply to this email directly or view it on GitHub.

Any chance this or PR #191 could get merged in and released soon? I'd like to release my new library which depends on rest-client, but may have to release a forked rest client as a gem to do so if one of these PR's don't get merged in soon.

Sent from my iPhone

On Jun 24, 2013, at 9:22 PM, Brian Armstrong notifications@github.com wrote:

we just hit a case where this would be useful


Reply to this email directly or view it on GitHub.

@ajahongir

This comment has been minimized.

Show comment Hide comment
@ajahongir

ajahongir Jun 25, 2013

i couldnt wait anymore and Today I had decided to use #191
it seems work well.

i couldnt wait anymore and Today I had decided to use #191
it seems work well.

@L2G

This comment has been minimized.

Show comment Hide comment
@L2G

L2G Jul 27, 2013

Owner

I haven't been looking in on this repo for a while, so I'm trying to bang on it this weekend as much as I can.

Owner

L2G commented Jul 27, 2013

I haven't been looking in on this repo for a while, so I'm trying to bang on it this weekend as much as I can.

@moonmaster9000

This comment has been minimized.

Show comment Hide comment
@moonmaster9000

moonmaster9000 Jul 28, 2013

Thanks!

Sent from my iPhone

On Jul 27, 2013, at 3:14 PM, Larry Gilbert notifications@github.com wrote:

I haven't been looking in on this repo for a while, so I'm trying to bang on it this weekend as much as I can.


Reply to this email directly or view it on GitHub.

Thanks!

Sent from my iPhone

On Jul 27, 2013, at 3:14 PM, Larry Gilbert notifications@github.com wrote:

I haven't been looking in on this repo for a while, so I'm trying to bang on it this weekend as much as I can.


Reply to this email directly or view it on GitHub.

@ghost ghost assigned L2G Aug 20, 2013

@ajahongir

This comment has been minimized.

Show comment Hide comment
@ajahongir

ajahongir Oct 3, 2013

are you guys going to accept this request?

are you guys going to accept this request?

@layerssss

This comment has been minimized.

Show comment Hide comment
@layerssss

layerssss Apr 1, 2014

:shipit: +1 for this

:shipit: +1 for this

@sodabrew

This comment has been minimized.

Show comment Hide comment
@sodabrew

sodabrew Jun 21, 2014

+1 - Is there some blocker on this PR?

+1 - Is there some blocker on this PR?

@ab ab assigned ab and unassigned L2G Jun 21, 2014

@ab ab modified the milestones: 1.8.0, 1.7.0 Jul 8, 2014

@axsuul

This comment has been minimized.

Show comment Hide comment
@axsuul

axsuul Nov 3, 2014

Will this ever be merged in?

axsuul commented Nov 3, 2014

Will this ever be merged in?

@tsl0922

This comment has been minimized.

Show comment Hide comment
@tsl0922

tsl0922 Feb 11, 2015

+1 for this

tsl0922 commented Feb 11, 2015

+1 for this

@ab ab modified the milestones: 2.0.0, 1.8.0 Mar 24, 2015

@ab ab closed this Apr 14, 2015

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment