From 9bf6efc55ac9678ad386fd1a9d420a3b75e9ab70 Mon Sep 17 00:00:00 2001 From: Valentin Bartenev Date: Wed, 19 Aug 2020 15:36:57 +0300 Subject: [PATCH] Configuration: improved error message of invalid listener address. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Thanks to 洪志道 (Hong Zhi Dao). This closes #466 issue on GitHub. --- src/nxt_conf_validation.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/nxt_conf_validation.c b/src/nxt_conf_validation.c index b5530b85..4c979782 100644 --- a/src/nxt_conf_validation.c +++ b/src/nxt_conf_validation.c @@ -1188,10 +1188,17 @@ static nxt_int_t nxt_conf_vldt_listener(nxt_conf_validation_t *vldt, nxt_str_t *name, nxt_conf_value_t *value) { - nxt_int_t ret; + nxt_int_t ret; + nxt_sockaddr_t *sa; + + sa = nxt_sockaddr_parse(vldt->pool, name); + if (nxt_slow_path(sa == NULL)) { + return nxt_conf_vldt_error(vldt, + "The listener address \"%V\" is invalid.", + name); + } ret = nxt_conf_vldt_type(vldt, name, value, NXT_CONF_VLDT_OBJECT); - if (ret != NXT_OK) { return ret; }