Mercurial > hg > nginx
comparison src/http/ngx_http.c @ 59:e8cdc2989cee
nginx-0.0.1-2003-02-06-20:21:13 import
author | Igor Sysoev <igor@sysoev.ru> |
---|---|
date | Thu, 06 Feb 2003 17:21:13 +0000 |
parents | a499e0d1f16e |
children | 34d647deb1da |
comparison
equal
deleted
inserted
replaced
58:6b13b1cadabe | 59:e8cdc2989cee |
---|---|
8 #include <ngx_http.h> | 8 #include <ngx_http.h> |
9 #include <ngx_http_config.h> | 9 #include <ngx_http_config.h> |
10 #include <ngx_http_core_module.h> | 10 #include <ngx_http_core_module.h> |
11 | 11 |
12 | 12 |
13 static void ngx_http_init_filters(ngx_pool_t *pool, ngx_module_t **modules); | |
13 static char *ngx_http_block(ngx_conf_t *cf, ngx_command_t *cmd, char *dummy); | 14 static char *ngx_http_block(ngx_conf_t *cf, ngx_command_t *cmd, char *dummy); |
14 | 15 |
15 | 16 |
16 int ngx_http_max_module; | 17 int ngx_http_max_module; |
17 | 18 |
55 &http_name, /* module context */ | 56 &http_name, /* module context */ |
56 ngx_http_commands, /* module directives */ | 57 ngx_http_commands, /* module directives */ |
57 NGX_CORE_MODULE_TYPE, /* module type */ | 58 NGX_CORE_MODULE_TYPE, /* module type */ |
58 NULL /* init module */ | 59 NULL /* init module */ |
59 }; | 60 }; |
61 | |
62 | |
63 | |
64 static void ngx_http_init_filters(ngx_pool_t *pool, ngx_module_t **modules) | |
65 { | |
66 int i; | |
67 ngx_http_module_t *module; | |
68 int (*ohf)(ngx_http_request_t *r); | |
69 int (*obf)(ngx_http_request_t *r, ngx_chain_t *ch); | |
70 | |
71 ohf = NULL; | |
72 obf = NULL; | |
73 | |
74 for (i = 0; modules[i]; i++) { | |
75 if (modules[i]->type != NGX_HTTP_MODULE_TYPE) { | |
76 continue; | |
77 } | |
78 | |
79 module = (ngx_http_module_t *) modules[i]->ctx; | |
80 | |
81 if (module->output_header_filter) { | |
82 module->next_output_header_filter = ohf; | |
83 ohf = module->output_header_filter; | |
84 } | |
85 | |
86 if (module->output_body_filter) { | |
87 module->next_output_body_filter = obf; | |
88 obf = module->output_body_filter; | |
89 } | |
90 } | |
91 | |
92 ngx_http_top_header_filter = ohf; | |
93 } | |
60 | 94 |
61 | 95 |
62 static char *ngx_http_block(ngx_conf_t *cf, ngx_command_t *cmd, char *dummy) | 96 static char *ngx_http_block(ngx_conf_t *cf, ngx_command_t *cmd, char *dummy) |
63 { | 97 { |
64 int i, s, l, p, a, n, start; | 98 int i, s, l, p, a, n, start; |
440 7, ":%d", ntohs(addr.sin_port)); | 474 7, ":%d", ntohs(addr.sin_port)); |
441 | 475 |
442 ls->family = AF_INET; | 476 ls->family = AF_INET; |
443 ls->type = SOCK_STREAM; | 477 ls->type = SOCK_STREAM; |
444 ls->protocol = IPPROTO_IP; | 478 ls->protocol = IPPROTO_IP; |
479 | |
445 #if (NGX_OVERLAPPED) | 480 #if (NGX_OVERLAPPED) |
446 ls->flags = WSA_FLAG_OVERLAPPED; | 481 ls->flags = WSA_FLAG_OVERLAPPED; |
447 #endif | 482 #else |
483 ls->nonblocking = 1; | |
484 #endif | |
485 | |
448 ls->sockaddr = (struct sockaddr *) &addr; | 486 ls->sockaddr = (struct sockaddr *) &addr; |
449 ls->socklen = sizeof(struct sockaddr_in); | 487 ls->socklen = sizeof(struct sockaddr_in); |
450 ls->addr = offsetof(struct sockaddr_in, sin_addr); | 488 ls->addr = offsetof(struct sockaddr_in, sin_addr); |
451 ls->addr_text.len = INET_ADDRSTRLEN; | 489 ls->addr_text.len = INET_ADDRSTRLEN; |
452 ls->addr_text.data = addr_text; | 490 ls->addr_text.data = addr_text; |
453 ls->backlog = -1; | 491 ls->backlog = -1; |
454 ls->post_accept_timeout = 10000; | 492 ls->post_accept_timeout = 10000; |
455 ls->nonblocking = 1; | |
456 | 493 |
457 ls->handler = ngx_http_init_connection; | 494 ls->handler = ngx_http_init_connection; |
458 ls->server = &ngx_http_server; | 495 ls->server = &ngx_http_server; |
459 ls->log = log; | 496 ls->log = log; |
460 | 497 |