named_server_reload(isc_task_t *task, isc_event_t *event);
static isc_result_t
-listenelt_http(const cfg_obj_t *http, const char *key, const char *cert,
- in_port_t port, isc_mem_t *mctx, ns_listenelt_t **target);
+listenelt_http(const cfg_obj_t *http, bool tls, const char *key,
+ const char *cert, in_port_t port, isc_mem_t *mctx,
+ ns_listenelt_t **target);
static isc_result_t
listenelt_fromconfig(const cfg_obj_t *listener, const cfg_obj_t *config,
if (httpobj != NULL && cfg_obj_isstring(httpobj)) {
const char *httpname = cfg_obj_asstring(httpobj);
- if (do_tls && key == NULL) {
- return (ISC_R_FAILURE);
- }
-
http_server = find_maplist(config, "http", httpname);
if (http_server == NULL) {
cfg_obj_log(httpobj, named_g_lctx, ISC_LOG_ERROR,
if (http) {
INSIST(http_server != NULL);
- CHECK(listenelt_http(http_server, key, cert, port, mctx,
+ CHECK(listenelt_http(http_server, do_tls, key, cert, port, mctx,
&delt));
} else {
CHECK(ns_listenelt_create(mctx, port, dscp, NULL, do_tls, key,
return (result);
}
-/*
- * Create a listen list for HTTP/HTTPS
- */
static isc_result_t
-listenelt_http(const cfg_obj_t *http, const char *key, const char *cert,
- in_port_t port, isc_mem_t *mctx, ns_listenelt_t **target) {
+listenelt_http(const cfg_obj_t *http, bool tls, const char *key,
+ const char *cert, in_port_t port, isc_mem_t *mctx,
+ ns_listenelt_t **target) {
isc_result_t result = ISC_R_SUCCESS;
ns_listenelt_t *delt = NULL;
char **endpoints = NULL;
REQUIRE((key == NULL) == (cert == NULL));
if (port == 0) {
- port = (key != NULL) ? named_g_httpsport : named_g_httpport;
+ port = tls ? named_g_httpsport : named_g_httpport;
}
CHECK(cfg_map_get(http, "endpoints", &eplist));
INSIST(i == len);
- result = ns_listenelt_create_http(mctx, port, named_g_dscp, NULL, key,
- cert, endpoints, len, &delt);
+ result = ns_listenelt_create_http(mctx, port, named_g_dscp, NULL, tls,
+ key, cert, endpoints, len, &delt);
if (result != ISC_R_SUCCESS) {
if (delt != NULL) {
ns_listenelt_destroy(delt);
isc_result_t
ns_listenelt_create_http(isc_mem_t *mctx, in_port_t http_port, isc_dscp_t dscp,
- dns_acl_t *acl, const char *key, const char *cert,
- char **endpoints, size_t nendpoints,
+ dns_acl_t *acl, bool tls, const char *key,
+ const char *cert, char **endpoints, size_t nendpoints,
ns_listenelt_t **target) {
isc_result_t result;
REQUIRE(endpoints != NULL && *endpoints != NULL);
REQUIRE(nendpoints > 0);
- result = ns_listenelt_create(mctx, http_port, dscp, acl, key != NULL,
- key, cert, target);
+ result = ns_listenelt_create(mctx, http_port, dscp, acl, tls, key, cert,
+ target);
if (result == ISC_R_SUCCESS) {
(*target)->is_http = true;
(*target)->http_endpoints = endpoints;