diff 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
line wrap: on
line diff
--- a/src/http/ngx_http.c
+++ b/src/http/ngx_http.c
@@ -10,6 +10,7 @@
 #include <ngx_http_core_module.h>
 
 
+static void ngx_http_init_filters(ngx_pool_t *pool, ngx_module_t **modules);
 static char *ngx_http_block(ngx_conf_t *cf, ngx_command_t *cmd, char *dummy);
 
 
@@ -59,6 +60,39 @@ ngx_module_t  ngx_http_module = {
 };
 
 
+
+static void ngx_http_init_filters(ngx_pool_t *pool, ngx_module_t **modules)
+{
+    int  i;
+    ngx_http_module_t  *module;
+    int (*ohf)(ngx_http_request_t *r);
+    int (*obf)(ngx_http_request_t *r, ngx_chain_t *ch);
+
+    ohf = NULL;
+    obf = NULL;
+
+    for (i = 0; modules[i]; i++) {
+        if (modules[i]->type != NGX_HTTP_MODULE_TYPE) {
+            continue;
+        }
+
+        module = (ngx_http_module_t *) modules[i]->ctx;
+
+        if (module->output_header_filter) {
+            module->next_output_header_filter = ohf;
+            ohf = module->output_header_filter;
+        }
+
+        if (module->output_body_filter) {
+            module->next_output_body_filter = obf;
+            obf = module->output_body_filter;
+        }
+    }
+
+    ngx_http_top_header_filter = ohf;
+}
+
+
 static char *ngx_http_block(ngx_conf_t *cf, ngx_command_t *cmd, char *dummy)
 {
     int                         i, s, l, p, a, n, start;
@@ -442,9 +476,13 @@ int ngx_http_init(ngx_pool_t *pool, ngx_
     ls->family = AF_INET;
     ls->type = SOCK_STREAM;
     ls->protocol = IPPROTO_IP;
+
 #if (NGX_OVERLAPPED)
     ls->flags = WSA_FLAG_OVERLAPPED;
+#else
+    ls->nonblocking = 1;
 #endif
+
     ls->sockaddr = (struct sockaddr *) &addr;
     ls->socklen = sizeof(struct sockaddr_in);
     ls->addr = offsetof(struct sockaddr_in, sin_addr);
@@ -452,7 +490,6 @@ int ngx_http_init(ngx_pool_t *pool, ngx_
     ls->addr_text.data = addr_text;
     ls->backlog = -1;
     ls->post_accept_timeout = 10000;
-    ls->nonblocking = 1;
 
     ls->handler = ngx_http_init_connection;
     ls->server = &ngx_http_server;