auth: AuthorizedHttp.configure_mtls_channel() drops custom PoolManager settings
還沒有人認領這個 Issue。
評估
- 難度
- 3/5
- 預估耗時
- 1-2 天
- 新手友好度
- 76/100
- Issue 類型
- 缺陷
- 描述清晰度
- 描述清楚
- 活躍度
- 活躍
- 技術堆疊
- python
研究方向
先在 packages/google-auth/google/auth/transport/urllib3.py 中閱讀 _make_mutual_tls_http() 和 AuthorizedHttp.configure_mtls_channel(),然後比較 requests 傳輸中的保留行為。更新 packages/google-auth/tests/transport/test_urllib3.py 中相關的單元測試涵蓋範圍,確保自訂的重試、池大小、逾時和標頭設定在 mTLS 設定後仍然保留,並執行這些測試。
由索引模型根據 Issue 內容生成。
描述
In packages/google-auth/google/auth/transport/urllib3.py, calling AuthorizedHttp.configure_mtls_channel() replaces self.http by calling _make_mutual_tls_http(cert, key), which constructs a new urllib3.PoolManager(ssl_context=ctx) without copying non-SSL pool settings from the existing self.http instance.
When callers initialize AuthorizedHttp(credentials, http=custom_pool_manager) with custom retry policies (retries), connection pool sizing (maxsize, num_pools), timeouts (timeout), or default headers (headers), calling configure_mtls_channel() discards all of those custom configurations and emits a UserWarning stating that the http object provided in the constructor is overwritten.
By contrast, AuthorizedSession.configure_mtls_channel() in packages/google-auth/google/auth/transport/requests.py preserves custom retry and connection pool sizing (max_retries, pool_connections, pool_maxsize, pool_block) from the existing HTTPAdapter when mounting _MutualTlsAdapter.
Proposed Fix
Update _make_mutual_tls_http() in packages/google-auth/google/auth/transport/urllib3.py to accept optional PoolManager keyword arguments, and update AuthorizedHttp.configure_mtls_channel() to extract non-SSL configuration settings (retries, maxsize, block, timeout, headers, and num_pools) from self.http and forward them when constructing the mTLS PoolManager.
Update unit tests in packages/google-auth/tests/transport/test_urllib3.py to verify that custom retry, pool sizing, timeout, and header configurations on a user-provided PoolManager are preserved across configure_mtls_channel() calls.
- 主要語言
- Python
- 星號
- 5.4k
- 分支
- 1.8k
- 平均合併
- 2 天 5 小時
- 30 天內合併 PR
- 108
貢獻指南
從這裡開始
- 先讀完整個 Issue,再讀專案的貢獻指南。
- 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
- Fork 儲存庫,在一個分支上完成修改。
- 送出 Pull Request,並在描述裡引用這個 Issue 編號。
googleapis/google-cloud-python 的其他 Issue
-
難度 2/5 1-3 小時 新手友好度 88/100
googleapis/google-cloud-python#18428 ·
-
priority: p2 type: bug
難度 2/5 1-3 小時 新手友好度 72/100
googleapis/google-cloud-python#18375 · 1 則留言 ·
-
難度 1/5 1 小時以內 新手友好度 76/100
googleapis/google-cloud-python#18339 ·
-
auth priority: p2
難度 2/5 1-3 小時 新手友好度 88/100
googleapis/google-cloud-python#18315 ·
-
priority: p2 type: bug
難度 2/5 1-3 小時 新手友好度 78/100
googleapis/google-cloud-python#18260 ·
查看 googleapis/google-cloud-python 的全部 Issue
相似的 Issue
-
bug
難度 2/5 1-3 小時 新手友好度 75/100
stephrobert/dsoxlab#238 ·
-
難度 2/5 1-3 小時 新手友好度 75/100
-
難度 2/5 1-3 小時 新手友好度 75/100
sublimehq/package_control#1780 ·
-
難度 2/5 1-3 小時 新手友好度 65/100
-
難度 2/5 1-3 小時 新手友好度 70/100
nwg-piotr/nwg-displays#145 ·