From 2cb8efb18426430b308fe8a21334f7a40302ffb6 Mon Sep 17 00:00:00 2001 From: Remi Gacogne Date: Mon, 13 May 2019 14:59:57 +0200 Subject: [PATCH] dnsdist: Add a test for empty DoH GET queries --- regression-tests.dnsdist/test_DOH.py | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/regression-tests.dnsdist/test_DOH.py b/regression-tests.dnsdist/test_DOH.py index 4f2012d24..dead5b024 100644 --- a/regression-tests.dnsdist/test_DOH.py +++ b/regression-tests.dnsdist/test_DOH.py @@ -315,6 +315,22 @@ class TestDOH(DNSDistDOHTest): self.checkQueryEDNSWithoutECS(expectedQuery, receivedQuery) self.assertEquals(response, receivedResponse) + def testDOHWithoutQuery(self): + """ + DOH: Empty GET query + """ + name = 'empty-get.doh.tests.powerdns.com.' + url = self._dohBaseURL + conn = self.openDOHConnection(self._dohServerPort, self._caCert, timeout=2.0) + conn.setopt(pycurl.URL, url) + conn.setopt(pycurl.RESOLVE, ["%s:%d:127.0.0.1" % (self._serverName, self._dohServerPort)]) + conn.setopt(pycurl.SSL_VERIFYPEER, 1) + conn.setopt(pycurl.SSL_VERIFYHOST, 2) + conn.setopt(pycurl.CAINFO, self._caCert) + data = conn.perform_rb() + rcode = conn.getinfo(pycurl.RESPONSE_CODE) + self.assertEquals(rcode, 400) + def testDOHEmptyPOST(self): """ DOH: Empty POST query -- 2.40.0