From: Bob Halley Date: Sat, 22 Mar 2025 15:22:24 +0000 (-0700) Subject: remove unused hostname parameter to _https helper, and fix default port in the helper X-Git-Tag: v2.8.0rc1~47 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=c2e01e68326c330a866ca39e97aa9cc22bf12449;p=thirdparty%2Fdnspython.git remove unused hostname parameter to _https helper, and fix default port in the helper --- diff --git a/dns/asyncquery.py b/dns/asyncquery.py index 03e384ad..7be1358d 100644 --- a/dns/asyncquery.py +++ b/dns/asyncquery.py @@ -591,7 +591,9 @@ async def https( parsed.hostname, family # pyright: ignore ) bootstrap_address = random.choice(list(answers.addresses())) - if client and not isinstance(client, dns.quic.AsyncQuicConnection): # pyright: ignore + if client and not isinstance( + client, dns.quic.AsyncQuicConnection + ): # pyright: ignore raise ValueError("client parameter must be a dns.quic.AsyncQuicConnection.") assert client is None or isinstance(client, dns.quic.AsyncQuicConnection) return await _http3( @@ -706,14 +708,13 @@ async def _http3( where: str, url: str, timeout: Optional[float] = None, - port: int = 853, + port: int = 443, source: Optional[str] = None, source_port: int = 0, one_rr_per_rrset: bool = False, ignore_trailing: bool = False, verify: Union[bool, str] = True, backend: Optional[dns.asyncbackend.Backend] = None, - hostname: Optional[str] = None, post: bool = True, connection: Optional[dns.quic.AsyncQuicConnection] = None, ) -> dns.message.Message: @@ -722,6 +723,7 @@ async def _http3( url_parts = urllib.parse.urlparse(url) hostname = url_parts.hostname + assert hostname is not None if url_parts.port is not None: port = url_parts.port diff --git a/dns/query.py b/dns/query.py index b81ffd18..5d57666c 100644 --- a/dns/query.py +++ b/dns/query.py @@ -491,7 +491,9 @@ def https( assert parsed.hostname is not None # pyright: ignore answers = resolver.resolve_name(parsed.hostname, family) # pyright: ignore bootstrap_address = random.choice(list(answers.addresses())) - if session and not isinstance(session, dns.quic.SyncQuicConnection): # pyright: ignore + if session and not isinstance( + session, dns.quic.SyncQuicConnection + ): # pyright: ignore raise ValueError("session parameter must be a dns.quic.SyncQuicConnection.") return _http3( q, @@ -624,13 +626,12 @@ def _http3( where: str, url: str, timeout: Optional[float] = None, - port: int = 853, + port: int = 443, source: Optional[str] = None, source_port: int = 0, one_rr_per_rrset: bool = False, ignore_trailing: bool = False, verify: Union[bool, str] = True, - hostname: Optional[str] = None, post: bool = True, connection: Optional[dns.quic.SyncQuicConnection] = None, ) -> dns.message.Message: @@ -639,6 +640,7 @@ def _http3( url_parts = urllib.parse.urlparse(url) hostname = url_parts.hostname + assert hostname is not None if url_parts.port is not None: port = url_parts.port