Sergey Kandaurov
March 25, 2024 10:48AM
details: https://hg.nginx.org/nginx/rev/96ff3f8b7e50
branches:
changeset: 9225:96ff3f8b7e50
user: Sergey Kandaurov <pluknet@nginx.com>
date: Fri Mar 22 18:39:50 2024 +0400
description:
Stream: $server_name.

diffstat:

src/stream/ngx_stream_variables.c | 23 +++++++++++++++++++++++
1 files changed, 23 insertions(+), 0 deletions(-)

diffs (47 lines):

diff -r 6317e21a15e0 -r 96ff3f8b7e50 src/stream/ngx_stream_variables.c
--- a/src/stream/ngx_stream_variables.c Thu Jan 18 19:12:38 2024 +0400
+++ b/src/stream/ngx_stream_variables.c Fri Mar 22 18:39:50 2024 +0400
@@ -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@nginx.org
https://mailman.nginx.org/mailman/listinfo/nginx-devel
Subject Author Views Posted

[nginx] Stream: $server_name.

Sergey Kandaurov 138 March 25, 2024 10:48AM



Sorry, you do not have permission to post/reply in this forum.

Online Users

Guests: 79
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready