summaryrefslogtreecommitdiffhomepage
path: root/src/http
diff options
context:
space:
mode:
authorIgor Sysoev <igor@sysoev.ru>2003-07-02 18:51:41 +0000
committerIgor Sysoev <igor@sysoev.ru>2003-07-02 18:51:41 +0000
commit9d9f58f24d318dad43c7019c40a187555aaa64c8 (patch)
tree0600e4a1f78cf9359472e204604008732e4b301e /src/http
parent96c56c9ab6e73f9d92242fdc4f0cc3b64495bd23 (diff)
downloadnginx-9d9f58f24d318dad43c7019c40a187555aaa64c8.tar.gz
nginx-9d9f58f24d318dad43c7019c40a187555aaa64c8.tar.bz2
nginx-0.0.1-2003-07-02-22:51:41 import
Diffstat (limited to 'src/http')
-rw-r--r--src/http/modules/ngx_http_charset_filter.c8
-rw-r--r--src/http/modules/ngx_http_chunked_filter.c8
-rw-r--r--src/http/modules/ngx_http_index_handler.c17
-rw-r--r--src/http/modules/ngx_http_range_filter.c8
-rw-r--r--src/http/ngx_http.c15
-rw-r--r--src/http/ngx_http_core_module.c20
-rw-r--r--src/http/ngx_http_core_module.h1
-rw-r--r--src/http/ngx_http_header_filter.c8
-rw-r--r--src/http/ngx_http_write_filter.c8
9 files changed, 58 insertions, 35 deletions
diff --git a/src/http/modules/ngx_http_charset_filter.c b/src/http/modules/ngx_http_charset_filter.c
index baf6d9aba..bcddc9222 100644
--- a/src/http/modules/ngx_http_charset_filter.c
+++ b/src/http/modules/ngx_http_charset_filter.c
@@ -12,7 +12,7 @@ typedef struct {
static void *ngx_http_charset_create_loc_conf(ngx_pool_t *pool);
static char *ngx_http_charset_merge_loc_conf(ngx_pool_t *pool,
void *parent, void *child);
-static int ngx_http_charset_filter_init(ngx_pool_t *pool);
+static int ngx_http_charset_filter_init(ngx_cycle_t *cycle, ngx_log_t *log);
static ngx_command_t ngx_http_charset_filter_commands[] = {
@@ -45,7 +45,9 @@ ngx_module_t ngx_http_charset_filter_module = {
&ngx_http_charset_filter_module_ctx, /* module context */
ngx_http_charset_filter_commands, /* module directives */
NGX_HTTP_MODULE, /* module type */
- ngx_http_charset_filter_init /* init module */
+ ngx_http_charset_filter_init, /* init module */
+ NULL, /* commit module */
+ NULL /* rollback module */
};
@@ -85,7 +87,7 @@ static int ngx_http_charset_body_filter(ngx_http_request_t *r, ngx_chain_t *in)
#endif
-static int ngx_http_charset_filter_init(ngx_pool_t *pool)
+static int ngx_http_charset_filter_init(ngx_cycle_t *cycle, ngx_log_t *log)
{
next_header_filter = ngx_http_top_header_filter;
ngx_http_top_header_filter = ngx_http_charset_header_filter;
diff --git a/src/http/modules/ngx_http_chunked_filter.c b/src/http/modules/ngx_http_chunked_filter.c
index bdd0a7c7a..09b480bc0 100644
--- a/src/http/modules/ngx_http_chunked_filter.c
+++ b/src/http/modules/ngx_http_chunked_filter.c
@@ -4,7 +4,7 @@
#include <ngx_http.h>
-static int ngx_http_chunked_filter_init(ngx_pool_t *pool);
+static int ngx_http_chunked_filter_init(ngx_cycle_t *cycle, ngx_log_t *log);
static ngx_http_module_t ngx_http_chunked_filter_module_ctx = {
@@ -24,7 +24,9 @@ ngx_module_t ngx_http_chunked_filter_module = {
&ngx_http_chunked_filter_module_ctx, /* module context */
NULL, /* module directives */
NGX_HTTP_MODULE, /* module type */
- ngx_http_chunked_filter_init /* init module */
+ ngx_http_chunked_filter_init, /* init module */
+ NULL, /* commit module */
+ NULL /* rollback module */
};
@@ -117,7 +119,7 @@ static int ngx_http_chunked_body_filter(ngx_http_request_t *r, ngx_chain_t *in)
}
-static int ngx_http_chunked_filter_init(ngx_pool_t *pool)
+static int ngx_http_chunked_filter_init(ngx_cycle_t *cycle, ngx_log_t *log)
{
next_header_filter = ngx_http_top_header_filter;
ngx_http_top_header_filter = ngx_http_chunked_header_filter;
diff --git a/src/http/modules/ngx_http_index_handler.c b/src/http/modules/ngx_http_index_handler.c
index ffb9779bf..9af012113 100644
--- a/src/http/modules/ngx_http_index_handler.c
+++ b/src/http/modules/ngx_http_index_handler.c
@@ -14,7 +14,7 @@ typedef struct {
static int ngx_http_index_test_dir(ngx_http_request_t *r);
-static int ngx_http_index_init(ngx_pool_t *pool);
+static int ngx_http_index_init(ngx_cycle_t *cycle, ngx_log_t *log);
static void *ngx_http_index_create_conf(ngx_pool_t *pool);
static char *ngx_http_index_merge_conf(ngx_pool_t *p, void *parent,
void *child);
@@ -52,7 +52,9 @@ ngx_module_t ngx_http_index_module = {
&ngx_http_index_module_ctx, /* module context */
ngx_http_index_commands, /* module directives */
NGX_HTTP_MODULE, /* module type */
- ngx_http_index_init /* init module */
+ ngx_http_index_init, /* init module */
+ NULL, /* commit module */
+ NULL /* rollback module */
};
@@ -202,11 +204,16 @@ ngx_log_debug(r->connection->log, "IS_DIR: %s" _ r->path.data);
}
-static int ngx_http_index_init(ngx_pool_t *pool)
+static int ngx_http_index_init(ngx_cycle_t *cycle, ngx_log_t *log)
{
- ngx_http_handler_pt *h;
+ ngx_http_handler_pt *h;
+ ngx_http_conf_ctx_t *ctx;
+ ngx_http_core_main_conf_t *cmcf;
- ngx_test_null(h, ngx_push_array(&ngx_http_index_handlers), NGX_ERROR);
+ ctx = (ngx_http_conf_ctx_t *) cycle->conf_ctx[ngx_http_module.index];
+ cmcf = ctx->main_conf[ngx_http_core_module.ctx_index];
+
+ ngx_test_null(h, ngx_push_array(&cmcf->index_handlers), NGX_ERROR);
*h = ngx_http_index_handler;
diff --git a/src/http/modules/ngx_http_range_filter.c b/src/http/modules/ngx_http_range_filter.c
index d0273ec1c..125551ebd 100644
--- a/src/http/modules/ngx_http_range_filter.c
+++ b/src/http/modules/ngx_http_range_filter.c
@@ -9,7 +9,7 @@ typedef struct {
} ngx_http_range_filter_ctx_t;
-static int ngx_http_range_filter_init(ngx_pool_t *pool);
+static int ngx_http_range_filter_init(ngx_cycle_t *cycle, ngx_log_t *log);
static ngx_http_module_t ngx_http_range_filter_module_ctx = {
@@ -29,7 +29,9 @@ ngx_module_t ngx_http_range_filter_module = {
&ngx_http_range_filter_module_ctx, /* module context */
NULL, /* module directives */
NGX_HTTP_MODULE, /* module type */
- ngx_http_range_filter_init /* init module */
+ ngx_http_range_filter_init, /* init module */
+ NULL, /* commit module */
+ NULL /* rollback module */
};
@@ -354,7 +356,7 @@ static int ngx_http_range_body_filter(ngx_http_request_t *r, ngx_chain_t *in)
}
-static int ngx_http_range_filter_init(ngx_pool_t *pool)
+static int ngx_http_range_filter_init(ngx_cycle_t *cycle, ngx_log_t *log)
{
next_header_filter = ngx_http_top_header_filter;
ngx_http_top_header_filter = ngx_http_range_header_filter;
diff --git a/src/http/ngx_http.c b/src/http/ngx_http.c
index 10f002311..a1ea12aa1 100644
--- a/src/http/ngx_http.c
+++ b/src/http/ngx_http.c
@@ -11,10 +11,6 @@ static char *ngx_http_block(ngx_conf_t *cf, ngx_command_t *cmd, void *conf);
int ngx_http_max_module;
-ngx_array_t ngx_http_translate_handlers;
-ngx_array_t ngx_http_index_handlers;
-
-
int (*ngx_http_top_header_filter) (ngx_http_request_t *r);
int (*ngx_http_top_body_filter) (ngx_http_request_t *r, ngx_chain_t *ch);
@@ -210,11 +206,11 @@ static char *ngx_http_block(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
/* init list of the handlers */
- ngx_init_array(ngx_http_translate_handlers,
- cf->pool, 10, sizeof(ngx_http_handler_pt), NGX_CONF_ERROR);
+ ngx_init_array(cmcf->translate_handlers, cf->cycle->pool,
+ 10, sizeof(ngx_http_handler_pt), NGX_CONF_ERROR);
- ngx_init_array(ngx_http_index_handlers,
- cf->pool, 3, sizeof(ngx_http_handler_pt), NGX_CONF_ERROR);
+ ngx_init_array(cmcf->index_handlers, cf->cycle->pool,
+ 3, sizeof(ngx_http_handler_pt), NGX_CONF_ERROR);
/* create the lists of the ports, the addresses and the server names
@@ -429,7 +425,7 @@ static char *ngx_http_block(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
in_addr = in_port[p].addrs.elts;
while (a < in_port[p].addrs.nelts) {
- ngx_test_null(ls, ngx_push_array(&ngx_listening_sockets),
+ ngx_test_null(ls, ngx_push_array(&cf->cycle->listening),
NGX_CONF_ERROR);
ngx_memzero(ls, sizeof(ngx_listening_t));
@@ -453,6 +449,7 @@ static char *ngx_http_block(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
INET_ADDRSTRLEN),
6, ":%d", in_port[p].port);
+ ls->fd = -1;
ls->family = AF_INET;
ls->type = SOCK_STREAM;
ls->protocol = IPPROTO_IP;
diff --git a/src/http/ngx_http_core_module.c b/src/http/ngx_http_core_module.c
index 4cc4388f2..8e9a96673 100644
--- a/src/http/ngx_http_core_module.c
+++ b/src/http/ngx_http_core_module.c
@@ -422,11 +422,14 @@ ngx_log_debug(r->connection->log, "HTTP DIR: '%s'" _ r->file.name.data);
static int ngx_http_core_index_handler(ngx_http_request_t *r)
{
- int i, rc;
- ngx_http_handler_pt *h;
+ int i, rc;
+ ngx_http_handler_pt *h;
+ ngx_http_core_main_conf_t *cmcf;
+
+ cmcf = ngx_http_get_module_main_conf(r, ngx_http_core_module);
- h = (ngx_http_handler_pt *) ngx_http_index_handlers.elts;
- for (i = ngx_http_index_handlers.nelts; i > 0; /* void */) {
+ h = cmcf->index_handlers.elts;
+ for (i = cmcf->index_handlers.nelts; i > 0; /* void */) {
rc = h[--i](r);
if (rc != NGX_DECLINED) {
@@ -528,9 +531,14 @@ int ngx_http_internal_redirect(ngx_http_request_t *r,
static int ngx_http_core_init(ngx_cycle_t *cycle, ngx_log_t *log)
{
- ngx_http_handler_pt *h;
+ ngx_http_handler_pt *h;
+ ngx_http_conf_ctx_t *ctx;
+ ngx_http_core_main_conf_t *cmcf;
+
+ ctx = (ngx_http_conf_ctx_t *) cycle->conf_ctx[ngx_http_module.index];
+ cmcf = ctx->main_conf[ngx_http_core_module.ctx_index];
- ngx_test_null(h, ngx_push_array(&ngx_http_translate_handlers), NGX_ERROR);
+ ngx_test_null(h, ngx_push_array(&cmcf->translate_handlers), NGX_ERROR);
*h = ngx_http_core_translate_handler;
diff --git a/src/http/ngx_http_core_module.h b/src/http/ngx_http_core_module.h
index 8acf4feb1..c6b2bccd5 100644
--- a/src/http/ngx_http_core_module.h
+++ b/src/http/ngx_http_core_module.h
@@ -20,6 +20,7 @@ typedef struct {
typedef struct {
ngx_array_t servers; /* array of ngx_http_core_srv_conf_t */
ngx_array_t translate_handlers;
+ ngx_array_t index_handlers;
} ngx_http_core_main_conf_t;
diff --git a/src/http/ngx_http_header_filter.c b/src/http/ngx_http_header_filter.c
index 0f7c95330..aa200c108 100644
--- a/src/http/ngx_http_header_filter.c
+++ b/src/http/ngx_http_header_filter.c
@@ -11,7 +11,7 @@
-static int ngx_http_header_filter_init(ngx_pool_t *pool);
+static int ngx_http_header_filter_init(ngx_cycle_t *cycle, ngx_log_t *log);
static int ngx_http_header_filter(ngx_http_request_t *r);
@@ -32,7 +32,9 @@ ngx_module_t ngx_http_header_filter_module = {
&ngx_http_header_filter_module_ctx, /* module context */
NULL, /* module directives */
NGX_HTTP_MODULE, /* module type */
- ngx_http_header_filter_init /* init module */
+ ngx_http_header_filter_init, /* init module */
+ NULL, /* commit module */
+ NULL /* rollback module */
};
@@ -387,7 +389,7 @@ static int ngx_http_header_filter(ngx_http_request_t *r)
}
-static int ngx_http_header_filter_init(ngx_pool_t *pool)
+static int ngx_http_header_filter_init(ngx_cycle_t *cycle, ngx_log_t *log)
{
ngx_http_top_header_filter = ngx_http_header_filter;
return NGX_OK;
diff --git a/src/http/ngx_http_write_filter.c b/src/http/ngx_http_write_filter.c
index 6b76f7390..fc96b0772 100644
--- a/src/http/ngx_http_write_filter.c
+++ b/src/http/ngx_http_write_filter.c
@@ -18,7 +18,7 @@ typedef struct {
static void *ngx_http_write_filter_create_conf(ngx_pool_t *pool);
static char *ngx_http_write_filter_merge_conf(ngx_pool_t *pool,
void *parent, void *child);
-static int ngx_http_write_filter_init(ngx_pool_t *pool);
+static int ngx_http_write_filter_init(ngx_cycle_t *cycle, ngx_log_t *log);
static ngx_command_t ngx_http_write_filter_commands[] = {
@@ -51,7 +51,9 @@ ngx_module_t ngx_http_write_filter_module = {
&ngx_http_write_filter_module_ctx, /* module context */
ngx_http_write_filter_commands, /* module directives */
NGX_HTTP_MODULE, /* module type */
- ngx_http_write_filter_init /* init module */
+ ngx_http_write_filter_init, /* init module */
+ NULL, /* commit module */
+ NULL /* rollback module */
};
@@ -187,7 +189,7 @@ static char *ngx_http_write_filter_merge_conf(ngx_pool_t *pool,
}
-static int ngx_http_write_filter_init(ngx_pool_t *pool)
+static int ngx_http_write_filter_init(ngx_cycle_t *cycle, ngx_log_t *log)
{
ngx_http_top_body_filter = ngx_http_write_filter;