details: http://freenginx.org/hg/nginx/rev/54c96bb0bbfa branches: changeset: 9353:54c96bb0bbfa user: Maxim Dounin <mdou...@mdounin.ru> date: Wed May 14 01:15:05 2025 +0300 description: Stream: style.
Moved SSL configuration parsing functions to the end of the file, where configuration parsing should be. diffstat: src/stream/ngx_stream_proxy_module.c | 82 ++++++++++++++++++----------------- 1 files changed, 43 insertions(+), 39 deletions(-) diffs (110 lines): diff --git a/src/stream/ngx_stream_proxy_module.c b/src/stream/ngx_stream_proxy_module.c --- a/src/stream/ngx_stream_proxy_module.c +++ b/src/stream/ngx_stream_proxy_module.c @@ -94,10 +94,6 @@ static char *ngx_stream_proxy_bind(ngx_c #if (NGX_STREAM_SSL) static ngx_int_t ngx_stream_proxy_send_proxy_protocol(ngx_stream_session_t *s); -static char *ngx_stream_proxy_ssl_password_file(ngx_conf_t *cf, - ngx_command_t *cmd, void *conf); -static char *ngx_stream_proxy_ssl_conf_command_check(ngx_conf_t *cf, void *post, - void *data); static void ngx_stream_proxy_ssl_init_connection(ngx_stream_session_t *s); static void ngx_stream_proxy_ssl_handshake(ngx_connection_t *pc); static void ngx_stream_proxy_ssl_save_session(ngx_connection_t *c); @@ -107,6 +103,10 @@ static ngx_int_t ngx_stream_proxy_merge_ ngx_stream_proxy_srv_conf_t *conf, ngx_stream_proxy_srv_conf_t *prev); static ngx_int_t ngx_stream_proxy_set_ssl(ngx_conf_t *cf, ngx_stream_proxy_srv_conf_t *pscf); +static char *ngx_stream_proxy_ssl_password_file(ngx_conf_t *cf, + ngx_command_t *cmd, void *conf); +static char *ngx_stream_proxy_ssl_conf_command_check(ngx_conf_t *cf, void *post, + void *data); static ngx_conf_bitmask_t ngx_stream_proxy_ssl_protocols[] = { @@ -1010,41 +1010,6 @@ ngx_stream_proxy_send_proxy_protocol(ngx } -static char * -ngx_stream_proxy_ssl_password_file(ngx_conf_t *cf, ngx_command_t *cmd, - void *conf) -{ - ngx_stream_proxy_srv_conf_t *pscf = conf; - - ngx_str_t *value; - - if (pscf->ssl_passwords != NGX_CONF_UNSET_PTR) { - return "is duplicate"; - } - - value = cf->args->elts; - - pscf->ssl_passwords = ngx_ssl_read_password_file(cf, &value[1]); - - if (pscf->ssl_passwords == NULL) { - return NGX_CONF_ERROR; - } - - return NGX_CONF_OK; -} - - -static char * -ngx_stream_proxy_ssl_conf_command_check(ngx_conf_t *cf, void *post, void *data) -{ -#ifndef SSL_CONF_FLAG_FILE - return "is not supported on this platform"; -#else - return NGX_CONF_OK; -#endif -} - - static void ngx_stream_proxy_ssl_init_connection(ngx_stream_session_t *s) { @@ -2518,3 +2483,42 @@ ngx_stream_proxy_bind(ngx_conf_t *cf, ng return NGX_CONF_OK; } + + +#if (NGX_STREAM_SSL) + +static char * +ngx_stream_proxy_ssl_password_file(ngx_conf_t *cf, ngx_command_t *cmd, + void *conf) +{ + ngx_stream_proxy_srv_conf_t *pscf = conf; + + ngx_str_t *value; + + if (pscf->ssl_passwords != NGX_CONF_UNSET_PTR) { + return "is duplicate"; + } + + value = cf->args->elts; + + pscf->ssl_passwords = ngx_ssl_read_password_file(cf, &value[1]); + + if (pscf->ssl_passwords == NULL) { + return NGX_CONF_ERROR; + } + + return NGX_CONF_OK; +} + + +static char * +ngx_stream_proxy_ssl_conf_command_check(ngx_conf_t *cf, void *post, void *data) +{ +#ifndef SSL_CONF_FLAG_FILE + return "is not supported on this platform"; +#else + return NGX_CONF_OK; +#endif +} + +#endif