mirror of
https://github.com/nginx/nginx.git
synced 2025-06-10 19:42:39 +08:00
nginx-0.0.1-2002-12-18-00:08:15 import
This commit is contained in:
parent
5518aba253
commit
4fa792320a
@ -1,4 +1,5 @@
|
|||||||
|
|
||||||
|
#include <ngx_config.h>
|
||||||
#include <ngx_core.h>
|
#include <ngx_core.h>
|
||||||
#include <ngx_config_command.h>
|
#include <ngx_config_command.h>
|
||||||
#include <ngx_http.h>
|
#include <ngx_http.h>
|
||||||
@ -15,6 +16,127 @@ int (*ngx_http_top_header_filter) (ngx_http_request_t *r);
|
|||||||
void **ngx_srv_conf;
|
void **ngx_srv_conf;
|
||||||
void **ngx_loc_conf;
|
void **ngx_loc_conf;
|
||||||
|
|
||||||
|
#if 0
|
||||||
|
void *ngx_http_block(ngx_conf_t *cf)
|
||||||
|
{
|
||||||
|
ngx_http_conf_ctx_t *ctx;
|
||||||
|
|
||||||
|
ngx_test_null(ctx,
|
||||||
|
ngx_pcalloc(cf->pool, sizeof(ngx_http_conf_ctx_t)),
|
||||||
|
NGX_ERROR);
|
||||||
|
|
||||||
|
/* null server config */
|
||||||
|
ngx_test_null(ctx->srv_conf,
|
||||||
|
ngx_pcalloc(cf->pool, sizeof(void *) * ngx_max_module),
|
||||||
|
NGX_ERROR);
|
||||||
|
|
||||||
|
/* null location config */
|
||||||
|
ngx_test_null(ctx->loc_conf,
|
||||||
|
ngx_pcalloc(cf->pool, sizeof(void *) * ngx_max_module),
|
||||||
|
NGX_ERROR);
|
||||||
|
|
||||||
|
for (i = 0; modules[i]; i++) {
|
||||||
|
if (modules[i]->create_srv_conf)
|
||||||
|
ngx_test_null(ctx->srv_conf[i],
|
||||||
|
modules[i]->create_srv_conf(cf->pool),
|
||||||
|
NGX_ERROR);
|
||||||
|
|
||||||
|
if (modules[i]->create_loc_conf)
|
||||||
|
ngx_test_null(ctx->loc_conf[i],
|
||||||
|
modules[i]->create_loc_conf(cf->pool),
|
||||||
|
NGX_ERROR);
|
||||||
|
}
|
||||||
|
|
||||||
|
cf->ctx = ctx;
|
||||||
|
return ngx_conf_parse(cf);
|
||||||
|
}
|
||||||
|
|
||||||
|
void *ngx_server_block(ngx_conf_t *cf)
|
||||||
|
{
|
||||||
|
ngx_http_conf_ctx_t *ctx, *prev;
|
||||||
|
ngx_http_core_loc_conf_t *loc_conf;
|
||||||
|
|
||||||
|
ngx_test_null(ctx,
|
||||||
|
ngx_pcalloc(cf->pool, sizeof(ngx_http_conf_ctx_t)),
|
||||||
|
NGX_ERROR);
|
||||||
|
|
||||||
|
/* server config */
|
||||||
|
ngx_test_null(ctx->srv_conf,
|
||||||
|
ngx_pcalloc(cf->pool, sizeof(void *) * ngx_max_module),
|
||||||
|
NGX_ERROR);
|
||||||
|
|
||||||
|
/* server location config */
|
||||||
|
ngx_test_null(ctx->loc_conf,
|
||||||
|
ngx_pcalloc(cf->pool, sizeof(void *) * ngx_max_module),
|
||||||
|
NGX_ERROR);
|
||||||
|
|
||||||
|
|
||||||
|
for (i = 0; modules[i]; i++) {
|
||||||
|
if (modules[i]->create_srv_conf)
|
||||||
|
ngx_test_null(ctx->srv_conf[i],
|
||||||
|
modules[i]->create_srv_conf(cf->pool),
|
||||||
|
NGX_ERROR);
|
||||||
|
|
||||||
|
if (modules[i]->create_loc_conf)
|
||||||
|
ngx_test_null(ctx->loc_conf[i],
|
||||||
|
modules[i]->create_loc_conf(cf->pool),
|
||||||
|
NGX_ERROR);
|
||||||
|
}
|
||||||
|
|
||||||
|
prev = cf->ctx;
|
||||||
|
cf->ctx = ctx;
|
||||||
|
rc = ngx_conf_parse(cf);
|
||||||
|
cf->ctx = prev;
|
||||||
|
|
||||||
|
if (loc == NULL)
|
||||||
|
return NULL;
|
||||||
|
|
||||||
|
for (i = 0; modules[i]; i++) {
|
||||||
|
if (modules[i]->merge_srv_conf)
|
||||||
|
if (modules[i]->merge_srv_conf(cf->pool,
|
||||||
|
prev->srv_conf, ctx->srv_conf)
|
||||||
|
== NGX_ERROR)
|
||||||
|
return NGX_ERROR;
|
||||||
|
|
||||||
|
if (modules[i]->merge_loc_conf)
|
||||||
|
if (modules[i]->merge_loc_conf(cf->pool,
|
||||||
|
prev->loc_conf, ctx->loc_conf)
|
||||||
|
== NGX_ERROR)
|
||||||
|
return NGX_ERROR;
|
||||||
|
}
|
||||||
|
|
||||||
|
return (void *) 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
void *ngx_location_block(ngx_conf_t *cf)
|
||||||
|
{
|
||||||
|
|
||||||
|
ngx_test_null(ctx,
|
||||||
|
ngx_pcalloc(cf->pool, sizeof(ngx_http_conf_ctx_t)),
|
||||||
|
NGX_ERROR);
|
||||||
|
|
||||||
|
ctx->srv_conf = cf->ctx->srv_conf;
|
||||||
|
|
||||||
|
ngx_test_null(ctx->loc_conf,
|
||||||
|
ngx_pcalloc(cf->pool, sizeof(void *) * ngx_max_module),
|
||||||
|
NGX_ERROR);
|
||||||
|
|
||||||
|
for (i = 0; modules[i]; i++) {
|
||||||
|
if (modules[i]->create_loc_conf)
|
||||||
|
ngx_test_null(ctx->loc_conf[i],
|
||||||
|
modules[i]->create_loc_conf(cf->pool),
|
||||||
|
NGX_ERROR);
|
||||||
|
|
||||||
|
if (ngx_http_core_module.index == i)
|
||||||
|
ctx->loc_conf[i].location = cf->args[0];
|
||||||
|
}
|
||||||
|
|
||||||
|
push
|
||||||
|
|
||||||
|
return ngx_conf_parse(cf);
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
int ngx_http_config_modules(ngx_pool_t *pool, ngx_http_module_t **modules)
|
int ngx_http_config_modules(ngx_pool_t *pool, ngx_http_module_t **modules)
|
||||||
{
|
{
|
||||||
|
@ -278,6 +278,59 @@ int ngx_http_internal_redirect(ngx_http_request_t *r, ngx_str_t uri)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#if 0
|
||||||
|
|
||||||
|
|
||||||
|
{"http", ngx_http_enter_container, 0,
|
||||||
|
NGX_GLOBAL_CONF, NGX_CONF_CONTAINER},
|
||||||
|
|
||||||
|
{"server", ngx_http_enter_server_container, 0,
|
||||||
|
NGX_HTTP_CONF, NGX_CONF_CONTAINER],
|
||||||
|
|
||||||
|
{"location", ngx_http_enter_location_container, 0,
|
||||||
|
NGX_HTTP_SRV_CONF, NGX_CONF_CONTAINER|NGX_CONF_TAKE1}
|
||||||
|
|
||||||
|
|
||||||
|
int ngx_http_enter_container()
|
||||||
|
{
|
||||||
|
create_srv_conf(null_srv_conf)
|
||||||
|
create_loc_conf(null_loc_conf)
|
||||||
|
}
|
||||||
|
|
||||||
|
int ngx_http_exit_container()
|
||||||
|
{
|
||||||
|
nothing ?
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
int ngx_http_enter_server_container()
|
||||||
|
{
|
||||||
|
create_srv_conf()
|
||||||
|
create_loc_conf(NULL)
|
||||||
|
}
|
||||||
|
|
||||||
|
int ngx_http_exit_server_container()
|
||||||
|
{
|
||||||
|
merge_srv_conf(srv_conf, null_srv_conf)
|
||||||
|
merge_loc_conf(loc_conf, null_loc_conf)
|
||||||
|
|
||||||
|
iterate check_loc_conf_is_set and merge_loc_conf()
|
||||||
|
}
|
||||||
|
|
||||||
|
int ngx_http_enter_location_container()
|
||||||
|
{
|
||||||
|
create_loc_conf(loc)
|
||||||
|
|
||||||
|
push to array
|
||||||
|
}
|
||||||
|
|
||||||
|
int ngx_http_exit_location_container()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
static void *ngx_http_core_create_srv_conf(ngx_pool_t *pool)
|
static void *ngx_http_core_create_srv_conf(ngx_pool_t *pool)
|
||||||
{
|
{
|
||||||
ngx_http_core_srv_conf_t *conf;
|
ngx_http_core_srv_conf_t *conf;
|
||||||
|
Loading…
Reference in New Issue
Block a user