]> git.ipfire.org Git - thirdparty/dnspython.git/commitdiff
remove send_https() as the send/receive split is too hard for HTTPS and it is not...
authorBob Halley <halley@dnspython.org>
Fri, 8 May 2020 13:43:50 +0000 (06:43 -0700)
committerBob Halley <halley@dnspython.org>
Fri, 8 May 2020 13:43:50 +0000 (06:43 -0700)
dns/query.py
tests/test_doh.py

index 8e22570562a1565b2fee89ff055df6c1bb4b2dbb..017dcba19d71d929aab163feb2fff5522b042f02 100644 (file)
@@ -228,22 +228,6 @@ def _destination_and_source(af, where, port, source, source_port,
         destination = None
     return (af, destination, source)
 
-def send_https(session, what, lifetime=None):
-    """
-    :param session: a :class:`requests.sessions.Session`
-    :param what: a :class:`requests.models.Request` or
-    :class:`requests.models.PreparedRequest`.
-    If it's a :class:`requests.models.Request`, it will be converted
-     into a :class:`requests.models.PreparedRequest`.
-    :param lifetime: timeout (in seconds)
-    :return: a :class:`requests.models.Response` object.
-    """
-    if not have_doh:
-        raise NoDOH
-    if isinstance(what, requests.models.Request):
-        what = what.prepare()
-    return session.send(what, timeout=lifetime)
-
 def https(q, where, timeout=None, port=443, af=None, source=None, source_port=0,
           one_rr_per_rrset=False, ignore_trailing=False,
           session=None, path='/dns-query', post=True,
@@ -336,7 +320,7 @@ def https(q, where, timeout=None, port=443, af=None, source=None, source_port=0,
             })
             response = session.post(url, headers=headers, data=wire,
                                     stream=True, timeout=timeout,
-                                    verify=verify)
+                                      verify=verify)
         else:
             wire = base64.urlsafe_b64encode(wire).decode('utf-8').strip("=")
             url += "?dns={}".format(wire)
index 7e66d0aef6e594e06f57dd373e9b074fc30a60f1..46096a729e8c5ca7ba86ed95fea292bc9c1e9c76 100644 (file)
@@ -72,18 +72,6 @@ class DNSOverHTTPSTestCase(unittest.TestCase):
         r = dns.query.https(q, valid_tls_url, session=self.session, bootstrap_address=ip)
         self.assertTrue(q.is_response(r))
 
-    def test_send_https(self):
-        q = dns.message.make_query('example.com.', dns.rdatatype.A)
-        wire = q.to_wire()
-        query_string = '?dns={}'.format(base64.urlsafe_b64encode(wire).decode('utf-8').strip("="))
-        request = requests.models.Request(
-            'GET',
-            'https://cloudflare-dns.com/dns-query{}'.format(query_string))
-        r = request.prepare()
-        response = dns.query.send_https(self.session, r)
-        dns_resp = dns.message.from_wire(response.content)
-        self.assertTrue(q.is_response(dns_resp))
-
     def test_new_session(self):
         nameserver_url = random.choice(KNOWN_ANYCAST_DOH_RESOLVER_URLS)
         q = dns.message.make_query('example.com.', dns.rdatatype.A)