Welcome! Log In Create A New Profile

Advanced

[PATCH] Stream: allow servers with no handler

Roman Arutyunyan
June 27, 2024 09:36AM
# HG changeset patch
# User Roman Arutyunyan <arut@nginx.com>
# Date 1719494996 -14400
# Thu Jun 27 17:29:56 2024 +0400
# Node ID 252582428b60f3422aa3b25dac8cca94edd43c34
# Parent 4fbc38ad3c8a8ed7986aaaa76b8aceda5ed70ef3
Stream: allow servers with no handler.

Previously handlers were mandatory. However they are not always needed.
For example, a server configured with ssl_reject_handshake does not need a
handler. Such servers required a fake handler to pass the check. Now handler
absence check is moved to runtime. If handler is missing, the connection is
closed with 500 code.

diff --git a/src/stream/ngx_stream_core_module.c b/src/stream/ngx_stream_core_module.c
--- a/src/stream/ngx_stream_core_module.c
+++ b/src/stream/ngx_stream_core_module.c
@@ -458,6 +458,13 @@ ngx_stream_core_content_phase(ngx_stream
return NGX_OK;
}

+ if (cscf->handler == NULL) {
+ ngx_log_debug0(NGX_LOG_DEBUG_STREAM, c->log, 0,
+ "no handler for server");
+ ngx_stream_finalize_session(s, NGX_STREAM_INTERNAL_SERVER_ERROR);
+ return NGX_OK;
+ }
+
cscf->handler(s);

return NGX_OK;
@@ -734,13 +741,6 @@ ngx_stream_core_merge_srv_conf(ngx_conf_
conf->resolver = prev->resolver;
}

- if (conf->handler == NULL) {
- ngx_log_error(NGX_LOG_EMERG, cf->log, 0,
- "no handler for server in %s:%ui",
- conf->file_name, conf->line);
- return NGX_CONF_ERROR;
- }
-
if (conf->error_log == NULL) {
if (prev->error_log) {
conf->error_log = prev->error_log;
_______________________________________________
nginx-devel mailing list
nginx-devel@nginx.org
https://mailman.nginx.org/mailman/listinfo/nginx-devel
Subject Author Views Posted

[PATCH] Stream: allow servers with no handler

Roman Arutyunyan 156 June 27, 2024 09:36AM

Re: [PATCH] Stream: allow servers with no handler

Sergey Kandaurov 20 July 11, 2024 08:14AM



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

Online Users

Guests: 186
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 500 on July 15, 2024
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready