diff src/event/ngx_event_pipe.c @ 175:e92c2c647c57

nginx-0.0.1-2003-11-05-20:03:41 import
author Igor Sysoev <igor@sysoev.ru>
date Wed, 05 Nov 2003 17:03:41 +0000
parents caa57ddf6d77
children c0552e5ab567
line wrap: on
line diff
--- a/src/event/ngx_event_pipe.c
+++ b/src/event/ngx_event_pipe.c
@@ -245,8 +245,10 @@ int ngx_event_pipe_read_upstream(ngx_eve
                 p->upstream_eof = 1;
                 break;
             }
+
         }
 
+        p->read_length += n;
         cl = chain;
 
         while (cl && n > 0) {
@@ -402,6 +404,18 @@ int ngx_event_pipe_write_to_downstream(n
 
         for (cl = p->free; cl; cl = cl->next) {
 
+            if (cl->hunk->type & NGX_HUNK_TEMP_FILE) {
+                if (p->cachable || !p->cyclic_temp_file) {
+                    continue;
+                }
+
+                /* reset p->temp_offset if all hunks had been sent */
+
+                if (cl->hunk->file_last == p->temp_file->offset) {
+                    p->temp_file->offset = 0;
+                }
+            }
+
             /* TODO: free hunk if p->free_bufs && upstream done */
             /* add the free shadow raw hunk to p->free_raw_hunks */
 
@@ -416,6 +430,7 @@ int ngx_event_pipe_write_to_downstream(n
             }
             cl->hunk->shadow = NULL;
 
+#if 0
             if (p->cyclic_temp_file && (cl->hunk->type & NGX_HUNK_TEMP_FILE)) {
 
                 /* reset p->temp_offset if all hunks had been sent */
@@ -424,6 +439,7 @@ int ngx_event_pipe_write_to_downstream(n
                     p->temp_file->offset = 0;
                 }
             }
+#endif
         }
     }
 
@@ -518,11 +534,15 @@ ngx_log_debug(p->log, "size: %d" _ size)
         p->temp_file->offset += h->last - h->pos;
         h->file_last = p->temp_file->offset;
 
+        h->type |= NGX_HUNK_FILE|NGX_HUNK_TEMP_FILE;
+
+#if 0
         if (p->cachable) {
             h->type |= NGX_HUNK_FILE;
         } else {
             h->type |= NGX_HUNK_FILE|NGX_HUNK_TEMP_FILE;
         }
+#endif
 
         ngx_chain_add_link(p->out, p->last_out, cl);