comparison src/http/ngx_http.c @ 509:9b8c906f6e63 release-0.1.29

nginx-0.1.29-RELEASE import *) Feature: the ngx_http_ssi_module supports "include virtual" command. *) Feature: the ngx_http_ssi_module supports the condition command like 'if expr="$NAME"' and "else" and "endif" commands. Only one nested level is supported. *) Feature: the ngx_http_ssi_module supports the DATE_LOCAL and DATE_GMT variables and "config timefmt" command. *) Feature: the "ssi_ignore_recycled_buffers" directive. *) Bugfix: the "echo" command did not show the default value for the empty QUERY_STRING variable. *) Change: the ngx_http_proxy_module was rewritten. *) Feature: the "proxy_redirect", "proxy_pass_request_headers", "proxy_pass_request_body", and "proxy_method" directives. *) Feature: the "proxy_set_header" directive. The "proxy_x_var" was canceled and must be replaced with the proxy_set_header directive. *) Change: the "proxy_preserve_host" is canceled and must be replaced with the "proxy_set_header Host $host" and the "proxy_redirect off" directives, the "proxy_set_header Host $host:$proxy_port" directive and the appropriate proxy_redirect directives. *) Change: the "proxy_set_x_real_ip" is canceled and must be replaced with the "proxy_set_header X-Real-IP $remote_addr" directive. *) Change: the "proxy_add_x_forwarded_for" is canceled and must be replaced with the "proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for" directive. *) Change: the "proxy_set_x_url" is canceled and must be replaced with the "proxy_set_header X-URL http://$host:$server_port$request_uri" directive. *) Feature: the "fastcgi_param" directive. *) Change: the "fastcgi_root", "fastcgi_set_var" and "fastcgi_params" directive are canceled and must be replaced with the fastcgi_param directives. *) Feature: the "index" directive can use the variables. *) Feature: the "index" directive can be used at http and server levels. *) Change: the last index only in the "index" directive can be absolute. *) Feature: the "rewrite" directive can use the variables. *) Feature: the "internal" directive. *) Feature: the CONTENT_LENGTH, CONTENT_TYPE, REMOTE_PORT, SERVER_ADDR, SERVER_PORT, SERVER_PROTOCOL, DOCUMENT_ROOT, SERVER_NAME, REQUEST_METHOD, REQUEST_URI, and REMOTE_USER variables. *) Change: nginx now passes the invalid lines in a client request headers or a backend response header. *) Bugfix: if the backend did not transfer response for a long time and the "send_timeout" was less than "proxy_read_timeout", then nginx returned the 408 response. *) Bugfix: the segmentation fault was occurred if the backend sent an invalid line in response header; the bug had appeared in 0.1.26. *) Bugfix: the segmentation fault may occurred in FastCGI fault tolerance configuration. *) Bugfix: the "expires" directive did not remove the previous "Expires" and "Cache-Control" headers. *) Bugfix: nginx did not take into account trailing dot in "Host" header line. *) Bugfix: the ngx_http_auth_module did not work under Linux. *) Bugfix: the rewrite directive worked incorrectly, if the arguments were in a request. *) Bugfix: nginx could not be built on MacOS X.
author Igor Sysoev <igor@sysoev.ru>
date Thu, 12 May 2005 14:58:06 +0000
parents cd3117ad9aab
children 6f00349b98e5
comparison
equal deleted inserted replaced
508:ca1020ce99ba 509:9b8c906f6e63
51 NULL 51 NULL
52 }; 52 };
53 53
54 54
55 ngx_module_t ngx_http_module = { 55 ngx_module_t ngx_http_module = {
56 NGX_MODULE, 56 NGX_MODULE_V1,
57 &ngx_http_module_ctx, /* module context */ 57 &ngx_http_module_ctx, /* module context */
58 ngx_http_commands, /* module directives */ 58 ngx_http_commands, /* module directives */
59 NGX_CORE_MODULE, /* module type */ 59 NGX_CORE_MODULE, /* module type */
60 NULL, /* init module */ 60 NULL, /* init module */
61 NULL /* init process */ 61 NULL /* init process */
83 ngx_http_core_main_conf_t *cmcf; 83 ngx_http_core_main_conf_t *cmcf;
84 #if (NGX_WIN32) 84 #if (NGX_WIN32)
85 ngx_iocp_conf_t *iocpcf; 85 ngx_iocp_conf_t *iocpcf;
86 #endif 86 #endif
87 87
88 #if (NGX_SUPPRESS_WARN)
89 /* MSVC thinks "in_ports" may be used without having been initialized */
90 ngx_memzero(&in_ports, sizeof(ngx_array_t));
91 #endif
92
93 /* the main http context */ 88 /* the main http context */
94 89
95 ctx = ngx_pcalloc(cf->pool, sizeof(ngx_http_conf_ctx_t)); 90 ctx = ngx_pcalloc(cf->pool, sizeof(ngx_http_conf_ctx_t));
96 if (ctx == NULL) { 91 if (ctx == NULL) {
97 return NGX_CONF_ERROR; 92 return NGX_CONF_ERROR;
154 } 149 }
155 150
156 module = ngx_modules[m]->ctx; 151 module = ngx_modules[m]->ctx;
157 mi = ngx_modules[m]->ctx_index; 152 mi = ngx_modules[m]->ctx_index;
158 153
159 if (module->pre_conf) {
160 if (module->pre_conf(cf) != NGX_OK) {
161 return NGX_CONF_ERROR;
162 }
163 }
164
165 if (module->create_main_conf) { 154 if (module->create_main_conf) {
166 ctx->main_conf[mi] = module->create_main_conf(cf); 155 ctx->main_conf[mi] = module->create_main_conf(cf);
167 if (ctx->main_conf[mi] == NULL) { 156 if (ctx->main_conf[mi] == NULL) {
168 return NGX_CONF_ERROR; 157 return NGX_CONF_ERROR;
169 } 158 }
182 return NGX_CONF_ERROR; 171 return NGX_CONF_ERROR;
183 } 172 }
184 } 173 }
185 } 174 }
186 175
187
188 /* parse inside the http{} block */
189
190 pcf = *cf; 176 pcf = *cf;
191 cf->ctx = ctx; 177 cf->ctx = ctx;
178
179 for (m = 0; ngx_modules[m]; m++) {
180 if (ngx_modules[m]->type != NGX_HTTP_MODULE) {
181 continue;
182 }
183
184 module = ngx_modules[m]->ctx;
185 mi = ngx_modules[m]->ctx_index;
186
187 if (module->preconfiguration) {
188 if (module->preconfiguration(cf) != NGX_OK) {
189 return NGX_CONF_ERROR;
190 }
191 }
192 }
193
194 /* parse inside the http{} block */
195
192 cf->module_type = NGX_HTTP_MODULE; 196 cf->module_type = NGX_HTTP_MODULE;
193 cf->cmd_type = NGX_HTTP_MAIN_CONF; 197 cf->cmd_type = NGX_HTTP_MAIN_CONF;
194 rv = ngx_conf_parse(cf, NULL); 198 rv = ngx_conf_parse(cf, NULL);
195 199
196 if (rv != NGX_CONF_OK) { 200 if (rv != NGX_CONF_OK) {
262 } 266 }
263 } 267 }
264 } 268 }
265 269
266 270
267 /* we needed http{}'s cf->ctx while the merging configuration */
268
269 *cf = pcf;
270
271
272 /* init lists of the handlers */ 271 /* init lists of the handlers */
273 272
274 if (ngx_array_init(&cmcf->phases[NGX_HTTP_REWRITE_PHASE].handlers, 273 if (ngx_array_init(&cmcf->phases[NGX_HTTP_REWRITE_PHASE].handlers,
275 cf->pool, 1, sizeof(ngx_http_handler_pt)) != NGX_OK) 274 cf->pool, 1, sizeof(ngx_http_handler_pt)) != NGX_OK)
276 { 275 {
319 cmcf->headers_in_hash.max_size = 100; 318 cmcf->headers_in_hash.max_size = 100;
320 cmcf->headers_in_hash.bucket_limit = 1; 319 cmcf->headers_in_hash.bucket_limit = 1;
321 cmcf->headers_in_hash.bucket_size = sizeof(ngx_http_header_t); 320 cmcf->headers_in_hash.bucket_size = sizeof(ngx_http_header_t);
322 cmcf->headers_in_hash.name = "http headers_in"; 321 cmcf->headers_in_hash.name = "http headers_in";
323 322
324 if (ngx_hash_init(&cmcf->headers_in_hash, cf->pool, ngx_http_headers_in) 323 if (ngx_hash_init(&cmcf->headers_in_hash, cf->pool, ngx_http_headers_in, 0)
325 != NGX_OK) 324 != NGX_OK)
326 { 325 {
327 return NGX_CONF_ERROR; 326 return NGX_CONF_ERROR;
328 } 327 }
329 328
330 ngx_log_debug2(NGX_LOG_DEBUG_HTTP, cf->log, 0, 329 ngx_log_debug2(NGX_LOG_DEBUG_HTTP, cf->log, 0,
331 "http headers_in hash size: %ui, max buckets per entry: %ui", 330 "http headers_in hash size: %ui, max buckets per entry: %ui",
332 cmcf->headers_in_hash.hash_size, 331 cmcf->headers_in_hash.hash_size,
333 cmcf->headers_in_hash.min_buckets); 332 cmcf->headers_in_hash.min_buckets);
333
334 for (m = 0; ngx_modules[m]; m++) {
335 if (ngx_modules[m]->type != NGX_HTTP_MODULE) {
336 continue;
337 }
338
339 module = ngx_modules[m]->ctx;
340 mi = ngx_modules[m]->ctx_index;
341
342 if (module->postconfiguration) {
343 if (module->postconfiguration(cf) != NGX_OK) {
344 return NGX_CONF_ERROR;
345 }
346 }
347 }
348
349
350 /*
351 * http{}'s cf->ctx was needed while the configuration merging
352 * and in postconfiguration process
353 */
354
355 *cf = pcf;
356
334 357
335 /* 358 /*
336 * create the lists of ports, addresses and server names 359 * create the lists of ports, addresses and server names
337 * to quickly find the server core module configuration at run-time 360 * to quickly find the server core module configuration at run-time
338 */ 361 */