diff options
author | Valentin Bartenev <vbart@nginx.com> | 2020-08-19 15:36:57 +0300 |
---|---|---|
committer | Valentin Bartenev <vbart@nginx.com> | 2020-08-19 15:36:57 +0300 |
commit | 9bf6efc55ac9678ad386fd1a9d420a3b75e9ab70 (patch) | |
tree | 357bd57b952dd75da81870ec88a00568b444eaf6 /src/nxt_conf_validation.c | |
parent | 7ffc617ae89fe08b8a9a17bed41ef8941b8151fb (diff) | |
download | unit-9bf6efc55ac9678ad386fd1a9d420a3b75e9ab70.tar.gz unit-9bf6efc55ac9678ad386fd1a9d420a3b75e9ab70.tar.bz2 |
Configuration: improved error message of invalid listener address.
Thanks to 洪志道 (Hong Zhi Dao).
This closes #466 issue on GitHub.
Diffstat (limited to 'src/nxt_conf_validation.c')
-rw-r--r-- | src/nxt_conf_validation.c | 11 |
1 files 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; - ret = nxt_conf_vldt_type(vldt, name, value, NXT_CONF_VLDT_OBJECT); + 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; } |