Mercurial > hg > nginx
comparison src/http/ngx_http.c @ 90:37530da31268
nginx-0.0.1-2003-05-16-19:27:48 import
author | Igor Sysoev <igor@sysoev.ru> |
---|---|
date | Fri, 16 May 2003 15:27:48 +0000 |
parents | 29bf798b583f |
children | 637625a2acdb |
comparison
equal
deleted
inserted
replaced
89:29bf798b583f | 90:37530da31268 |
---|---|
51 {ngx_string(""), 0, NULL, 0, 0, NULL} | 51 {ngx_string(""), 0, NULL, 0, 0, NULL} |
52 }; | 52 }; |
53 | 53 |
54 | 54 |
55 ngx_module_t ngx_http_module = { | 55 ngx_module_t ngx_http_module = { |
56 &http_name, /* module context */ | |
56 0, /* module index */ | 57 0, /* module index */ |
57 &http_name, /* module context */ | |
58 ngx_http_commands, /* module directives */ | 58 ngx_http_commands, /* module directives */ |
59 NGX_CORE_MODULE_TYPE, /* module type */ | 59 NGX_CORE_MODULE_TYPE, /* module type */ |
60 NULL /* init module */ | 60 NULL /* init module */ |
61 }; | 61 }; |
62 | 62 |
63 | 63 |
64 static char *ngx_http_block(ngx_conf_t *cf, ngx_command_t *cmd, char *dummy) | 64 static char *ngx_http_block(ngx_conf_t *cf, ngx_command_t *cmd, char *conf) |
65 { | 65 { |
66 int i, s, l, p, a, n, start; | 66 int i, s, l, p, a, n, start; |
67 int port_found, addr_found, virtual_names; | 67 int port_found, addr_found, virtual_names; |
68 char *rv; | 68 char *rv; |
69 struct sockaddr_in *addr_in; | 69 struct sockaddr_in *addr_in; |
70 ngx_array_t in_ports; | 70 ngx_array_t in_ports; |
71 ngx_listen_t *ls; | 71 ngx_listen_t *ls; |
72 ngx_http_module_t *module; | 72 ngx_http_module_t *module; |
73 ngx_conf_t prev; | 73 ngx_conf_t pcf; |
74 ngx_http_conf_ctx_t *ctx; | 74 ngx_http_conf_ctx_t *ctx; |
75 ngx_http_in_port_t *in_port, *inport; | 75 ngx_http_in_port_t *in_port, *inport; |
76 ngx_http_in_addr_t *in_addr, *inaddr; | 76 ngx_http_in_addr_t *in_addr, *inaddr; |
77 ngx_http_core_srv_conf_t **cscf; | 77 ngx_http_core_srv_conf_t **cscf; |
78 ngx_http_listen_t *lscf; | 78 ngx_http_listen_t *lscf; |
83 | 83 |
84 ngx_test_null(ctx, | 84 ngx_test_null(ctx, |
85 ngx_pcalloc(cf->pool, sizeof(ngx_http_conf_ctx_t)), | 85 ngx_pcalloc(cf->pool, sizeof(ngx_http_conf_ctx_t)), |
86 NGX_CONF_ERROR); | 86 NGX_CONF_ERROR); |
87 | 87 |
88 *(ngx_http_conf_ctx_t **) conf = ctx; | |
89 | |
88 ngx_http_max_module = 0; | 90 ngx_http_max_module = 0; |
89 for (i = 0; ngx_modules[i]; i++) { | 91 for (i = 0; ngx_modules[i]; i++) { |
90 if (ngx_modules[i]->type != NGX_HTTP_MODULE_TYPE) { | 92 if (ngx_modules[i]->type != NGX_HTTP_MODULE_TYPE) { |
91 continue; | 93 continue; |
92 } | 94 } |
94 module = (ngx_http_module_t *) ngx_modules[i]->ctx; | 96 module = (ngx_http_module_t *) ngx_modules[i]->ctx; |
95 | 97 |
96 module->index = ngx_http_max_module++; | 98 module->index = ngx_http_max_module++; |
97 } | 99 } |
98 | 100 |
99 /* null loc_conf */ | 101 /* TODO: http main_conf */ |
102 | |
103 ngx_test_null(ctx->main_conf, | |
104 ngx_pcalloc(cf->pool, sizeof(void *) * ngx_http_max_module), | |
105 NGX_CONF_ERROR); | |
106 | |
107 /* TODO: http srv_conf */ | |
108 | |
109 ngx_test_null(ctx->srv_conf, | |
110 ngx_pcalloc(cf->pool, sizeof(void *) * ngx_http_max_module), | |
111 NGX_CONF_ERROR); | |
112 | |
113 /* http null loc_conf */ | |
114 | |
100 ngx_test_null(ctx->loc_conf, | 115 ngx_test_null(ctx->loc_conf, |
101 ngx_pcalloc(cf->pool, sizeof(void *) * ngx_http_max_module), | 116 ngx_pcalloc(cf->pool, sizeof(void *) * ngx_http_max_module), |
102 NGX_CONF_ERROR); | 117 NGX_CONF_ERROR); |
103 | 118 |
104 for (i = 0; ngx_modules[i]; i++) { | 119 for (i = 0; ngx_modules[i]; i++) { |
113 module->create_loc_conf(cf->pool), | 128 module->create_loc_conf(cf->pool), |
114 NGX_CONF_ERROR); | 129 NGX_CONF_ERROR); |
115 } | 130 } |
116 } | 131 } |
117 | 132 |
118 prev = *cf; | 133 pcf = *cf; |
119 cf->ctx = ctx; | 134 cf->ctx = ctx; |
120 cf->module_type = NGX_HTTP_MODULE_TYPE; | 135 cf->module_type = NGX_HTTP_MODULE_TYPE; |
121 cf->cmd_type = NGX_HTTP_MAIN_CONF; | 136 cf->cmd_type = NGX_HTTP_MAIN_CONF; |
122 rv = ngx_conf_parse(cf, NULL); | 137 rv = ngx_conf_parse(cf, NULL); |
123 *cf = prev; | 138 *cf = pcf; |
124 | 139 |
125 if (rv != NGX_CONF_OK) | 140 if (rv != NGX_CONF_OK) |
126 return rv; | 141 return rv; |
127 | 142 |
128 | 143 |