[PATCH] Stream: $server_name
Roman Arutyunyan
arut at nginx.com
Sat Mar 23 07:25:55 UTC 2024
Hi,
On Fri, Mar 22, 2024 at 06:41:12PM +0400, Sergey Kandaurov wrote:
> # HG changeset patch
> # User Sergey Kandaurov <pluknet at nginx.com>
> # Date 1711118390 -14400
> # Fri Mar 22 18:39:50 2024 +0400
> # Node ID 96ff3f8b7e508a345c18bb1e1071f248f1e5a75c
> # Parent 6317e21a15e083a215b52480b8ef473fdfe34158
> Stream: $server_name.
>
> diff --git a/src/stream/ngx_stream_variables.c b/src/stream/ngx_stream_variables.c
> --- a/src/stream/ngx_stream_variables.c
> +++ b/src/stream/ngx_stream_variables.c
> @@ -29,6 +29,8 @@ static ngx_int_t ngx_stream_variable_ser
> ngx_stream_variable_value_t *v, uintptr_t data);
> static ngx_int_t ngx_stream_variable_server_port(ngx_stream_session_t *s,
> ngx_stream_variable_value_t *v, uintptr_t data);
> +static ngx_int_t ngx_stream_variable_server_name(ngx_stream_session_t *s,
> + ngx_stream_variable_value_t *v, uintptr_t data);
> static ngx_int_t ngx_stream_variable_bytes(ngx_stream_session_t *s,
> ngx_stream_variable_value_t *v, uintptr_t data);
> static ngx_int_t ngx_stream_variable_session_time(ngx_stream_session_t *s,
> @@ -91,6 +93,9 @@ static ngx_stream_variable_t ngx_stream
> { ngx_string("server_port"), NULL,
> ngx_stream_variable_server_port, 0, 0, 0 },
>
> + { ngx_string("server_name"), NULL, ngx_stream_variable_server_name,
> + 0, 0, 0 },
> +
> { ngx_string("bytes_sent"), NULL, ngx_stream_variable_bytes,
> 0, 0, 0 },
>
> @@ -722,6 +727,24 @@ ngx_stream_variable_server_port(ngx_stre
>
>
> static ngx_int_t
> +ngx_stream_variable_server_name(ngx_stream_session_t *s,
> + ngx_stream_variable_value_t *v, uintptr_t data)
> +{
> + ngx_stream_core_srv_conf_t *cscf;
> +
> + cscf = ngx_stream_get_module_srv_conf(s, ngx_stream_core_module);
> +
> + v->len = cscf->server_name.len;
> + v->valid = 1;
> + v->no_cacheable = 0;
> + v->not_found = 0;
> + v->data = cscf->server_name.data;
> +
> + return NGX_OK;
> +}
> +
> +
> +static ngx_int_t
> ngx_stream_variable_bytes(ngx_stream_session_t *s,
> ngx_stream_variable_value_t *v, uintptr_t data)
> {
> _______________________________________________
> nginx-devel mailing list
> nginx-devel at nginx.org
> https://mailman.nginx.org/mailman/listinfo/nginx-devel
Looks ok
More information about the nginx-devel
mailing list