comparison src/http/ngx_http_write_filter.c @ 67:5a7d1aaa1618

nginx-0.0.1-2003-03-11-23:38:13 import
author Igor Sysoev <igor@sysoev.ru>
date Tue, 11 Mar 2003 20:38:13 +0000
parents 36d2c25cc9bb
children e43f406e4525
comparison
equal deleted inserted replaced
66:4876cd4a36bb 67:5a7d1aaa1618
68 ctx = (ngx_http_write_filter_ctx_t *) 68 ctx = (ngx_http_write_filter_ctx_t *)
69 ngx_http_get_module_ctx(r->main ? r->main : r, 69 ngx_http_get_module_ctx(r->main ? r->main : r,
70 ngx_http_write_filter_module); 70 ngx_http_write_filter_module);
71 if (ctx == NULL) { 71 if (ctx == NULL) {
72 ngx_http_create_ctx(r, ctx, ngx_http_write_filter_module, 72 ngx_http_create_ctx(r, ctx, ngx_http_write_filter_module,
73 sizeof(ngx_http_write_filter_ctx_t)); 73 sizeof(ngx_http_write_filter_ctx_t), NGX_ERROR);
74 } 74 }
75 75
76 size = flush = 0; 76 size = flush = 0;
77 last = 0; 77 last = 0;
78 le = &ctx->out; 78 le = &ctx->out;
79 79
80 /* find the size, the flush point and the last entry of saved chain */ 80 /* find the size, the flush point and the last entry of saved chain */
81 for (ce = ctx->out; ce; ce = ce->next) { 81 for (ce = ctx->out; ce; ce = ce->next) {
82 le = &ce->next; 82 le = &ce->next;
83 size += ce->hunk->last.file - ce->hunk->pos.file;
84 83
85 #if (NGX_DEBUG_WRITE_FILTER) 84 if (ce->hunk->type & NGX_HUNK_IN_MEMORY) {
86 ngx_log_debug(r->connection->log, "write filter: old chunk: %x " 85 size += ce->hunk->last - ce->hunk->pos;
87 QX_FMT " " QD_FMT _ 86 } else {
88 ce->hunk->type _ ce->hunk->pos.file _ 87 size += ce->hunk->file_last - ce->hunk->file_pos;
89 ce->hunk->last.file - ce->hunk->pos.file); 88 }
90 #endif
91 89
92 if (ce->hunk->type & (NGX_HUNK_FLUSH|NGX_HUNK_RECYCLED)) { 90 if (ce->hunk->type & (NGX_HUNK_FLUSH|NGX_HUNK_RECYCLED)) {
93 flush = size; 91 flush = size;
94 } 92 }
95 93
104 102
105 ce->hunk = in->hunk; 103 ce->hunk = in->hunk;
106 ce->next = NULL; 104 ce->next = NULL;
107 *le = ce; 105 *le = ce;
108 le = &ce->next; 106 le = &ce->next;
109 size += ce->hunk->last.file - ce->hunk->pos.file;
110 107
111 #if (NGX_DEBUG_WRITE_FILTER) 108 if (ce->hunk->type & NGX_HUNK_IN_MEMORY) {
112 ngx_log_debug(r->connection->log, "write filter: new hunk: %x " 109 size += ce->hunk->last - ce->hunk->pos;
113 QX_FMT " " QD_FMT _ 110 } else {
114 ce->hunk->type _ ce->hunk->pos.file _ 111 size += ce->hunk->file_last - ce->hunk->file_pos;
115 ce->hunk->last.file - ce->hunk->pos.file); 112 }
116 #endif
117 113
118 if (ce->hunk->type & (NGX_HUNK_FLUSH|NGX_HUNK_RECYCLED)) { 114 if (ce->hunk->type & (NGX_HUNK_FLUSH|NGX_HUNK_RECYCLED)) {
119 flush = size; 115 flush = size;
120 } 116 }
121 117