From: Bob Halley Date: Fri, 9 Feb 2024 21:54:37 +0000 (-0800) Subject: The DoHNameserver now supports using GET instead of POST X-Git-Tag: v2.6.0rc1~2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=1a581c77966bd6c5c32e2876d06c5b22dede8520;p=thirdparty%2Fdnspython.git The DoHNameserver now supports using GET instead of POST if desired, and passes source and source_port to the underlying query methods. (cherry picked from commit b9eea8ec7c18c516032460882d2a7feba0f6aac9) --- diff --git a/dns/nameserver.py b/dns/nameserver.py index 0c494c18..030057b6 100644 --- a/dns/nameserver.py +++ b/dns/nameserver.py @@ -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), ) diff --git a/doc/whatsnew.rst b/doc/whatsnew.rst index ad946fef..202d9244 100644 --- a/doc/whatsnew.rst +++ b/doc/whatsnew.rst @@ -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 -----