]> git.ipfire.org Git - thirdparty/dnspython.git/commitdiff
Fix passing source address with httpx. 798/head
authorBrian Wellington <bwelling@xbill.org>
Fri, 25 Mar 2022 20:23:07 +0000 (13:23 -0700)
committerBrian Wellington <bwelling@xbill.org>
Fri, 25 Mar 2022 20:23:07 +0000 (13:23 -0700)
When dns.query.https() is passed a source address, it needs to create an
adapter for either requests or httpx to use it.  As it doesn't know
which one will actually be used, it creates both.  But then if it
decides to use httpx, it attempts to attach the requests adapter, which
fails.

dns/query.py

index 7fa50b93eeddfc588482af33caeb37f82d975216..5663e2349d11a198cf016483f85684584bb2a429 100644 (file)
@@ -390,7 +390,7 @@ def https(
     else:
         cm = requests.sessions.Session()
     with cm as session:
-        if transport_adapter:
+        if transport_adapter and not _is_httpx:
             session.mount(url, transport_adapter)
 
         # see https://tools.ietf.org/html/rfc8484#section-4.1.1 for DoH