]> git.ipfire.org Git - thirdparty/dnspython.git/commitdiff
simplify DoH GET
authorBob Halley <halley@dnspython.org>
Tue, 16 Jun 2020 17:19:03 +0000 (10:19 -0700)
committerBob Halley <halley@dnspython.org>
Tue, 16 Jun 2020 17:19:03 +0000 (10:19 -0700)
dns/query.py

index 7402189b83e54bb8e79e096b5e2dbb3a0b0d3f84..6fe802d0c48d9d124e98500b9d5988ba4fcf6ad4 100644 (file)
@@ -350,10 +350,10 @@ def https(q, where, timeout=None, port=443, source=None, source_port=0,
                                     stream=True, timeout=timeout,
                                     verify=verify)
         else:
-            wire = base64.urlsafe_b64encode(wire).decode('utf-8').strip("=")
-            url += "?dns={}".format(wire)
-            response = session.get(url, headers=headers, stream=True,
-                                   timeout=timeout, verify=verify)
+            wire = base64.urlsafe_b64encode(wire).rstrip(b"=")
+            response = session.get(url, headers=headers,
+                                   timeout=timeout, verify=verify,
+                                   params={"dns" : wire})
 
     # see https://tools.ietf.org/html/rfc8484#section-4.2.1 for info about DoH
     # status codes