Mercurial > hg > nginx
comparison src/http/ngx_http_core.c @ 42:cd035a94e0b6
nginx-0.0.1-2002-12-27-10:27:47 import
author | Igor Sysoev <igor@sysoev.ru> |
---|---|
date | Fri, 27 Dec 2002 07:27:47 +0000 |
parents | 59e7c7f30d49 |
children | 53cd05892261 |
comparison
equal
deleted
inserted
replaced
41:59e7c7f30d49 | 42:cd035a94e0b6 |
---|---|
19 | 19 |
20 int (*ngx_http_top_header_filter) (ngx_http_request_t *r); | 20 int (*ngx_http_top_header_filter) (ngx_http_request_t *r); |
21 | 21 |
22 int ngx_http_max_module; | 22 int ngx_http_max_module; |
23 | 23 |
24 | 24 #if 0 |
25 static ngx_command_t ngx_http_core_commands[] = { | 25 static ngx_command_t ngx_http_core_commands[] = { |
26 | 26 |
27 {ngx_string("send_timeout"), | 27 {ngx_string("send_timeout"), |
28 NGX_CONF_TAKE1, | 28 NGX_CONF_TAKE1, |
29 ngx_conf_set_time_slot, | 29 ngx_conf_set_time_slot, |
30 NGX_HTTP_LOC_CONF, | 30 NGX_HTTP_LOC_CONF, |
31 offsetof(ngx_http_core_loc_conf_t, send_timeout)}, | 31 offsetof(ngx_http_core_loc_conf_t, send_timeout)}, |
32 | 32 |
33 {ngx_string(""), 0, NULL, 0, 0} | 33 {ngx_string(""), 0, NULL, 0, 0} |
34 }; | 34 }; |
35 | 35 #endif |
36 | 36 |
37 ngx_http_module_t ngx_http_core_module_ctx = { | 37 ngx_http_module_t ngx_http_core_module_ctx = { |
38 NGX_HTTP_MODULE, | 38 NGX_HTTP_MODULE, |
39 | 39 |
40 ngx_http_core_create_srv_conf, /* create server config */ | 40 ngx_http_core_create_srv_conf, /* create server config */ |
41 NULL, /* init server config */ | |
41 ngx_http_core_create_loc_conf, /* create location config */ | 42 ngx_http_core_create_loc_conf, /* create location config */ |
43 NULL, /* merge location config */ | |
42 | 44 |
43 ngx_http_core_translate_handler, /* translate handler */ | 45 ngx_http_core_translate_handler, /* translate handler */ |
44 | 46 |
45 NULL, /* output header filter */ | 47 NULL, /* output header filter */ |
46 NULL, /* next output header filter */ | 48 NULL, /* next output header filter */ |
47 NULL, /* output body filter */ | 49 NULL, /* output body filter */ |
48 NULL, /* next output body filter */ | 50 NULL, /* next output body filter */ |
49 }; | 51 }; |
50 | 52 |
51 | 53 #if 0 |
52 ngx_module_t ngx_http_core_module = { | 54 ngx_module_t ngx_http_core_module = { |
53 &ngx_http_core_module_ctx, /* module context */ | 55 &ngx_http_core_module_ctx, /* module context */ |
54 ngx_http_core_commands, /* module directives */ | 56 ngx_http_core_commands, /* module directives */ |
55 NGX_HTTP_MODULE_TYPE, /* module type */ | 57 NGX_HTTP_MODULE_TYPE, /* module type */ |
56 NULL /* init module */ | 58 NULL /* init module */ |
57 }; | 59 }; |
58 | 60 #endif |
59 | 61 |
60 int ngx_http_handler(ngx_http_request_t *r) | 62 int ngx_http_handler(ngx_http_request_t *r) |
61 { | 63 { |
62 int rc, i; | 64 int rc, i; |
63 ngx_http_module_t *module; | 65 ngx_http_module_t *module; |
263 | 265 |
264 ngx_assert((r->file.fd != NGX_INVALID_FILE), /* void */ ; , | 266 ngx_assert((r->file.fd != NGX_INVALID_FILE), /* void */ ; , |
265 r->connection->log, "file already closed"); | 267 r->connection->log, "file already closed"); |
266 | 268 |
267 if (r->file.fd != NGX_INVALID_FILE) { | 269 if (r->file.fd != NGX_INVALID_FILE) { |
268 /* STUB WIN32 */ | 270 if (ngx_close_file(r->file.fd) == NGX_FILE_ERROR) { |
269 #if (WIN32) | |
270 if (ngx_close_file(r->file.fd) == 0) | |
271 #else | |
272 if (ngx_close_file(r->file.fd) == -1) | |
273 #endif | |
274 ngx_log_error(NGX_LOG_ERR, r->connection->log, ngx_errno, | 271 ngx_log_error(NGX_LOG_ERR, r->connection->log, ngx_errno, |
275 ngx_close_file_n " failed"); | 272 ngx_close_file_n " failed"); |
273 } | |
276 } | 274 } |
277 | 275 |
278 /* | 276 /* |
279 if (r->logging) | 277 if (r->logging) |
280 ngx_http_log_request(r); | 278 ngx_http_log_request(r); |
305 | 303 |
306 return ngx_http_handler(r); | 304 return ngx_http_handler(r); |
307 } | 305 } |
308 | 306 |
309 | 307 |
310 #if 0 | |
311 | |
312 | |
313 {"http", ngx_http_enter_container, 0, | |
314 NGX_GLOBAL_CONF, NGX_CONF_CONTAINER}, | |
315 | |
316 {"server", ngx_http_enter_server_container, 0, | |
317 NGX_HTTP_CONF, NGX_CONF_CONTAINER], | |
318 | |
319 {"location", ngx_http_enter_location_container, 0, | |
320 NGX_HTTP_SRV_CONF, NGX_CONF_CONTAINER|NGX_CONF_TAKE1} | |
321 | |
322 | |
323 int ngx_http_enter_container() | |
324 { | |
325 create_srv_conf(null_srv_conf) | |
326 create_loc_conf(null_loc_conf) | |
327 } | |
328 | |
329 int ngx_http_exit_container() | |
330 { | |
331 nothing ? | |
332 } | |
333 | |
334 | |
335 int ngx_http_enter_server_container() | |
336 { | |
337 create_srv_conf() | |
338 create_loc_conf(NULL) | |
339 } | |
340 | |
341 int ngx_http_exit_server_container() | |
342 { | |
343 merge_srv_conf(srv_conf, null_srv_conf) | |
344 merge_loc_conf(loc_conf, null_loc_conf) | |
345 | |
346 iterate check_loc_conf_is_set and merge_loc_conf() | |
347 } | |
348 | |
349 int ngx_http_enter_location_container() | |
350 { | |
351 create_loc_conf(loc) | |
352 | |
353 push to array | |
354 } | |
355 | |
356 int ngx_http_exit_location_container() | |
357 { | |
358 } | |
359 | |
360 #endif | |
361 | |
362 | |
363 static void *ngx_http_core_create_srv_conf(ngx_pool_t *pool) | 308 static void *ngx_http_core_create_srv_conf(ngx_pool_t *pool) |
364 { | 309 { |
365 ngx_http_core_srv_conf_t *conf; | 310 ngx_http_core_srv_conf_t *conf; |
366 | 311 |
367 ngx_test_null(conf, | 312 ngx_test_null(conf, |
384 conf->send_timeout = NGX_CONF_UNSET; | 329 conf->send_timeout = NGX_CONF_UNSET; |
385 */ | 330 */ |
386 | 331 |
387 return conf; | 332 return conf; |
388 } | 333 } |
389 | |
390 #if 0 | |
391 static void *ngx_http_core_create_conf(ngx_pool_t *pool) | |
392 { | |
393 | |
394 ngx_test_null(conf, ngx_palloc(pool, sizeof(ngx_http_core_conf_t)), NULL); | |
395 | |
396 ngx_test_null(conf->srv, ngx_http_core_create_srv_conf_t(pool), NULL); | |
397 ngx_test_null(conf->loc, ngx_http_core_create_loc_conf_t(pool), NULL); | |
398 conf->parent = | |
399 conf->next = NULL; | |
400 } | |
401 #endif |