Skip to content

Commit 9e33dad

Browse files
itoffshoremingshun
authored andcommitted
default_port was removed in 1.11.6
fixes compatibility with nginx 1.11.6+ gnosek#23
1 parent a18b409 commit 9e33dad

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

ngx_http_upstream_fair_module.c

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -540,7 +540,11 @@ ngx_http_upstream_init_fair_rr(ngx_conf_t *cf, ngx_http_upstream_srv_conf_t *us)
540540

541541
/* an upstream implicitly defined by proxy_pass, etc. */
542542

543+
#if nginx_version < 1011006
543544
if (us->port == 0 && us->default_port == 0) {
545+
#else
546+
if (us->port == 0) {
547+
#endif
544548
ngx_log_error(NGX_LOG_EMERG, cf->log, 0,
545549
"no port in upstream \"%V\" in %s:%ui",
546550
&us->host, us->file_name, us->line);
@@ -550,8 +554,11 @@ ngx_http_upstream_init_fair_rr(ngx_conf_t *cf, ngx_http_upstream_srv_conf_t *us)
550554
ngx_memzero(&u, sizeof(ngx_url_t));
551555

552556
u.host = us->host;
557+
#if nginx_version < 1011006
553558
u.port = (in_port_t) (us->port ? us->port : us->default_port);
554-
559+
#else
560+
u.port = (in_port_t) us->port;
561+
#endif
555562
if (ngx_inet_resolve_host(cf->pool, &u) != NGX_OK) {
556563
if (u.err) {
557564
ngx_log_error(NGX_LOG_EMERG, cf->log, 0,

0 commit comments

Comments
 (0)