Respect system proxy exclusions.

オープン
#587 コメント 12 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

まだ誰も着手していません。

評価

難易度
4/5
見積もり時間
3〜5日
初心者へのやさしさ
35/100
issue の種類
バグ
明瞭さ
説明が足りない
活発さ
静か
技術スタック
python
領域
networking

調査の方向性

httpx/_utils.py の304-320行目と、既存の getproxies()/NO_PROXY の処理から始めてください。Windows の ProxyOverride 形式と _scproxy._get_proxy_settings() の exceptions フィールドを調査し、それらの除外を hostname-pattern mount システムにどのように組み込めるかを判断してください。Windows または macOS の設定からプロキシ設定が取得される場合に、環境変数だけでなくシステムプロキシの除外も機能すれば完了です。

索引モデルが issue の本文から書いたものです。

説明

Originally opened by @tomchristie on 2021-03-25 13:22:50 in encode/httpx

  • Initially raised as discussion #1513

We're currently leaning on urllib.request.getproxies() to determine the system proxy setup, and setup which mounts should be a proxy transport and which should be a regular transport.

However, we're not using urllib.request.proxy_bypass(host).

This all works as expected when environment settings are being used. HTTP_PROXY, HTTPS_PROXY, and ALL_PROXY. In that case we're reading NO_PROXY, and ensuring anything hostname patterns there are mounted as a regular transport...

https://github.com/encode/httpx/blob/68cf1ff88a7f6c0b084bb62455c043aa503713ef/httpx/_utils.py#L304-L320

However, in the case when none of those environment variables are set getproxies() instead falls back to system proxy configuration. For windows this is registry based. ProxyEnable and ProxyOverride. For Mac this is sysconf based.
In those cases, we're correctly getting the configured proxies, but we aren't dealing with proxy exclusions.

We'd like to be able to setup these exclusions with our neat hostname pattern matched mounts system, which actually
means we can't just fallback to urllib.request.proxy_bypass(host), because that needs to be called per-host.

So, first steps...

  • What exactly is the format of the windows registry ProxyOverride field?
  • What exactly is the format of the "exceptions" field returned by from _scproxy import _get_proxy_settings()?
主要言語
Python
スター
1.6k
フォーク
103
平均マージ
1日 19時間
マージ済み PR(30日)
25

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

pydantic/httpx2 のほかの issue

pydantic/httpx2 の issue をすべて見る

似ている issue

Python の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。