nginx-0.0.1-2002-08-20-18:48:28 import
diff --git a/src/http/modules/ngx_http_header_filter.c b/src/http/modules/ngx_http_header_filter.c
index d247654..efe0744 100644
--- a/src/http/modules/ngx_http_header_filter.c
+++ b/src/http/modules/ngx_http_header_filter.c
@@ -1,4 +1,11 @@
 
+#include <nginx.h>
+
+#include <ngx_config.h>
+#include <ngx_string.h>
+#include <ngx_hunk.h>
+#include <ngx_http.h>
+
 
 typedef struct {
     int    len;
@@ -18,44 +25,60 @@
     ngx_hunk_t   *h;
     ngx_chain_t  *ch;
 
-    ngx_test_null(h, ngx_get_hunk(r->pool, 1024, 0, 64), NGX_HTTP_FILTER_ERROR);
+    ngx_test_null(h, ngx_get_hunk(r->pool, 1024, 0, 64),
+                  /* STUB */
+                  -1);
+/*
+                  NGX_HTTP_FILTER_ERROR);
+*/
 
-    status = r->headers_out->status - GX_HTTP_OK;
+    status = r->headers_out->status - NGX_HTTP_OK;
 
-    ngx_memcpy(h->pos.mem, "HTTP/1.0 ", 9);
-    h->pos.mem += 9;
-    ngx_memcpy(h->pos.mem, http_codes[status].line, http_codes[status].len);
-    h->pos.mem += http_codes[status].len;
-    *(h->pos.mem++) = CR; *(h->pos.mem++) = LF;
+    ngx_memcpy(h->last.mem, "HTTP/1.0 ", 9);
+    h->last.mem += 9;
+    ngx_memcpy(h->last.mem, http_codes[status].line, http_codes[status].len);
+    h->last.mem += http_codes[status].len;
+    *(h->last.mem++) = CR; *(h->last.mem++) = LF;
 
-    memcpy(h->pos.mem, "Date: ", 6);
-    h->pos.mem += 6;
-    h->pos.mem += ngx_http_get_time(h->pos.mem, time());
-    *(h->pos.mem++) = CR; *(h->pos.mem++) = LF;
+/*
+    memcpy(h->last.mem, "Date: ", 6);
+    h->last.mem += 6;
+    h->last.mem += ngx_http_get_time(h->last.mem, time(NULL));
+    *(h->last.mem++) = CR; *(h->last.mem++) = LF;
+*/
 
     /* 2^64 is 20 characters  */
     if (r->headers_out->content_length)
-        h->pos.mem += ngx_snprintf(h->pos.mem, 49, "Content-Length: %d" CRLF,
-                                   r->headers_out->content_length);
+        h->last.mem += ngx_snprintf(h->last.mem, 49, "Content-Length: %d" CRLF,
+                                    r->headers_out->content_length);
 
     /* check */
 
-    memcpy(h->pos.mem, "Server: ", 8);
-    h->pos.mem += 8;
+    memcpy(h->last.mem, "Server: ", 8);
+    h->last.mem += 8;
     if (r->headers_out->server) {
-        h->pos.mem = ngx_cpystrn(h->pos.mem, r->headers_out->server,
-                                 h->last.mem - h->pos.mem);
-        check space
+        h->last.mem = ngx_cpystrn(h->last.mem, r->headers_out->server,
+                                  h->end - h->last.mem);
+
+        /* check space */
+
     } else {
-        ngx_memcpy(h->pos.mem, NGINX_VER, sizeof(NGINX_VER));
-        h->pos.mem += sizeof(NGINX_VER);
+        ngx_memcpy(h->last.mem, NGINX_VER, sizeof(NGINX_VER));
+        h->last.mem += sizeof(NGINX_VER);
     }
-    *(h->pos.mem++) = CR; *(h->pos.mem++) = LF;
+    *(h->last.mem++) = CR; *(h->last.mem++) = LF;
+
+    /* end of HTTP header */
+    *(h->last.mem++) = CR; *(h->last.mem++) = LF;
 
     ngx_test_null(ch, ngx_palloc(r->pool, sizeof(ngx_chain_t)),
+                  /* STUB */
+                  -1);
+/*
                   NGX_HTTP_FILTER_ERROR);
+*/
 
-    ch->hunk = in->hunk;
+    ch->hunk = h;
     ch->next = NULL;
 
     return ngx_http_write_filter(r, ch);
diff --git a/src/http/modules/ngx_http_static_handler.c b/src/http/modules/ngx_http_static_handler.c
index f2053c4..20d0b9e 100644
--- a/src/http/modules/ngx_http_static_handler.c
+++ b/src/http/modules/ngx_http_static_handler.c
@@ -1,55 +1,114 @@
 
 #include <ngx_config.h>
-
-#include <ngx_strings.h>
-#include <ngx_open.h>
-#include <ngx_stat.h>
-
+#include <ngx_string.h>
+#include <ngx_file.h>
+#include <ngx_hunk.h>
 #include <ngx_http.h>
 
+ngx_http_module_t  ngx_http_static_module;
+
+
+#if 0
+/* STUB */
+static ngx_http_static_ctx_t module_ctx;
+
+void ngx_http_static_init()
+{
+     module_ctx.out = NULL;
+
+     ngx_http_static_module.ctx = &module_ctx;
+}
+/* */
+#endif
+
+
 int ngx_http_static_handler(ngx_http_request_t *r)
 {
-    int          index_len, err, i;
-    char        *name, *loc, *file
-    ngx_file_t   fd;
+    int rc;
+    ngx_hunk_t  *h;
+    ngx_chain_t *ch;
 
-    ngx_http_header_out_t  out;
+/*
     ngx_http_event_static_handler_loc_conf_t  *cf;
 
     cf = (ngx_http_event_static_handler_loc_conf_t *)
              ngx_get_module_loc_conf(r, &ngx_http_event_static_handler_module);
 
-    ngx_assert(r->fd, return NGX_HTTP_INTERNAL_SERVER_ERROR,
-               r->connection->log, "ngx_http_static_handler: no file");
+*/
 
-    out.status = NGX_HTTP_OK;
-    out.content_length = r->stat.sb_size;
-    out.last_modified = r->stat.sb_mtime;
+    r->fd = ngx_open_file(r->filename, NGX_FILE_RDONLY);
+    if (r->fd == -1) {
+        ngx_log_error(NGX_LOG_ERR, r->connection->log, ngx_errno,
+                      "ngx_http_static_handler: "
+                      ngx_open_file_n " %s failed", r->filename);
+        /* STUB */
+        return -1;
+    }
 
-    /* */
-    out.content_type = "text/html";
+    if (ngx_stat_fd(r->fd, &r->file_info) == -1) {
+        ngx_log_error(NGX_LOG_ERR, r->connection->log, ngx_errno,
+                      "ngx_http_static_handler: "
+                      ngx_stat_fd_n " %s failed", r->filename);
+        /* STUB */
+        return -1;
+    }
 
-    rc = ngx_send_http_header(&out);
+    r->headers_out->status = NGX_HTTP_OK;
+    r->headers_out->content_length = ngx_file_size(r->file_info);
+/*
+    r->headers_out->last_modified = ngx_file_mtime(r->file_info);
+*/
+
+    /* STUB */
+    r->headers_out->content_type = "text/html";
+
+    /* STUB */
+    rc = ngx_http_header_filter(r);
+/*
+    rc = ngx_send_http_header(r->headers_out);
+*/
     if (r->header_only)
         return rc;
 
-    /* NGX_HTTP_INTERNAL_SERVER_ERROR is too late */
+    /* TODO: NGX_HTTP_INTERNAL_SERVER_ERROR is too late */
 
+    /* STUB */
+    ngx_test_null(h, ngx_get_hunk(r->pool, 1024, 0, 64),
+                  /* STUB */
+                  -1);
+/*
     ngx_test_null(h, ngx_create_hunk(r->pool), NGX_HTTP_INTERNAL_SERVER_ERROR);
-    h->type = NGX_HUNK_FILE | NGX_HUNK_LAST;
+*/
+    h->type = NGX_HUNK_FILE|NGX_HUNK_LAST;
     h->fd = r->fd;
     h->pos.file = 0;
-    h->end.file = r->stat.sb_size;
+    h->last.file = ngx_file_size(r->file_info);
 
+    /* STUB */
+    ngx_test_null(ch, ngx_palloc(r->pool, sizeof(ngx_chain_t)),
+                  /* STUB */
+                  -1);
+/*
+                  NGX_HTTP_FILTER_ERROR);
+*/
+
+/*
     ngx_test_null(ch, ngx_create_chain(r->pool),
                   NGX_HTTP_INTERNAL_SERVER_ERROR);
+*/
     ch->hunk = h;
     ch->next = NULL;
 
-    return ngx_http_filter(ch);
+    /* STUB */
+    rc = ngx_http_write_filter(r, ch);
+    ngx_log_debug(r->connection->log, "write_filter: %d" _ rc);
+    return rc;
+/*
+    return ngx_http_filter(r, ch);
+*/
 }
 
-/*
+#if 0
 
 static void *ngx_create_index_config()
 {
@@ -98,4 +157,4 @@
     *conf = cf;
 }
 
-*/
+#endif