Skip to content

Commit e0130c9

Browse files
committed
default_port was removed in 1.11.6
fixes compatibility with nginx 1.11.6+ gnosek#23
1 parent a92aa7a commit e0130c9

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
@@ -564,7 +564,11 @@ ngx_http_upstream_init_fair_rr(ngx_conf_t *cf, ngx_http_upstream_srv_conf_t *us)
564564

565565
/* an upstream implicitly defined by proxy_pass, etc. */
566566

567+
#if nginx_version < 1011006
567568
if (us->port == 0 && us->default_port == 0) {
569+
#else
570+
if (us->port == 0) {
571+
#endif
568572
ngx_log_error(NGX_LOG_EMERG, cf->log, 0,
569573
"no port in upstream \"%V\" in %s:%ui",
570574
&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)
574578
ngx_memzero(&u, sizeof(ngx_url_t));
575579

576580
u.host = us->host;
581+
#if nginx_version < 1011006
577582
u.port = (in_port_t) (us->port ? us->port : us->default_port);
578-
583+
#else
584+
u.port = (in_port_t) us->port;
585+
#endif
579586
if (ngx_inet_resolve_host(cf->pool, &u) != NGX_OK) {
580587
if (u.err) {
581588
ngx_log_error(NGX_LOG_EMERG, cf->log, 0,

0 commit comments

Comments
 (0)