comparison src/http/ngx_http_output_filter.c @ 76:6127d7075471

nginx-0.0.1-2003-04-15-19:06:52 import
author Igor Sysoev <igor@sysoev.ru>
date Tue, 15 Apr 2003 15:06:52 +0000
parents 869b10be682f
children a7e45c45a95c
comparison
equal deleted inserted replaced
75:869b10be682f 76:6127d7075471
63 #define next_filter ngx_http_output_filter_module_ctx.next_output_body_filter 63 #define next_filter ngx_http_output_filter_module_ctx.next_output_body_filter
64 #endif 64 #endif
65 65
66 #define need_to_copy(r, hunk) \ 66 #define need_to_copy(r, hunk) \
67 (((r->filter & NGX_HTTP_FILTER_NEED_IN_MEMORY) \ 67 (((r->filter & NGX_HTTP_FILTER_NEED_IN_MEMORY) \
68 && (hunk->type & NGX_HUNK_FILE)) \ 68 && (hunk->type & NGX_HUNK_IN_MEMORY) == 0) \
69 || ((r->filter & NGX_HTTP_FILTER_NEED_TEMP) \ 69 || ((r->filter & NGX_HTTP_FILTER_NEED_TEMP) \
70 && (hunk->type & (NGX_HUNK_MEMORY|NGX_HUNK_MMAP)))) 70 && (hunk->type & (NGX_HUNK_MEMORY|NGX_HUNK_MMAP))))
71 71
72 72
73 int ngx_http_output_filter(ngx_http_request_t *r, ngx_hunk_t *hunk) 73 int ngx_http_output_filter(ngx_http_request_t *r, ngx_hunk_t *hunk)
255 if (size > (dst->end - dst->pos)) { 255 if (size > (dst->end - dst->pos)) {
256 size = dst->end - dst->pos; 256 size = dst->end - dst->pos;
257 } 257 }
258 258
259 if (src->type & NGX_HUNK_IN_MEMORY) { 259 if (src->type & NGX_HUNK_IN_MEMORY) {
260 ngx_memcpy(src->pos, dst->pos, size); 260 ngx_memcpy(dst->pos, src->pos, size);
261 src->pos += size; 261 src->pos += size;
262 dst->last += size; 262 dst->last += size;
263 263
264 if (src->type & NGX_HUNK_FILE) { 264 if (src->type & NGX_HUNK_FILE) {
265 src->file_pos += n; 265 src->file_pos += size;
266 } 266 }
267 267
268 if ((src->type & NGX_HUNK_LAST) && src->pos == src->last) { 268 if ((src->type & NGX_HUNK_LAST) && src->pos == src->last) {
269 dst->type |= NGX_HUNK_LAST; 269 dst->type |= NGX_HUNK_LAST;
270 } 270 }