From e0130c905cdd63e6caf531603081b21f6a0591d6 Mon Sep 17 00:00:00 2001 From: Stuart Cardall Date: Sun, 1 Jan 2017 18:50:33 +0000 Subject: [PATCH] default_port was removed in 1.11.6 fixes compatibility with nginx 1.11.6+ https://github.com/gnosek/nginx-upstream-fair/pull/23 --- ngx_http_upstream_fair_module.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/ngx_http_upstream_fair_module.c b/ngx_http_upstream_fair_module.c index e0e9974..b0f5226 100644 --- a/ngx_http_upstream_fair_module.c +++ b/ngx_http_upstream_fair_module.c @@ -564,7 +564,11 @@ ngx_http_upstream_init_fair_rr(ngx_conf_t *cf, ngx_http_upstream_srv_conf_t *us) /* an upstream implicitly defined by proxy_pass, etc. */ +#if nginx_version < 1011006 if (us->port == 0 && us->default_port == 0) { +#else + if (us->port == 0) { +#endif ngx_log_error(NGX_LOG_EMERG, cf->log, 0, "no port in upstream \"%V\" in %s:%ui", &us->host, us->file_name, us->line); @@ -574,8 +578,11 @@ ngx_http_upstream_init_fair_rr(ngx_conf_t *cf, ngx_http_upstream_srv_conf_t *us) ngx_memzero(&u, sizeof(ngx_url_t)); u.host = us->host; +#if nginx_version < 1011006 u.port = (in_port_t) (us->port ? us->port : us->default_port); - +#else + u.port = (in_port_t) us->port; +#endif if (ngx_inet_resolve_host(cf->pool, &u) != NGX_OK) { if (u.err) { ngx_log_error(NGX_LOG_EMERG, cf->log, 0,