aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorVladimir Homutov <vl@nginx.com>2016-06-15 15:10:24 +0300
committerVladimir Homutov <vl@nginx.com>2016-06-15 15:10:24 +0300
commitdb5a15d2f92a592d0d312252c0294932a4bd6068 (patch)
tree377543ae38cb7747ba9af7e0de91f8897a90709a /src
parentc9dae918fdf370367e2dfd92f3b19853783c9fc9 (diff)
downloadnginx-db5a15d2f92a592d0d312252c0294932a4bd6068.tar.gz
nginx-db5a15d2f92a592d0d312252c0294932a4bd6068.zip
Stream: added preconfiguration step.
Diffstat (limited to 'src')
-rw-r--r--src/stream/ngx_stream.c19
-rw-r--r--src/stream/ngx_stream.h1
-rw-r--r--src/stream/ngx_stream_access_module.c1
-rw-r--r--src/stream/ngx_stream_core_module.c1
-rw-r--r--src/stream/ngx_stream_limit_conn_module.c1
-rw-r--r--src/stream/ngx_stream_proxy_module.c1
-rw-r--r--src/stream/ngx_stream_ssl_module.c1
-rw-r--r--src/stream/ngx_stream_upstream.c1
-rw-r--r--src/stream/ngx_stream_upstream_hash_module.c1
-rw-r--r--src/stream/ngx_stream_upstream_least_conn_module.c1
-rw-r--r--src/stream/ngx_stream_upstream_zone_module.c1
11 files changed, 27 insertions, 2 deletions
diff --git a/src/stream/ngx_stream.c b/src/stream/ngx_stream.c
index 5e7abaebe..ea731458e 100644
--- a/src/stream/ngx_stream.c
+++ b/src/stream/ngx_stream.c
@@ -143,11 +143,26 @@ ngx_stream_block(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
}
- /* parse inside the stream{} block */
-
pcf = *cf;
cf->ctx = ctx;
+ for (m = 0; cf->cycle->modules[m]; m++) {
+ if (cf->cycle->modules[m]->type != NGX_STREAM_MODULE) {
+ continue;
+ }
+
+ module = cf->cycle->modules[m]->ctx;
+
+ if (module->preconfiguration) {
+ if (module->preconfiguration(cf) != NGX_OK) {
+ return NGX_CONF_ERROR;
+ }
+ }
+ }
+
+
+ /* parse inside the stream{} block */
+
cf->module_type = NGX_STREAM_MODULE;
cf->cmd_type = NGX_STREAM_MAIN_CONF;
rv = ngx_conf_parse(cf, NULL);
diff --git a/src/stream/ngx_stream.h b/src/stream/ngx_stream.h
index 1c3517386..ffa855cdf 100644
--- a/src/stream/ngx_stream.h
+++ b/src/stream/ngx_stream.h
@@ -145,6 +145,7 @@ struct ngx_stream_session_s {
typedef struct {
+ ngx_int_t (*preconfiguration)(ngx_conf_t *cf);
ngx_int_t (*postconfiguration)(ngx_conf_t *cf);
void *(*create_main_conf)(ngx_conf_t *cf);
diff --git a/src/stream/ngx_stream_access_module.c b/src/stream/ngx_stream_access_module.c
index 64869d230..6985d36a1 100644
--- a/src/stream/ngx_stream_access_module.c
+++ b/src/stream/ngx_stream_access_module.c
@@ -88,6 +88,7 @@ static ngx_command_t ngx_stream_access_commands[] = {
static ngx_stream_module_t ngx_stream_access_module_ctx = {
+ NULL, /* preconfiguration */
ngx_stream_access_init, /* postconfiguration */
NULL, /* create main configuration */
diff --git a/src/stream/ngx_stream_core_module.c b/src/stream/ngx_stream_core_module.c
index 075db82bb..2ed792bd1 100644
--- a/src/stream/ngx_stream_core_module.c
+++ b/src/stream/ngx_stream_core_module.c
@@ -57,6 +57,7 @@ static ngx_command_t ngx_stream_core_commands[] = {
static ngx_stream_module_t ngx_stream_core_module_ctx = {
+ NULL, /* preconfiguration */
NULL, /* postconfiguration */
ngx_stream_core_create_main_conf, /* create main configuration */
diff --git a/src/stream/ngx_stream_limit_conn_module.c b/src/stream/ngx_stream_limit_conn_module.c
index c27d7484a..8c70a8239 100644
--- a/src/stream/ngx_stream_limit_conn_module.c
+++ b/src/stream/ngx_stream_limit_conn_module.c
@@ -93,6 +93,7 @@ static ngx_command_t ngx_stream_limit_conn_commands[] = {
static ngx_stream_module_t ngx_stream_limit_conn_module_ctx = {
+ NULL, /* preconfiguration */
ngx_stream_limit_conn_init, /* postconfiguration */
NULL, /* create main configuration */
diff --git a/src/stream/ngx_stream_proxy_module.c b/src/stream/ngx_stream_proxy_module.c
index d7df72c9a..fdffd15be 100644
--- a/src/stream/ngx_stream_proxy_module.c
+++ b/src/stream/ngx_stream_proxy_module.c
@@ -314,6 +314,7 @@ static ngx_command_t ngx_stream_proxy_commands[] = {
static ngx_stream_module_t ngx_stream_proxy_module_ctx = {
+ NULL, /* preconfiguration */
NULL, /* postconfiguration */
NULL, /* create main configuration */
diff --git a/src/stream/ngx_stream_ssl_module.c b/src/stream/ngx_stream_ssl_module.c
index 9c559c635..095bdaebc 100644
--- a/src/stream/ngx_stream_ssl_module.c
+++ b/src/stream/ngx_stream_ssl_module.c
@@ -132,6 +132,7 @@ static ngx_command_t ngx_stream_ssl_commands[] = {
static ngx_stream_module_t ngx_stream_ssl_module_ctx = {
+ NULL, /* preconfiguration */
NULL, /* postconfiguration */
NULL, /* create main configuration */
diff --git a/src/stream/ngx_stream_upstream.c b/src/stream/ngx_stream_upstream.c
index 69dddc5b4..36d05cc88 100644
--- a/src/stream/ngx_stream_upstream.c
+++ b/src/stream/ngx_stream_upstream.c
@@ -39,6 +39,7 @@ static ngx_command_t ngx_stream_upstream_commands[] = {
static ngx_stream_module_t ngx_stream_upstream_module_ctx = {
+ NULL, /* preconfiguration */
NULL, /* postconfiguration */
ngx_stream_upstream_create_main_conf, /* create main configuration */
diff --git a/src/stream/ngx_stream_upstream_hash_module.c b/src/stream/ngx_stream_upstream_hash_module.c
index 56ff7d6e9..f200f47a7 100644
--- a/src/stream/ngx_stream_upstream_hash_module.c
+++ b/src/stream/ngx_stream_upstream_hash_module.c
@@ -76,6 +76,7 @@ static ngx_command_t ngx_stream_upstream_hash_commands[] = {
static ngx_stream_module_t ngx_stream_upstream_hash_module_ctx = {
+ NULL, /* preconfiguration */
NULL, /* postconfiguration */
NULL, /* create main configuration */
diff --git a/src/stream/ngx_stream_upstream_least_conn_module.c b/src/stream/ngx_stream_upstream_least_conn_module.c
index c9719f92e..359d78808 100644
--- a/src/stream/ngx_stream_upstream_least_conn_module.c
+++ b/src/stream/ngx_stream_upstream_least_conn_module.c
@@ -32,6 +32,7 @@ static ngx_command_t ngx_stream_upstream_least_conn_commands[] = {
static ngx_stream_module_t ngx_stream_upstream_least_conn_module_ctx = {
+ NULL, /* preconfiguration */
NULL, /* postconfiguration */
NULL, /* create main configuration */
diff --git a/src/stream/ngx_stream_upstream_zone_module.c b/src/stream/ngx_stream_upstream_zone_module.c
index ffc9e8a69..ddcc093c0 100644
--- a/src/stream/ngx_stream_upstream_zone_module.c
+++ b/src/stream/ngx_stream_upstream_zone_module.c
@@ -32,6 +32,7 @@ static ngx_command_t ngx_stream_upstream_zone_commands[] = {
static ngx_stream_module_t ngx_stream_upstream_zone_module_ctx = {
+ NULL, /* preconfiguration */
NULL, /* postconfiguration */
NULL, /* create main configuration */