]> git.kaiwu.me - nginx.git/commitdiff
nginx-0.0.1-2002-12-27-19:22:50 import
authorIgor Sysoev <igor@sysoev.ru>
Fri, 27 Dec 2002 16:22:50 +0000 (16:22 +0000)
committerIgor Sysoev <igor@sysoev.ru>
Fri, 27 Dec 2002 16:22:50 +0000 (16:22 +0000)
12 files changed:
src/core/nginx.c
src/core/ngx_conf_file.c [moved from src/core/ngx_config_file.c with 98% similarity]
src/core/ngx_conf_file.h [moved from src/core/ngx_config_file.h with 76% similarity]
src/core/ngx_modules.c
src/http/modules/ngx_http_index_handler.c
src/http/ngx_http.h
src/http/ngx_http_config.c
src/http/ngx_http_core.c
src/http/ngx_http_header_filter.c
src/http/ngx_http_output_filter.c
src/http/ngx_http_output_filter.h
src/http/ngx_http_write_filter.c

index 17a3d10c39ddd8013dc93c8c50953251c3c11642..0a0233f49c66b5d411316230128101ae86435a66 100644 (file)
@@ -2,6 +2,7 @@
 #include <nginx.h>
 
 #include <ngx_config.h>
+
 #include <ngx_string.h>
 #include <ngx_errno.h>
 #include <ngx_time.h>
@@ -12,6 +13,7 @@
 #include <ngx_server.h>
 #include <ngx_connection.h>
 #include <ngx_listen.h>
+#include <ngx_conf_file.h>
 
 /* STUB */
 #include <ngx_http.h>
@@ -62,6 +64,7 @@ int main(int argc, char *const *argv)
                   ngx_create_array(ngx_pool, 10, sizeof(ngx_str_t)), 1);
     conf.pool = ngx_pool;
     conf.log = &ngx_log;
+    conf.type = NGX_CORE_MODULE_TYPE;
 
     conf_file.len = sizeof("nginx.conf") - 1;
     conf_file.data = "nginx.conf";
similarity index 98%
rename from src/core/ngx_config_file.c
rename to src/core/ngx_conf_file.c
index 79d72183c8db3315bd9f994f1addc45017df5813..6b77121a4731e67d925a7300c7285270121b8a49 100644 (file)
@@ -1,7 +1,7 @@
 
 #include <ngx_config.h>
 #include <ngx_core.h>
-#include <ngx_config_file.h>
+#include <ngx_conf_file.h>
 
 
 static int argument_number[] = {
@@ -75,7 +75,9 @@ int ngx_conf_parse(ngx_conf_t *cf, ngx_str_t *filename)
         name = (ngx_str_t *) cf->args->elts;
 
         for (i = 0; ngx_modules[i]; i++) {
-            if (cf->type != ngx_modules[i]->type) {
+            if (ngx_modules[i]->type != NULL
+                && ngx_modules[i]->type != cf->type)
+            {
                 continue;
             }
 
@@ -88,7 +90,9 @@ int ngx_conf_parse(ngx_conf_t *cf, ngx_str_t *filename)
                 if (name->len == cmd->name.len
                     && ngx_strcmp(name->data, cmd->name.data) == 0)
                 {
+
 ngx_log_debug(cf->log, "command '%s'" _ cmd->name.data);
+
                     cmd->set(cf, cmd, NULL);
                 }
 
similarity index 76%
rename from src/core/ngx_config_file.h
rename to src/core/ngx_conf_file.h
index 97a4d2a33b6c945bb4f018f911ee6728cbe178b4..cab61a3515233f1f79548b6c1acddab4155324f8 100644 (file)
@@ -1,5 +1,5 @@
-#ifndef _NGX_HTTP_CONFIG_FILE_H_INCLUDED_
-#define _NGX_HTTP_CONFIG_FILE_H_INCLUDED_
+#ifndef _NGX_HTTP_CONF_FILE_H_INCLUDED_
+#define _NGX_HTTP_CONF_FILE_H_INCLUDED_
 
 
 #include <ngx_config.h>
 #include <ngx_array.h>
 
 
-#define NGX_CONF_NOARGS    1
-#define NGX_CONF_TAKE1     2
-#define NGX_CONF_TAKE2     4
+#define NGX_CONF_NOARGS      1
+#define NGX_CONF_TAKE1       2
+#define NGX_CONF_TAKE2       4
+#define NGX_CONF_ARGS_NUMBER 0x0ffff
+#define NGX_CONF_ANY         0x10000
+#define NGX_CONF_BLOCK       0x20000
 
-#define NGX_CONF_ANY       0x10000
-#define NGX_CONF_BLOCK     0x20000
 
-#define NGX_CONF_UNSET    -1
+#define NGX_CONF_UNSET       -1
 
 
+#define NGX_CONF_ERROR       (char *) -1
+
 #define NGX_CONF_BLOCK_DONE  1
 #define NGX_CONF_FILE_DONE   2
 
 
-#define NGX_CONF_ERROR       (char *) -1
+#define NGX_CORE_MODULE_TYPE 0x45524f43  /* "CORE" */
+
 
 typedef struct ngx_conf_s  ngx_conf_t;
 
@@ -80,4 +84,4 @@ char *ngx_conf_set_time_slot(ngx_conf_t *cf, ngx_command_t *cmd, char *conf);
 extern ngx_module_t *ngx_modules[];
 
 
-#endif _NGX_HTTP_CONFIG_FILE_H_INCLUDED_
+#endif _NGX_HTTP_CONF_FILE_H_INCLUDED_
index ad9372baa8e1a3943f9258219df2ed07a8081466..e07c4e6baa4b5d7f51bbc9d1f2badad555f57ce5 100644 (file)
@@ -1,7 +1,7 @@
 
 #include <ngx_config.h>
 
-#include <ngx_config_file.h>
+#include <ngx_conf_file.h>
 
 
 extern ngx_module_t  ngx_http_header_filter_module;
index faddd743ac2bc1e602f1230fd0256928368f29d6..a85823769b413775edee608d838e461f34855487 100644 (file)
@@ -1,10 +1,12 @@
 
 #include <ngx_config.h>
+
 #include <ngx_core.h>
 #include <ngx_errno.h>
 #include <ngx_string.h>
 #include <ngx_files.h>
-#include <ngx_config_file.h>
+#include <ngx_conf_file.h>
+
 #include <ngx_http.h>
 #include <ngx_http_config.h>
 #include <ngx_http_index_handler.h>
index b6bcfe7cc9c10076ef5a5a8d4d621f4d49a544a0..4d41bf263d2a7044e9f050e3bfc9f9242088d4d9 100644 (file)
@@ -3,13 +3,14 @@
 
 
 #include <ngx_config.h>
+
 #include <ngx_types.h>
 #include <ngx_string.h>
 #include <ngx_table.h>
 #include <ngx_hunk.h>
 #include <ngx_files.h>
 #include <ngx_connection.h>
-#include <ngx_config_file.h>
+#include <ngx_conf_file.h>
 
 
 #define NGX_HTTP_VERSION_10       1000
index eb09d57598531a2bbea4968fde0bbd70caf5dd2f..205b41ba048fa25c6a971af964e324f39392d611 100644 (file)
@@ -1,7 +1,13 @@
 
+/* TODO:
+    ngx_http_conf_ctx_t   ctx; on stack or in pool ? */
+
+
 #include <ngx_config.h>
+
 #include <ngx_core.h>
-#include <ngx_config_file.h>
+#include <ngx_conf_file.h>
+
 #include <ngx_http.h>
 #include <ngx_http_core.h>
 #include <ngx_http_config.h>
@@ -38,10 +44,11 @@ static ngx_command_t  ngx_http_commands[] = {
 ngx_module_t  ngx_http_module = {
     NULL,                                  /* module context */
     ngx_http_commands,                     /* module directives */
-    0,                                     /* module type */
+    NGX_CORE_MODULE_TYPE,                  /* module type */
     NULL                                   /* init module */
 };
 
+
 static ngx_command_t  ngx_http_core_commands[] = {
 
     {ngx_string("server"),
@@ -83,7 +90,7 @@ static char *ngx_http_block(ngx_conf_t *cf, ngx_command_t *cmd, char *dummy)
 {
     int  i;
     ngx_http_module_t    *module;
-    ngx_http_conf_ctx_t  *ctx;
+    ngx_http_conf_ctx_t   ctx;
 
     for (i = 0; ngx_modules[i]; i++) {
         if (ngx_modules[i]->type != NGX_HTTP_MODULE_TYPE) {
@@ -98,9 +105,9 @@ static char *ngx_http_block(ngx_conf_t *cf, ngx_command_t *cmd, char *dummy)
                   ngx_pcalloc(cf->pool, sizeof(void *) * ngx_http_max_module),
                   NGX_CONF_ERROR);
 
-    ctx->srv_conf = NULL;
-    ctx->loc_conf = null_loc_conf;
-    ctx->locations = NULL;
+    ctx.srv_conf = NULL;
+    ctx.loc_conf = null_loc_conf;
+    ctx.locations = NULL;
 
     for (i = 0; ngx_modules[i]; i++) {
         if (ngx_modules[i]->type != NGX_HTTP_MODULE_TYPE) {
@@ -116,7 +123,7 @@ static char *ngx_http_block(ngx_conf_t *cf, ngx_command_t *cmd, char *dummy)
         }
     }
 
-    cf->ctx = ctx;
+    cf->ctx = &ctx;
     cf->type = NGX_HTTP_MODULE_TYPE;
     return ngx_conf_parse(cf, NULL);
 }
index 848dd8e0eb22a03a16c648a0f5a0f8f0131634ae..30d8329df1469c33687860a6541366b19a4c7b58 100644 (file)
@@ -1,7 +1,9 @@
 
 #include <ngx_config.h>
+
 #include <ngx_core.h>
-#include <ngx_config_file.h>
+#include <ngx_conf_file.h>
+
 #include <ngx_http.h>
 #include <ngx_http_core.h>
 #include <ngx_http_config.h>
index aab4e528ba17d753563305b19814e4c82eda6f5e..3e85677817319c301e2bb02cfa17dabf9fce95e3 100644 (file)
@@ -2,11 +2,13 @@
 #include <nginx.h>
 
 #include <ngx_config.h>
+
 #include <ngx_core.h>
 #include <ngx_string.h>
 #include <ngx_table.h>
 #include <ngx_hunk.h>
-#include <ngx_config_file.h>
+#include <ngx_conf_file.h>
+
 #include <ngx_http.h>
 #include <ngx_http_write_filter.h>
 
index f19584580dec37164c9534d9d159fc9c82d98005..345a4f161e465854725ad5932c52d8dbbab5a667 100644 (file)
@@ -1,10 +1,12 @@
 
 #include <ngx_config.h>
+
 #include <ngx_core.h>
 #include <ngx_files.h>
 #include <ngx_string.h>
 #include <ngx_hunk.h>
-#include <ngx_config_file.h>
+#include <ngx_conf_file.h>
+
 #include <ngx_http.h>
 #include <ngx_http_config.h>
 #include <ngx_http_output_filter.h>
index f409b5468430e1b6fdef661702804551eb6cb52a..d8df958bfdeeafb7c7b4226e34f30013d4a93f4c 100644 (file)
@@ -3,6 +3,7 @@
 
 
 #include <ngx_hunk.h>
+#include <ngx_conf_file.h>
 #include <ngx_http.h>
 
 
index c4321c7c74fc55c059a22d63fe17d856558f96fe..45f6887c93265c6b192428332bb7d700fec4cd85 100644 (file)
@@ -1,8 +1,12 @@
 
 #include <ngx_config.h>
+
 #include <ngx_core.h>
 #include <ngx_hunk.h>
+#include <ngx_conf_file.h>
+
 #include <ngx_event_write.h>
+
 #include <ngx_http.h>
 #include <ngx_http_config.h>
 #include <ngx_http_write_filter.h>