comparison src/stream/ngx_stream_proxy_module.c @ 7831:bdd4d89370a7

Changed complex value slots to use NGX_CONF_UNSET_PTR. With this change, it is now possible to use ngx_conf_merge_ptr_value() to merge complex values. This change follows much earlier changes in ngx_conf_merge_ptr_value() and ngx_conf_set_str_array_slot() in 1452:cd586e963db0 (0.6.10) and 1701:40d004d95d88 (0.6.22), and the change in ngx_conf_set_keyval_slot() (7728:485dba3e2a01, 1.19.4). To preserve compatibility with existing 3rd party modules, both NULL and NGX_CONF_UNSET_PTR are accepted for now.
author Maxim Dounin <mdounin@mdounin.ru>
date Thu, 06 May 2021 02:22:03 +0300
parents 7ce28b4cc57e
children 3ab8e1e2f0f7
comparison
equal deleted inserted replaced
7830:f2ff291bbdac 7831:bdd4d89370a7
1975 /* 1975 /*
1976 * set by ngx_pcalloc(): 1976 * set by ngx_pcalloc():
1977 * 1977 *
1978 * conf->ssl_protocols = 0; 1978 * conf->ssl_protocols = 0;
1979 * conf->ssl_ciphers = { 0, NULL }; 1979 * conf->ssl_ciphers = { 0, NULL };
1980 * conf->ssl_name = NULL;
1981 * conf->ssl_trusted_certificate = { 0, NULL }; 1980 * conf->ssl_trusted_certificate = { 0, NULL };
1982 * conf->ssl_crl = { 0, NULL }; 1981 * conf->ssl_crl = { 0, NULL };
1983 * conf->ssl_certificate = { 0, NULL }; 1982 * conf->ssl_certificate = { 0, NULL };
1984 * conf->ssl_certificate_key = { 0, NULL }; 1983 * conf->ssl_certificate_key = { 0, NULL };
1985 * 1984 *
1986 * conf->upload_rate = NULL;
1987 * conf->download_rate = NULL;
1988 * conf->ssl = NULL; 1985 * conf->ssl = NULL;
1989 * conf->upstream = NULL; 1986 * conf->upstream = NULL;
1990 * conf->upstream_value = NULL; 1987 * conf->upstream_value = NULL;
1991 */ 1988 */
1992 1989
1993 conf->connect_timeout = NGX_CONF_UNSET_MSEC; 1990 conf->connect_timeout = NGX_CONF_UNSET_MSEC;
1994 conf->timeout = NGX_CONF_UNSET_MSEC; 1991 conf->timeout = NGX_CONF_UNSET_MSEC;
1995 conf->next_upstream_timeout = NGX_CONF_UNSET_MSEC; 1992 conf->next_upstream_timeout = NGX_CONF_UNSET_MSEC;
1996 conf->buffer_size = NGX_CONF_UNSET_SIZE; 1993 conf->buffer_size = NGX_CONF_UNSET_SIZE;
1994 conf->upload_rate = NGX_CONF_UNSET_PTR;
1995 conf->download_rate = NGX_CONF_UNSET_PTR;
1997 conf->requests = NGX_CONF_UNSET_UINT; 1996 conf->requests = NGX_CONF_UNSET_UINT;
1998 conf->responses = NGX_CONF_UNSET_UINT; 1997 conf->responses = NGX_CONF_UNSET_UINT;
1999 conf->next_upstream_tries = NGX_CONF_UNSET_UINT; 1998 conf->next_upstream_tries = NGX_CONF_UNSET_UINT;
2000 conf->next_upstream = NGX_CONF_UNSET; 1999 conf->next_upstream = NGX_CONF_UNSET;
2001 conf->proxy_protocol = NGX_CONF_UNSET; 2000 conf->proxy_protocol = NGX_CONF_UNSET;
2003 conf->socket_keepalive = NGX_CONF_UNSET; 2002 conf->socket_keepalive = NGX_CONF_UNSET;
2004 2003
2005 #if (NGX_STREAM_SSL) 2004 #if (NGX_STREAM_SSL)
2006 conf->ssl_enable = NGX_CONF_UNSET; 2005 conf->ssl_enable = NGX_CONF_UNSET;
2007 conf->ssl_session_reuse = NGX_CONF_UNSET; 2006 conf->ssl_session_reuse = NGX_CONF_UNSET;
2007 conf->ssl_name = NGX_CONF_UNSET_PTR;
2008 conf->ssl_server_name = NGX_CONF_UNSET; 2008 conf->ssl_server_name = NGX_CONF_UNSET;
2009 conf->ssl_verify = NGX_CONF_UNSET; 2009 conf->ssl_verify = NGX_CONF_UNSET;
2010 conf->ssl_verify_depth = NGX_CONF_UNSET_UINT; 2010 conf->ssl_verify_depth = NGX_CONF_UNSET_UINT;
2011 conf->ssl_passwords = NGX_CONF_UNSET_PTR; 2011 conf->ssl_passwords = NGX_CONF_UNSET_PTR;
2012 conf->ssl_conf_commands = NGX_CONF_UNSET_PTR; 2012 conf->ssl_conf_commands = NGX_CONF_UNSET_PTR;
2032 prev->next_upstream_timeout, 0); 2032 prev->next_upstream_timeout, 0);
2033 2033
2034 ngx_conf_merge_size_value(conf->buffer_size, 2034 ngx_conf_merge_size_value(conf->buffer_size,
2035 prev->buffer_size, 16384); 2035 prev->buffer_size, 16384);
2036 2036
2037 if (conf->upload_rate == NULL) { 2037 ngx_conf_merge_ptr_value(conf->upload_rate, prev->upload_rate, NULL);
2038 conf->upload_rate = prev->upload_rate; 2038
2039 } 2039 ngx_conf_merge_ptr_value(conf->download_rate, prev->download_rate, NULL);
2040
2041 if (conf->download_rate == NULL) {
2042 conf->download_rate = prev->download_rate;
2043 }
2044 2040
2045 ngx_conf_merge_uint_value(conf->requests, 2041 ngx_conf_merge_uint_value(conf->requests,
2046 prev->requests, 0); 2042 prev->requests, 0);
2047 2043
2048 ngx_conf_merge_uint_value(conf->responses, 2044 ngx_conf_merge_uint_value(conf->responses,
2071 (NGX_CONF_BITMASK_SET|NGX_SSL_TLSv1 2067 (NGX_CONF_BITMASK_SET|NGX_SSL_TLSv1
2072 |NGX_SSL_TLSv1_1|NGX_SSL_TLSv1_2)); 2068 |NGX_SSL_TLSv1_1|NGX_SSL_TLSv1_2));
2073 2069
2074 ngx_conf_merge_str_value(conf->ssl_ciphers, prev->ssl_ciphers, "DEFAULT"); 2070 ngx_conf_merge_str_value(conf->ssl_ciphers, prev->ssl_ciphers, "DEFAULT");
2075 2071
2076 if (conf->ssl_name == NULL) { 2072 ngx_conf_merge_ptr_value(conf->ssl_name, prev->ssl_name, NULL);
2077 conf->ssl_name = prev->ssl_name;
2078 }
2079 2073
2080 ngx_conf_merge_value(conf->ssl_server_name, prev->ssl_server_name, 0); 2074 ngx_conf_merge_value(conf->ssl_server_name, prev->ssl_server_name, 0);
2081 2075
2082 ngx_conf_merge_value(conf->ssl_verify, prev->ssl_verify, 0); 2076 ngx_conf_merge_value(conf->ssl_verify, prev->ssl_verify, 0);
2083 2077