Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: recognise system proxy env var; #643

Closed
wants to merge 2 commits into from

Conversation

LinHeLurking
Copy link

A simple commit that automatically selects proxy by environment variables.

Copy link
Owner

@algesten algesten left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi! Welcome to ureq!

We don't want to do this in our standard new() constructor. It introduces potentially unclear behavior where proxy settings are picked up without the user's control. I.e. it should be possible to create an AgentBuilder that ignores the environment variables.

I think this function should be broken into two halves.

  1. Proxy::new_from_env() -> Result<Proxy>, i.e. move the env logic to a new constructor in Proxy.
  2. A feature flag proxy-from-env that is on by default, and only affects the default agent (i.e. for ureq::get).

That way someone who is using a proxy, can bypass it either by deliberately clearing the feature flag, or by using their own AgentBuilder without setting the Proxy.

@LinHeLurking
Copy link
Author

Hi! Welcome to ureq!

We don't want to do this in our standard new() constructor. It introduces potentially unclear behavior where proxy settings are picked up without the user's control. I.e. it should be possible to create an AgentBuilder that ignores the environment variables.

I think this function should be broken into two halves.

  1. Proxy::new_from_env() -> Result<Proxy>, i.e. move the env logic to a new constructor in Proxy.
  2. A feature flag proxy-from-env that is on by default, and only affects the default agent (i.e. for ureq::get).

That way someone who is using a proxy, can bypass it either by deliberately clearing the feature flag, or by using their own AgentBuilder without setting the Proxy.

Good suggestion! I've made the changes in new commit.

@algesten
Copy link
Owner

Thanks!

This was sorted in a slightly different way in #649

@algesten algesten closed this Sep 30, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants