Mercurial > hg > nginx
comparison src/stream/ngx_stream_core_module.c @ 6680:7357abd1fa8c
Stream: the "proxy_protocol" parameter of the "listen" directive.
author | Dmitry Volyntsev <xeioex@nginx.com> |
---|---|
date | Tue, 06 Sep 2016 21:28:16 +0300 |
parents | 3d5202c71f94 |
children | 4a16fceea03b |
comparison
equal
deleted
inserted
replaced
6679:40e8ce405859 | 6680:7357abd1fa8c |
---|---|
75 ngx_conf_set_msec_slot, | 75 ngx_conf_set_msec_slot, |
76 NGX_STREAM_SRV_CONF_OFFSET, | 76 NGX_STREAM_SRV_CONF_OFFSET, |
77 offsetof(ngx_stream_core_srv_conf_t, resolver_timeout), | 77 offsetof(ngx_stream_core_srv_conf_t, resolver_timeout), |
78 NULL }, | 78 NULL }, |
79 | 79 |
80 { ngx_string("proxy_protocol_timeout"), | |
81 NGX_STREAM_MAIN_CONF|NGX_STREAM_SRV_CONF|NGX_CONF_TAKE1, | |
82 ngx_conf_set_msec_slot, | |
83 NGX_STREAM_SRV_CONF_OFFSET, | |
84 offsetof(ngx_stream_core_srv_conf_t, proxy_protocol_timeout), | |
85 NULL }, | |
86 | |
80 { ngx_string("tcp_nodelay"), | 87 { ngx_string("tcp_nodelay"), |
81 NGX_STREAM_MAIN_CONF|NGX_STREAM_SRV_CONF|NGX_CONF_FLAG, | 88 NGX_STREAM_MAIN_CONF|NGX_STREAM_SRV_CONF|NGX_CONF_FLAG, |
82 ngx_conf_set_flag_slot, | 89 ngx_conf_set_flag_slot, |
83 NGX_STREAM_SRV_CONF_OFFSET, | 90 NGX_STREAM_SRV_CONF_OFFSET, |
84 offsetof(ngx_stream_core_srv_conf_t, tcp_nodelay), | 91 offsetof(ngx_stream_core_srv_conf_t, tcp_nodelay), |
190 */ | 197 */ |
191 | 198 |
192 cscf->file_name = cf->conf_file->file.name.data; | 199 cscf->file_name = cf->conf_file->file.name.data; |
193 cscf->line = cf->conf_file->line; | 200 cscf->line = cf->conf_file->line; |
194 cscf->resolver_timeout = NGX_CONF_UNSET_MSEC; | 201 cscf->resolver_timeout = NGX_CONF_UNSET_MSEC; |
202 cscf->proxy_protocol_timeout = NGX_CONF_UNSET_MSEC; | |
195 cscf->tcp_nodelay = NGX_CONF_UNSET; | 203 cscf->tcp_nodelay = NGX_CONF_UNSET; |
196 | 204 |
197 return cscf; | 205 return cscf; |
198 } | 206 } |
199 | 207 |
237 conf->error_log = prev->error_log; | 245 conf->error_log = prev->error_log; |
238 } else { | 246 } else { |
239 conf->error_log = &cf->cycle->new_log; | 247 conf->error_log = &cf->cycle->new_log; |
240 } | 248 } |
241 } | 249 } |
250 | |
251 ngx_conf_merge_msec_value(conf->proxy_protocol_timeout, | |
252 prev->proxy_protocol_timeout, 5000); | |
242 | 253 |
243 ngx_conf_merge_value(conf->tcp_nodelay, prev->tcp_nodelay, 1); | 254 ngx_conf_merge_value(conf->tcp_nodelay, prev->tcp_nodelay, 1); |
244 | 255 |
245 return NGX_CONF_OK; | 256 return NGX_CONF_OK; |
246 } | 257 } |
570 &value[i].data[13]); | 581 &value[i].data[13]); |
571 return NGX_CONF_ERROR; | 582 return NGX_CONF_ERROR; |
572 #endif | 583 #endif |
573 } | 584 } |
574 | 585 |
586 if (ngx_strcmp(value[i].data, "proxy_protocol") == 0) { | |
587 ls->proxy_protocol = 1; | |
588 continue; | |
589 } | |
590 | |
575 ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, | 591 ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, |
576 "the invalid \"%V\" parameter", &value[i]); | 592 "the invalid \"%V\" parameter", &value[i]); |
577 return NGX_CONF_ERROR; | 593 return NGX_CONF_ERROR; |
578 } | 594 } |
579 | 595 |
588 } | 604 } |
589 #endif | 605 #endif |
590 | 606 |
591 if (ls->so_keepalive) { | 607 if (ls->so_keepalive) { |
592 return "\"so_keepalive\" parameter is incompatible with \"udp\""; | 608 return "\"so_keepalive\" parameter is incompatible with \"udp\""; |
609 } | |
610 | |
611 if (ls->proxy_protocol) { | |
612 return "\"proxy_protocol\" parameter is incompatible with \"udp\""; | |
593 } | 613 } |
594 } | 614 } |
595 | 615 |
596 als = cmcf->listen.elts; | 616 als = cmcf->listen.elts; |
597 | 617 |