aboutsummaryrefslogtreecommitdiff
path: root/src/core
diff options
context:
space:
mode:
Diffstat (limited to 'src/core')
-rw-r--r--src/core/nginx.c7
-rw-r--r--src/core/nginx.h1
-rw-r--r--src/core/ngx_conf_file.c2
-rw-r--r--src/core/ngx_conf_file.h4
-rw-r--r--src/core/ngx_config.h1
-rw-r--r--src/core/ngx_core.h6
-rw-r--r--src/core/ngx_modules.c20
7 files changed, 29 insertions, 12 deletions
diff --git a/src/core/nginx.c b/src/core/nginx.c
index 895d13666..36a28f887 100644
--- a/src/core/nginx.c
+++ b/src/core/nginx.c
@@ -36,6 +36,8 @@ ngx_log_t ngx_log;
ngx_pool_t *ngx_pool;
+int ngx_max_module;
+
int ngx_connection_counter;
ngx_array_t ngx_listening_sockets;
@@ -68,6 +70,11 @@ int main(int argc, char *const *argv)
ngx_init_array(ngx_listening_sockets, ngx_pool, 10, sizeof(ngx_listen_t),
1);
+ ngx_max_module = 0;
+ for (i = 0; ngx_modules[i]; i++) {
+ ngx_modules[i]->index = ngx_max_module++;
+ }
+
ngx_memzero(&conf, sizeof(ngx_conf_t));
ngx_test_null(conf.args,
ngx_create_array(ngx_pool, 10, sizeof(ngx_str_t)), 1);
diff --git a/src/core/nginx.h b/src/core/nginx.h
index 94d678fd2..df00addc1 100644
--- a/src/core/nginx.h
+++ b/src/core/nginx.h
@@ -5,6 +5,7 @@
#define NGINX_VER "nginx/0.0.1"
+extern int ngx_max_module;
extern int ngx_connection_counter;
diff --git a/src/core/ngx_conf_file.c b/src/core/ngx_conf_file.c
index de3bf75a0..12537bd63 100644
--- a/src/core/ngx_conf_file.c
+++ b/src/core/ngx_conf_file.c
@@ -130,7 +130,7 @@ ngx_log_debug(cf->log, "command '%s'" _ cmd->name.data);
pconf = *(void **) ((char *) cf->ctx + cmd->conf);
if (pconf) {
- conf = pconf[ngx_modules[i]->index];
+ conf = pconf[*(int *)(ngx_modules[i]->ctx)];
}
}
diff --git a/src/core/ngx_conf_file.h b/src/core/ngx_conf_file.h
index 56ed4a1d7..beb148a13 100644
--- a/src/core/ngx_conf_file.h
+++ b/src/core/ngx_conf_file.h
@@ -31,8 +31,8 @@
#define NGX_CONF_FILE_DONE 2
-#define NGX_CORE_MODULE_TYPE 0x45524f43 /* "CORE" */
-#define NGX_CONF_MODULE_TYPE 0x464E4f43 /* "CONF" */
+#define NGX_CORE_MODULE_TYPE 0x45524F43 /* "CORE" */
+#define NGX_CONF_MODULE_TYPE 0x464E4F43 /* "CONF" */
typedef struct ngx_conf_s ngx_conf_t;
diff --git a/src/core/ngx_config.h b/src/core/ngx_config.h
index 6b26ad826..3df08568c 100644
--- a/src/core/ngx_config.h
+++ b/src/core/ngx_config.h
@@ -93,6 +93,7 @@
#include <sys/uio.h>
#include <netinet/in.h>
#include <arpa/inet.h>
+#include <netdb.h>
#ifndef HAVE_POLL
diff --git a/src/core/ngx_core.h b/src/core/ngx_core.h
index 882b256eb..fd5bb9273 100644
--- a/src/core/ngx_core.h
+++ b/src/core/ngx_core.h
@@ -4,11 +4,15 @@
#define NGX_OK 0
#define NGX_ERROR -1
-#define NGX_DONE NGX_ERROR
#define NGX_AGAIN -2
+#define NGX_DONE -3
+/*
#define NGX_BUSY -3
+*/
#define NGX_DECLINED -4
+/*
#define NGX_ALERT -5
+*/
#define NGX_MAXHOSTNAMELEN 32
diff --git a/src/core/ngx_modules.c b/src/core/ngx_modules.c
index e07c4e6ba..165d52731 100644
--- a/src/core/ngx_modules.c
+++ b/src/core/ngx_modules.c
@@ -4,28 +4,32 @@
#include <ngx_conf_file.h>
-extern ngx_module_t ngx_http_header_filter_module;
+extern ngx_module_t ngx_http_module;
+extern ngx_module_t ngx_http_core_module;
extern ngx_module_t ngx_http_write_filter_module;
extern ngx_module_t ngx_http_output_filter_module;
+extern ngx_module_t ngx_http_header_filter_module;
-extern ngx_module_t ngx_http_core_module;
extern ngx_module_t ngx_http_index_module;
-
-extern ngx_module_t ngx_http_module;
+extern ngx_module_t ngx_http_proxy_module;
ngx_module_t *ngx_modules[] = {
- &ngx_http_header_filter_module,
+ &ngx_http_module,
+ &ngx_http_core_module,
&ngx_http_write_filter_module,
&ngx_http_output_filter_module,
+ &ngx_http_header_filter_module,
- &ngx_http_index_module,
- &ngx_http_core_module,
+ /* &ngx_http_gzip_filter_module, */
+ /* &ngx_http_range_filter_module, */
+ /* &ngx_http_ssi_filter_module, */
- &ngx_http_module,
+ &ngx_http_index_module,
+ &ngx_http_proxy_module,
NULL
};