nginx-0.0.1-2003-11-03-01:56:18 import
diff --git a/src/core/ngx_conf_file.h b/src/core/ngx_conf_file.h
index 4bf6747..c1e2c01 100644
--- a/src/core/ngx_conf_file.h
+++ b/src/core/ngx_conf_file.h
@@ -150,6 +150,8 @@
 } ngx_conf_num_bounds_t;
 
 
+#define NGX_CONF_BITMASK_SET  1
+
 typedef struct {
     ngx_str_t  name;
     int        mask;
diff --git a/src/core/ngx_file.c b/src/core/ngx_file.c
index 84e86ff..80ad9dc 100644
--- a/src/core/ngx_file.c
+++ b/src/core/ngx_file.c
@@ -12,7 +12,7 @@
     int  rc;
 
     if (tf->file.fd == NGX_INVALID_FILE) {
-        rc = ngx_create_temp_file(&tf->file, &tf->path, tf->pool,
+        rc = ngx_create_temp_file(&tf->file, tf->path, tf->pool,
                                   tf->persistent);
     
         if (rc == NGX_ERROR || rc == NGX_AGAIN) {
@@ -24,7 +24,7 @@
         }
     }
 
-    return ngx_write_chain_to_file(&tf->file, chain, tf->file.offset, tf->pool);
+    return ngx_write_chain_to_file(&tf->file, chain, tf->offset, tf->pool);
 }
 
 
diff --git a/src/core/ngx_file.h b/src/core/ngx_file.h
index 660750a..8cf4c7d 100644
--- a/src/core/ngx_file.h
+++ b/src/core/ngx_file.h
@@ -28,7 +28,8 @@
 
 typedef struct {
     ngx_file_t   file;
-    ngx_path_t   path;
+    off_t        offset;
+    ngx_path_t  *path;
     ngx_pool_t  *pool;
     char        *warn;
 
diff --git a/src/core/ngx_hunk.h b/src/core/ngx_hunk.h
index e68ba6d..2c6664b 100644
--- a/src/core/ngx_hunk.h
+++ b/src/core/ngx_hunk.h
@@ -20,7 +20,7 @@
 #define NGX_HUNK_RECYCLED     0x0010
 
 /* the hunk is in file */
-#define NGX_HUNK_FILE         0x0100
+#define NGX_HUNK_FILE         0x0020
 
 #define NGX_HUNK_STORAGE      (NGX_HUNK_IN_MEMORY                            \
                                |NGX_HUNK_TEMP|NGX_HUNK_MEMORY|NGX_HUNK_MMAP  \
@@ -30,9 +30,12 @@
 
 /* in thread state flush means to write the hunk completely before return */
 /* in event state flush means to start to write the hunk */
-#define NGX_HUNK_FLUSH        0x1000
+#define NGX_HUNK_FLUSH        0x0100
 /* last hunk */
-#define NGX_HUNK_LAST         0x2000
+#define NGX_HUNK_LAST         0x0200
+
+
+#define NGX_HUNK_PREREAD      0x2000
 #define NGX_HUNK_LAST_SHADOW  0x4000
 #define NGX_HUNK_TEMP_FILE    0x8000
 
diff --git a/src/core/ngx_output_chain.c b/src/core/ngx_output_chain.c
index 69ed5bc..f196937 100644
--- a/src/core/ngx_output_chain.c
+++ b/src/core/ngx_output_chain.c
@@ -169,8 +169,12 @@
         return 0;
     }
 
-    if (!ctx->sendfile && (!(hunk->type & NGX_HUNK_IN_MEMORY))) {
-        return 1;
+    if (!ctx->sendfile) {
+        if (!(hunk->type & NGX_HUNK_IN_MEMORY)) {
+            return 1;
+        }
+
+        hunk->type &= ~NGX_HUNK_FILE;
     }
 
     if (ctx->need_in_memory && (!(hunk->type & NGX_HUNK_IN_MEMORY))) {