]> git.ipfire.org Git - thirdparty/dnspython.git/commitdiff
The DoHNameserver now supports using GET instead of POST
authorBob Halley <halley@dnspython.org>
Fri, 9 Feb 2024 21:54:37 +0000 (13:54 -0800)
committerBob Halley <halley@dnspython.org>
Fri, 9 Feb 2024 21:55:38 +0000 (13:55 -0800)
if desired, and passes source and source_port to the
underlying query methods.

(cherry picked from commit b9eea8ec7c18c516032460882d2a7feba0f6aac9)

dns/nameserver.py
doc/whatsnew.rst

index 0c494c18bb6c06499d02ad150be47a6b25923585..030057b65005da1db1ee682ecb4897cc80875432 100644 (file)
@@ -165,11 +165,13 @@ class DoHNameserver(Nameserver):
         url: str,
         bootstrap_address: Optional[str] = None,
         verify: Union[bool, str] = True,
+        want_get: bool = False,
     ):
         super().__init__()
         self.url = url
         self.bootstrap_address = bootstrap_address
         self.verify = verify
+        self.want_get = want_get
 
     def kind(self):
         return "DoH"
@@ -203,10 +205,13 @@ class DoHNameserver(Nameserver):
             request,
             self.url,
             timeout=timeout,
+            source=source,
+            source_port=source_port,
             bootstrap_address=self.bootstrap_address,
             one_rr_per_rrset=one_rr_per_rrset,
             ignore_trailing=ignore_trailing,
             verify=self.verify,
+            post=(not self.want_get),
         )
 
     async def async_query(
@@ -224,10 +229,13 @@ class DoHNameserver(Nameserver):
             request,
             self.url,
             timeout=timeout,
+            source=source,
+            source_port=source_port,
             bootstrap_address=self.bootstrap_address,
             one_rr_per_rrset=one_rr_per_rrset,
             ignore_trailing=ignore_trailing,
             verify=self.verify,
+            post=(not self.want_get),
         )
 
 
index ad946fef9ac3f3d266837878c51bd0eaa49dd6fa..202d92444c7bec3228ac689ad235ce3accc3c75e 100644 (file)
@@ -22,6 +22,10 @@ What's New in dnspython
   feature like DoH is not desired in dnspython, but an old httpx is installed
   along with dnspython for some other purpose.
 
+* The DoHNameserver class now allows GET to be used instead of the default POST,
+  and also passes source and source_port correctly to the underlying query
+  methods.
+
 2.5.0
 -----