diff options
Diffstat (limited to 'src/nxt_controller.c')
-rw-r--r-- | src/nxt_controller.c | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/src/nxt_controller.c b/src/nxt_controller.c index a3c0af17..757c294d 100644 --- a/src/nxt_controller.c +++ b/src/nxt_controller.c @@ -88,7 +88,7 @@ nxt_controller_start(nxt_task_t *task, nxt_runtime_t *rt) nxt_http_fields_hash_t *hash; static const nxt_str_t json - = nxt_string("{ \"sockets\": {}, \"applications\": {} }"); + = nxt_string("{ \"listeners\": {}, \"applications\": {} }"); hash = nxt_http_fields_hash_create(nxt_controller_request_fields, rt->mem_pool); @@ -593,6 +593,7 @@ nxt_controller_process_request(nxt_task_t *task, nxt_conn_t *c, if (value == NULL) { nxt_mp_destroy(mp); status = 400; + nxt_str_set(&resp.json, "{ \"error\": \"Invalid JSON.\" }"); goto done; } @@ -620,6 +621,13 @@ nxt_controller_process_request(nxt_task_t *task, nxt_conn_t *c, } } + if (nxt_slow_path(nxt_conf_validate(value) != NXT_OK)) { + status = 400; + nxt_str_set(&resp.json, + "{ \"error\": \"Invalid configuration.\" }"); + goto done; + } + nxt_mp_destroy(nxt_controller_conf.pool); nxt_controller_conf.root = value; @@ -674,6 +682,13 @@ nxt_controller_process_request(nxt_task_t *task, nxt_conn_t *c, goto done; } + if (nxt_slow_path(nxt_conf_validate(value) != NXT_OK)) { + status = 400; + nxt_str_set(&resp.json, + "{ \"error\": \"Invalid configuration.\" }"); + goto done; + } + nxt_mp_destroy(nxt_controller_conf.pool); nxt_controller_conf.root = value; @@ -697,7 +712,6 @@ done: case 400: nxt_str_set(&resp.status_line, "400 Bad Request"); - nxt_str_set(&resp.json, "{ \"error\": \"Invalid JSON.\" }"); break; case 404: |