Welcome! Log In Create A New Profile

Advanced

[nginx] Upstream: improved configuration parser diagnostics.

Ruslan Ermilov
September 01, 2014 04:50AM
details: http://hg.nginx.org/nginx/rev/fe8bafab5b49
branches:
changeset: 5818:fe8bafab5b49
user: Ruslan Ermilov <ru@nginx.com>
date: Mon Sep 01 12:27:38 2014 +0400
description:
Upstream: improved configuration parser diagnostics.

Made it clear when the selected balancing method does not
support certain parameters of the "server" directive.

diffstat:

src/http/ngx_http_upstream.c | 18 +++++++++++++-----
1 files changed, 13 insertions(+), 5 deletions(-)

diffs (63 lines):

diff -r 74ffe03555d0 -r fe8bafab5b49 src/http/ngx_http_upstream.c
--- a/src/http/ngx_http_upstream.c Fri Aug 29 18:00:10 2014 +0400
+++ b/src/http/ngx_http_upstream.c Mon Sep 01 12:27:38 2014 +0400
@@ -4973,7 +4973,7 @@ ngx_http_upstream_server(ngx_conf_t *cf,
if (ngx_strncmp(value[i].data, "weight=", 7) == 0) {

if (!(uscf->flags & NGX_HTTP_UPSTREAM_WEIGHT)) {
- goto invalid;
+ goto not_supported;
}

weight = ngx_atoi(&value[i].data[7], value[i].len - 7);
@@ -4988,7 +4988,7 @@ ngx_http_upstream_server(ngx_conf_t *cf,
if (ngx_strncmp(value[i].data, "max_fails=", 10) == 0) {

if (!(uscf->flags & NGX_HTTP_UPSTREAM_MAX_FAILS)) {
- goto invalid;
+ goto not_supported;
}

max_fails = ngx_atoi(&value[i].data[10], value[i].len - 10);
@@ -5003,7 +5003,7 @@ ngx_http_upstream_server(ngx_conf_t *cf,
if (ngx_strncmp(value[i].data, "fail_timeout=", 13) == 0) {

if (!(uscf->flags & NGX_HTTP_UPSTREAM_FAIL_TIMEOUT)) {
- goto invalid;
+ goto not_supported;
}

s.len = value[i].len - 13;
@@ -5021,7 +5021,7 @@ ngx_http_upstream_server(ngx_conf_t *cf,
if (ngx_strcmp(value[i].data, "backup") == 0) {

if (!(uscf->flags & NGX_HTTP_UPSTREAM_BACKUP)) {
- goto invalid;
+ goto not_supported;
}

us->backup = 1;
@@ -5032,7 +5032,7 @@ ngx_http_upstream_server(ngx_conf_t *cf,
if (ngx_strcmp(value[i].data, "down") == 0) {

if (!(uscf->flags & NGX_HTTP_UPSTREAM_DOWN)) {
- goto invalid;
+ goto not_supported;
}

us->down = 1;
@@ -5072,6 +5072,14 @@ invalid:
"invalid parameter \"%V\"", &value[i]);

return NGX_CONF_ERROR;
+
+not_supported:
+
+ ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
+ "balancing method does not support parameter \"%V\"",
+ &value[i]);
+
+ return NGX_CONF_ERROR;
}



_______________________________________________
nginx-devel mailing list
nginx-devel@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx-devel
Subject Author Views Posted

[nginx] Upstream: improved configuration parser diagnostics.

Ruslan Ermilov 1250 September 01, 2014 04:50AM



Sorry, you do not have permission to post/reply in this forum.

Online Users

Guests: 139
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 500 on July 15, 2024
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready