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

Does not work with Microsoft ISA Firewall Client for ISA Server #2036

Closed
espdev opened this issue May 8, 2014 · 4 comments
Closed

Does not work with Microsoft ISA Firewall Client for ISA Server #2036

espdev opened this issue May 8, 2014 · 4 comments

Comments

@espdev
Copy link

espdev commented May 8, 2014

Requests does not work if I try to use it in a corporate network with Microsoft ISA Server when I use ISA Firewal Clent. I do not set any proxy settings, but requests despite it have looked proxy. This behavior has been defined by default for trust_env in the module sessions in the line range 423-427 (https://github.com/kennethreitz/requests/blob/master/requests/sessions.py#L423).

proxies = proxies or {}

        # Gather clues from the surrounding environment.
        if self.trust_env:
            # Set environment's proxies.
            env_proxies = get_environ_proxies(url) or {}
            for (k, v) in env_proxies.items():
                proxies.setdefault(k, v)

In my network function get_environ_proxies returns a list of proxy servers, and it does not work for me. For correct work via ISA Firewal Clent, dict of proxies must be empty always.

For example, this behavior prevents to use pip (see pypa/pip#1182 (comment)).

@Lukasa
Copy link
Member

Lukasa commented May 8, 2014

Let me try to understand what your problem is. You want requests not to explicitly consult a proxy (presumably because the ISA server proxy is transparent).

The environment proxies are gathered in two ways: firstly, by consulting environment variables (HTTP_PROXY and HTTPS_PROXY), and then by consulting the OS configuration. You have the following options:

  1. If you have HTTP_PROXY or HTTPS_PROXY set, unset them.
  2. Set the NO_PROXY environment variable to include hosts you'd like us not to proxy to (which ought to fix most of pip).
  3. Set trust_env to False.

Note that get_environ_proxies ends up calling urllib.getproxies(). If that's returning any proxies on your system, it means your system is explicitly configured to talk to those proxies.

@espdev
Copy link
Author

espdev commented May 8, 2014

@Lukasa Yes, I want requests not to explicitly consult a proxy. I use ISA Client for proxy-transparency.

I do not set the environment variables HTTP_PROXY or HTTPS_PROXY. Other programs work transparently with ISA Server proxy via ISA Client.

Thank you for info about NO_PROXY=1. It works! My troubles are ended for "python networking". :)

@Lukasa
Copy link
Member

Lukasa commented May 8, 2014

Glad to hear it. =)

I wonder whether ISA Client adds information to the registry that's returned by getproxies(). Something worth investigating in the future.

@HelioGuilherme66
Copy link

You may download the tar.gz/zip file and pass it to the pip install
command.
(it's my workaround behind corp proxy)

On Mon, Oct 26, 2015 at 12:43 PM, Fan Du notifications@github.com wrote:

@espdev https://github.com/espdev Hi, I've been reading all posts about
this problems by you. Followed your instructions but anyhow couldn't make pip
install work behind NTLM. :(


Reply to this email directly or view it on GitHub
https://github.com/kennethreitz/requests/issues/2036#issuecomment-151121746
.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Sep 8, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants