});
#ifdef HAVE_DNS_OVER_QUIC
- luaCtx.writeFunction("getDOQFrontend", [client](uint64_t index) {
+ luaCtx.writeFunction("getDOQFrontend", [client](uint64_t index) -> boost::optional<std::shared_ptr<DOQFrontend>> {
boost::optional<std::shared_ptr<DOQFrontend>> result{boost::none};
if (client) {
- return result;
+ return std::shared_ptr<DOQFrontend>();
}
setLuaNoSideEffect();
try {
});
#ifdef HAVE_DNS_OVER_HTTP3
- luaCtx.writeFunction("getDOH3Frontend", [client](uint64_t index) {
+ luaCtx.writeFunction("getDOH3Frontend", [client](uint64_t index) -> boost::optional<std::shared_ptr<DOH3Frontend>> {
boost::optional<std::shared_ptr<DOH3Frontend>> result{boost::none};
if (client) {
- return result;
+ return std::shared_ptr<DOH3Frontend>();
}
setLuaNoSideEffect();
try {
#endif
});
- luaCtx.writeFunction("getDOHFrontend", [client]([[maybe_unused]] uint64_t index) {
+ luaCtx.writeFunction("getDOHFrontend", [client]([[maybe_unused]] uint64_t index) -> boost::optional<std::shared_ptr<DOHFrontend>> {
boost::optional<std::shared_ptr<DOHFrontend>> result{boost::none};
if (client) {
- return result;
+ return std::shared_ptr<DOHFrontend>();
}
#ifdef HAVE_DNS_OVER_HTTPS
setLuaNoSideEffect();
#endif
});
- luaCtx.writeFunction("getTLSFrontend", []([[maybe_unused]] uint64_t index) {
+ luaCtx.writeFunction("getTLSFrontend", [client]([[maybe_unused]] uint64_t index) -> boost::optional<std::shared_ptr<TLSFrontend>> {
boost::optional<std::shared_ptr<TLSFrontend>> result{boost::none};
+ if (client) {
+ return std::shared_ptr<TLSFrontend>();
+ }
#ifdef HAVE_DNS_OVER_TLS
setLuaNoSideEffect();
try {
import dns
import os
import time
+import subprocess
import unittest
import clientsubnetoption
self.assertIn('foo: bar', headers)
self.assertNotIn(self._customResponseHeader2, headers)
+ def testFrontendAccessViaBuiltInClient(self):
+ """
+ DOH: Built-in client
+ """
+ if self._yaml_config_template:
+ return
+
+ output = None
+ try:
+ confFile = os.path.join('configs', 'dnsdist_%s.conf' % (self.__class__.__name__))
+ testcmd = [os.environ['DNSDISTBIN'], '--client', '-C', confFile ]
+ process = subprocess.Popen(testcmd, stdout=subprocess.PIPE, stdin=subprocess.PIPE, stderr=subprocess.STDOUT, close_fds=True)
+ output = process.communicate(input=b'showVersion()\n')
+ except subprocess.CalledProcessError as exc:
+ raise AssertionError('%s failed (%d): %s' % (testcmd, process.returncode, process.output))
+
+ if process.returncode != 0:
+ raise AssertionError('%s failed (%d): %s' % (testcmd, process.returncode, output))
+
+ self.assertTrue(output[0].startswith(b'dnsdist '))
+
class TestDoHNGHTTP2(DOHTests, DNSDistDOHTest):
_dohLibrary = 'nghttp2'