]> git.ipfire.org Git - thirdparty/dnspython.git/commitdiff
remove unused hostname parameter to _https helper, and fix default port in the helper
authorBob Halley <halley@dnspython.org>
Sat, 22 Mar 2025 15:22:24 +0000 (08:22 -0700)
committerBob Halley <halley@dnspython.org>
Sat, 22 Mar 2025 15:22:24 +0000 (08:22 -0700)
dns/asyncquery.py
dns/query.py

index 03e384adf005d499aa88ceed66ed393ecc753ea0..7be1358d704189432a5513abd3a5c655e1b1c99e 100644 (file)
@@ -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
 
index b81ffd18a9802e80a556adbe905b4cbb9f4483b6..5d57666c2655cd51ddb20a40840497f63238206f 100644 (file)
@@ -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