mirror of
https://github.com/nginx/nginx.git
synced 2025-06-07 17:52:38 +08:00
nginx-0.0.1-2003-07-02-22:51:41 import
This commit is contained in:
parent
96c56c9ab6
commit
9d9f58f24d
@ -15,17 +15,12 @@ void ****ngx_conf_ctx;
|
|||||||
ngx_os_io_t ngx_io;
|
ngx_os_io_t ngx_io;
|
||||||
|
|
||||||
|
|
||||||
|
ngx_cycle_t *cycle;
|
||||||
|
|
||||||
int ngx_max_module;
|
int ngx_max_module;
|
||||||
#if 0
|
|
||||||
void *ctx_conf;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
int ngx_connection_counter;
|
int ngx_connection_counter;
|
||||||
|
|
||||||
#if 0
|
|
||||||
ngx_array_t ngx_listening_sockets;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
#if 1
|
#if 1
|
||||||
|
|
||||||
@ -33,8 +28,7 @@ int main(int argc, char *const *argv)
|
|||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
ngx_log_t *log;
|
ngx_log_t *log;
|
||||||
ngx_conf_t conf;
|
ngx_cycle_t *new_cycle;
|
||||||
ngx_cycle_t *cycle, *new_cycle;
|
|
||||||
|
|
||||||
/* TODO */ ngx_max_sockets = -1;
|
/* TODO */ ngx_max_sockets = -1;
|
||||||
|
|
||||||
@ -60,10 +54,16 @@ int main(int argc, char *const *argv)
|
|||||||
|
|
||||||
for ( ;; ) {
|
for ( ;; ) {
|
||||||
|
|
||||||
|
/* STUB */
|
||||||
|
ngx_io = ngx_os_io;
|
||||||
|
|
||||||
/* forks */
|
/* forks */
|
||||||
|
|
||||||
ngx_init_temp_number();
|
ngx_init_temp_number();
|
||||||
|
|
||||||
|
/* STUB */
|
||||||
|
ngx_pre_thread(&cycle->listening, cycle->pool, cycle->log);
|
||||||
|
|
||||||
/* threads */
|
/* threads */
|
||||||
|
|
||||||
for ( ;; ) {
|
for ( ;; ) {
|
||||||
@ -107,12 +107,6 @@ static ngx_cycle_t *ngx_init_cycle(ngx_cycle_t *old_cycle, ngx_log_t *log)
|
|||||||
}
|
}
|
||||||
cycle->pool = pool;
|
cycle->pool = pool;
|
||||||
|
|
||||||
cycle->log = ngx_log_create_errlog(cycle);
|
|
||||||
if (cycle->log == NULL) {
|
|
||||||
ngx_destroy_pool(pool);
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
n = old_cycle ? old_cycle->open_files.nelts : 20;
|
n = old_cycle ? old_cycle->open_files.nelts : 20;
|
||||||
cycle->open_files.elts = ngx_pcalloc(pool, n * sizeof(ngx_open_file_t));
|
cycle->open_files.elts = ngx_pcalloc(pool, n * sizeof(ngx_open_file_t));
|
||||||
if (cycle->open_files.elts == NULL) {
|
if (cycle->open_files.elts == NULL) {
|
||||||
@ -124,6 +118,12 @@ static ngx_cycle_t *ngx_init_cycle(ngx_cycle_t *old_cycle, ngx_log_t *log)
|
|||||||
cycle->open_files.nalloc = n;
|
cycle->open_files.nalloc = n;
|
||||||
cycle->open_files.pool = pool;
|
cycle->open_files.pool = pool;
|
||||||
|
|
||||||
|
cycle->log = ngx_log_create_errlog(cycle);
|
||||||
|
if (cycle->log == NULL) {
|
||||||
|
ngx_destroy_pool(pool);
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
n = old_cycle ? old_cycle->listening.nelts : 10;
|
n = old_cycle ? old_cycle->listening.nelts : 10;
|
||||||
cycle->listening.elts = ngx_pcalloc(pool, n * sizeof(ngx_listening_t));
|
cycle->listening.elts = ngx_pcalloc(pool, n * sizeof(ngx_listening_t));
|
||||||
if (cycle->listening.elts == NULL) {
|
if (cycle->listening.elts == NULL) {
|
||||||
@ -151,7 +151,7 @@ static ngx_cycle_t *ngx_init_cycle(ngx_cycle_t *old_cycle, ngx_log_t *log)
|
|||||||
|
|
||||||
conf.ctx = cycle->conf_ctx;
|
conf.ctx = cycle->conf_ctx;
|
||||||
conf.cycle = cycle;
|
conf.cycle = cycle;
|
||||||
/* STUB */ conf.pool = cycle->pool;
|
/* STUB */ conf.pool = cycle->pool; ngx_conf_ctx = cycle->conf_ctx;
|
||||||
conf.log = log;
|
conf.log = log;
|
||||||
conf.module_type = NGX_CORE_MODULE;
|
conf.module_type = NGX_CORE_MODULE;
|
||||||
conf.cmd_type = NGX_MAIN_CONF;
|
conf.cmd_type = NGX_MAIN_CONF;
|
||||||
@ -200,25 +200,27 @@ static ngx_cycle_t *ngx_init_cycle(ngx_cycle_t *old_cycle, ngx_log_t *log)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!failed) {
|
if (!failed) {
|
||||||
ls = old_cycle->listening.elts;
|
if (old_cycle) {
|
||||||
for (i = 0; i < old_cycle->listening.nelts; i++) {
|
ls = old_cycle->listening.elts;
|
||||||
ls[i].remain = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
nls = cycle->listening.elts;
|
|
||||||
for (n = 0; n < cycle->listening.nelts; n++) {
|
|
||||||
for (i = 0; i < old_cycle->listening.nelts; i++) {
|
for (i = 0; i < old_cycle->listening.nelts; i++) {
|
||||||
if (ngx_memcmp(nls[n].sockaddr,
|
ls[i].remain = 0;
|
||||||
ls[i].sockaddr, ls[i].socklen) == 0)
|
|
||||||
{
|
|
||||||
nls[n].fd = ls[i].fd;
|
|
||||||
ls[i].remain = 1;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (nls[n].fd == -1) {
|
nls = cycle->listening.elts;
|
||||||
nls[n].new = 1;
|
for (n = 0; n < cycle->listening.nelts; n++) {
|
||||||
|
for (i = 0; i < old_cycle->listening.nelts; i++) {
|
||||||
|
if (ngx_memcmp(nls[n].sockaddr,
|
||||||
|
ls[i].sockaddr, ls[i].socklen) == 0)
|
||||||
|
{
|
||||||
|
nls[n].fd = ls[i].fd;
|
||||||
|
ls[i].remain = 1;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (nls[n].fd == -1) {
|
||||||
|
nls[n].new = 1;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -275,6 +277,12 @@ static ngx_cycle_t *ngx_init_cycle(ngx_cycle_t *old_cycle, ngx_log_t *log)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pool->log = cycle->log;
|
||||||
|
|
||||||
|
if (old_cycle == NULL) {
|
||||||
|
return cycle;
|
||||||
|
}
|
||||||
|
|
||||||
ls = old_cycle->listening.elts;
|
ls = old_cycle->listening.elts;
|
||||||
for (i = 0; i < old_cycle->listening.nelts; i++) {
|
for (i = 0; i < old_cycle->listening.nelts; i++) {
|
||||||
if (ls[i].remain) {
|
if (ls[i].remain) {
|
||||||
@ -301,8 +309,6 @@ static ngx_cycle_t *ngx_init_cycle(ngx_cycle_t *old_cycle, ngx_log_t *log)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pool->log = cycle->log;
|
|
||||||
|
|
||||||
ngx_destroy_pool(old_cycle->pool);
|
ngx_destroy_pool(old_cycle->pool);
|
||||||
|
|
||||||
return cycle;
|
return cycle;
|
||||||
|
@ -46,7 +46,7 @@ typedef struct {
|
|||||||
* msvc and icc compile memset() to inline "rep stos"
|
* msvc and icc compile memset() to inline "rep stos"
|
||||||
* while ZeroMemory and bzero are calls.
|
* while ZeroMemory and bzero are calls.
|
||||||
*/
|
*/
|
||||||
#define ngx_memzero(buf, n) memset(buf, n, 0)
|
#define ngx_memzero(buf, n) memset(buf, 0, n)
|
||||||
|
|
||||||
/* msvc and icc compile memcpy() to inline "rep movs" */
|
/* msvc and icc compile memcpy() to inline "rep movs" */
|
||||||
#define ngx_memcpy(dst, src, n) memcpy(dst, src, n)
|
#define ngx_memcpy(dst, src, n) memcpy(dst, src, n)
|
||||||
|
@ -193,6 +193,8 @@ static int ngx_devpoll_del_event(ngx_event_t *ev, int event, u_int flags)
|
|||||||
ngx_event_t *e;
|
ngx_event_t *e;
|
||||||
ngx_connection_t *c;
|
ngx_connection_t *c;
|
||||||
|
|
||||||
|
c = ev->data;
|
||||||
|
|
||||||
#if (NGX_DEBUG_EVENT)
|
#if (NGX_DEBUG_EVENT)
|
||||||
ngx_log_debug(c->log, "del event: %d, %d" _ c->fd _ event);
|
ngx_log_debug(c->log, "del event: %d, %d" _ c->fd _ event);
|
||||||
#endif
|
#endif
|
||||||
@ -207,9 +209,7 @@ static int ngx_devpoll_del_event(ngx_event_t *ev, int event, u_int flags)
|
|||||||
return NGX_OK;
|
return NGX_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* we need to restore second event if it exists */
|
/* we need to restore the second event if it exists */
|
||||||
|
|
||||||
c = ev->data;
|
|
||||||
|
|
||||||
if (event == NGX_READ_EVENT) {
|
if (event == NGX_READ_EVENT) {
|
||||||
e = c->write;
|
e = c->write;
|
||||||
|
@ -12,7 +12,7 @@ typedef struct {
|
|||||||
static void *ngx_http_charset_create_loc_conf(ngx_pool_t *pool);
|
static void *ngx_http_charset_create_loc_conf(ngx_pool_t *pool);
|
||||||
static char *ngx_http_charset_merge_loc_conf(ngx_pool_t *pool,
|
static char *ngx_http_charset_merge_loc_conf(ngx_pool_t *pool,
|
||||||
void *parent, void *child);
|
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[] = {
|
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_module_ctx, /* module context */
|
||||||
ngx_http_charset_filter_commands, /* module directives */
|
ngx_http_charset_filter_commands, /* module directives */
|
||||||
NGX_HTTP_MODULE, /* module type */
|
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
|
#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;
|
next_header_filter = ngx_http_top_header_filter;
|
||||||
ngx_http_top_header_filter = ngx_http_charset_header_filter;
|
ngx_http_top_header_filter = ngx_http_charset_header_filter;
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
#include <ngx_http.h>
|
#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 = {
|
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 */
|
&ngx_http_chunked_filter_module_ctx, /* module context */
|
||||||
NULL, /* module directives */
|
NULL, /* module directives */
|
||||||
NGX_HTTP_MODULE, /* module type */
|
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;
|
next_header_filter = ngx_http_top_header_filter;
|
||||||
ngx_http_top_header_filter = ngx_http_chunked_header_filter;
|
ngx_http_top_header_filter = ngx_http_chunked_header_filter;
|
||||||
|
@ -14,7 +14,7 @@ typedef struct {
|
|||||||
|
|
||||||
|
|
||||||
static int ngx_http_index_test_dir(ngx_http_request_t *r);
|
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 void *ngx_http_index_create_conf(ngx_pool_t *pool);
|
||||||
static char *ngx_http_index_merge_conf(ngx_pool_t *p, void *parent,
|
static char *ngx_http_index_merge_conf(ngx_pool_t *p, void *parent,
|
||||||
void *child);
|
void *child);
|
||||||
@ -52,7 +52,9 @@ ngx_module_t ngx_http_index_module = {
|
|||||||
&ngx_http_index_module_ctx, /* module context */
|
&ngx_http_index_module_ctx, /* module context */
|
||||||
ngx_http_index_commands, /* module directives */
|
ngx_http_index_commands, /* module directives */
|
||||||
NGX_HTTP_MODULE, /* module type */
|
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;
|
*h = ngx_http_index_handler;
|
||||||
|
|
||||||
|
@ -9,7 +9,7 @@ typedef struct {
|
|||||||
} ngx_http_range_filter_ctx_t;
|
} 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 = {
|
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 */
|
&ngx_http_range_filter_module_ctx, /* module context */
|
||||||
NULL, /* module directives */
|
NULL, /* module directives */
|
||||||
NGX_HTTP_MODULE, /* module type */
|
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;
|
next_header_filter = ngx_http_top_header_filter;
|
||||||
ngx_http_top_header_filter = ngx_http_range_header_filter;
|
ngx_http_top_header_filter = ngx_http_range_header_filter;
|
||||||
|
@ -11,10 +11,6 @@ static char *ngx_http_block(ngx_conf_t *cf, ngx_command_t *cmd, void *conf);
|
|||||||
int ngx_http_max_module;
|
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_header_filter) (ngx_http_request_t *r);
|
||||||
int (*ngx_http_top_body_filter) (ngx_http_request_t *r, ngx_chain_t *ch);
|
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 */
|
/* init list of the handlers */
|
||||||
|
|
||||||
ngx_init_array(ngx_http_translate_handlers,
|
ngx_init_array(cmcf->translate_handlers, cf->cycle->pool,
|
||||||
cf->pool, 10, sizeof(ngx_http_handler_pt), NGX_CONF_ERROR);
|
10, sizeof(ngx_http_handler_pt), NGX_CONF_ERROR);
|
||||||
|
|
||||||
ngx_init_array(ngx_http_index_handlers,
|
ngx_init_array(cmcf->index_handlers, cf->cycle->pool,
|
||||||
cf->pool, 3, sizeof(ngx_http_handler_pt), NGX_CONF_ERROR);
|
3, sizeof(ngx_http_handler_pt), NGX_CONF_ERROR);
|
||||||
|
|
||||||
|
|
||||||
/* create the lists of the ports, the addresses and the server names
|
/* 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;
|
in_addr = in_port[p].addrs.elts;
|
||||||
while (a < in_port[p].addrs.nelts) {
|
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_CONF_ERROR);
|
||||||
ngx_memzero(ls, sizeof(ngx_listening_t));
|
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),
|
INET_ADDRSTRLEN),
|
||||||
6, ":%d", in_port[p].port);
|
6, ":%d", in_port[p].port);
|
||||||
|
|
||||||
|
ls->fd = -1;
|
||||||
ls->family = AF_INET;
|
ls->family = AF_INET;
|
||||||
ls->type = SOCK_STREAM;
|
ls->type = SOCK_STREAM;
|
||||||
ls->protocol = IPPROTO_IP;
|
ls->protocol = IPPROTO_IP;
|
||||||
|
@ -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)
|
static int ngx_http_core_index_handler(ngx_http_request_t *r)
|
||||||
{
|
{
|
||||||
int i, rc;
|
int i, rc;
|
||||||
ngx_http_handler_pt *h;
|
ngx_http_handler_pt *h;
|
||||||
|
ngx_http_core_main_conf_t *cmcf;
|
||||||
|
|
||||||
h = (ngx_http_handler_pt *) ngx_http_index_handlers.elts;
|
cmcf = ngx_http_get_module_main_conf(r, ngx_http_core_module);
|
||||||
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);
|
rc = h[--i](r);
|
||||||
|
|
||||||
if (rc != NGX_DECLINED) {
|
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)
|
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;
|
||||||
|
|
||||||
ngx_test_null(h, ngx_push_array(&ngx_http_translate_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->translate_handlers), NGX_ERROR);
|
||||||
|
|
||||||
*h = ngx_http_core_translate_handler;
|
*h = ngx_http_core_translate_handler;
|
||||||
|
|
||||||
|
@ -20,6 +20,7 @@ typedef struct {
|
|||||||
typedef struct {
|
typedef struct {
|
||||||
ngx_array_t servers; /* array of ngx_http_core_srv_conf_t */
|
ngx_array_t servers; /* array of ngx_http_core_srv_conf_t */
|
||||||
ngx_array_t translate_handlers;
|
ngx_array_t translate_handlers;
|
||||||
|
ngx_array_t index_handlers;
|
||||||
} ngx_http_core_main_conf_t;
|
} ngx_http_core_main_conf_t;
|
||||||
|
|
||||||
|
|
||||||
|
@ -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);
|
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 */
|
&ngx_http_header_filter_module_ctx, /* module context */
|
||||||
NULL, /* module directives */
|
NULL, /* module directives */
|
||||||
NGX_HTTP_MODULE, /* module type */
|
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;
|
ngx_http_top_header_filter = ngx_http_header_filter;
|
||||||
return NGX_OK;
|
return NGX_OK;
|
||||||
|
@ -18,7 +18,7 @@ typedef struct {
|
|||||||
static void *ngx_http_write_filter_create_conf(ngx_pool_t *pool);
|
static void *ngx_http_write_filter_create_conf(ngx_pool_t *pool);
|
||||||
static char *ngx_http_write_filter_merge_conf(ngx_pool_t *pool,
|
static char *ngx_http_write_filter_merge_conf(ngx_pool_t *pool,
|
||||||
void *parent, void *child);
|
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[] = {
|
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_module_ctx, /* module context */
|
||||||
ngx_http_write_filter_commands, /* module directives */
|
ngx_http_write_filter_commands, /* module directives */
|
||||||
NGX_HTTP_MODULE, /* module type */
|
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;
|
ngx_http_top_body_filter = ngx_http_write_filter;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user