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.
In
packages/google-auth/google/auth/transport/urllib3.py, callingAuthorizedHttp.configure_mtls_channel()replacesself.httpby calling_make_mutual_tls_http(cert, key), which constructs a newurllib3.PoolManager(ssl_context=ctx)without copying non-SSL pool settings from the existingself.httpinstance.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), callingconfigure_mtls_channel()discards all of those custom configurations and emits aUserWarningstating that thehttpobject provided in the constructor is overwritten.By contrast,
AuthorizedSession.configure_mtls_channel()inpackages/google-auth/google/auth/transport/requests.pypreserves custom retry and connection pool sizing (max_retries,pool_connections,pool_maxsize,pool_block) from the existingHTTPAdapterwhen mounting_MutualTlsAdapter.Proposed Fix
Update
_make_mutual_tls_http()inpackages/google-auth/google/auth/transport/urllib3.pyto accept optionalPoolManagerkeyword arguments, and updateAuthorizedHttp.configure_mtls_channel()to extract non-SSL configuration settings (retries,maxsize,block,timeout,headers, andnum_pools) fromself.httpand forward them when constructing the mTLSPoolManager.Update unit tests in
packages/google-auth/tests/transport/test_urllib3.pyto verify that custom retry, pool sizing, timeout, and header configurations on a user-providedPoolManagerare preserved acrossconfigure_mtls_channel()calls.