comparison src/core/ngx_output_chain.c @ 4:4b2dafa26fe2 NGINX_0_1_2

nginx 0.1.2 *) Feature: the --user=USER, --group=GROUP, and --with-ld-opt=OPTIONS options in configure. *) Feature: the server_name directive supports *.domain.tld. *) Bugfix: the portability improvements. *) Bugfix: if configuration file was set in command line, the reconfiguration was impossible; bug appeared in 0.1.1. *) Bugfix: proxy module may get caught in an endless loop when sendfile is not used. *) Bugfix: with sendfile the response was not recoded according to the charset module directives; bug appeared in 0.1.1. *) Bugfix: very seldom bug in the kqueue processing. *) Bugfix: the gzip module compressed the proxied responses that was already compressed.
author Igor Sysoev <http://sysoev.ru>
date Thu, 21 Oct 2004 00:00:00 +0400
parents cc9f381affaa
children 46833bd150cb
comparison
equal deleted inserted replaced
3:8beaf7b3241f 4:4b2dafa26fe2
22 { 22 {
23 int rc, last; 23 int rc, last;
24 size_t size, bsize; 24 size_t size, bsize;
25 ngx_chain_t *cl, *out, **last_out; 25 ngx_chain_t *cl, *out, **last_out;
26 26
27 /* 27 if (ctx->in == NULL && ctx->busy == NULL) {
28 * the short path for the case when the ctx->in chain is empty 28
29 * and the incoming chain is empty too or it has the single buf 29 /*
30 * that does not require the copy 30 * the short path for the case when the ctx->in and ctx->busy chains
31 */ 31 * are empty, the incoming chain is empty too or has the single buf
32 32 * that does not require the copy
33 if (ctx->in == NULL) { 33 */
34 34
35 if (in == NULL) { 35 if (in == NULL) {
36 return ctx->output_filter(ctx->filter_ctx, in); 36 return ctx->output_filter(ctx->filter_ctx, in);
37 } 37 }
38 38
190 if (ngx_buf_special(buf)) { 190 if (ngx_buf_special(buf)) {
191 return 0; 191 return 0;
192 } 192 }
193 193
194 if (!ctx->sendfile) { 194 if (!ctx->sendfile) {
195
195 if (!ngx_buf_in_memory(buf)) { 196 if (!ngx_buf_in_memory(buf)) {
196 return 1; 197 return 1;
197 } 198 }
198 199
199 buf->in_file = 0; 200 buf->in_file = 0;
226 if (ngx_buf_in_memory(src)) { 227 if (ngx_buf_in_memory(src)) {
227 ngx_memcpy(dst->pos, src->pos, size); 228 ngx_memcpy(dst->pos, src->pos, size);
228 src->pos += size; 229 src->pos += size;
229 dst->last += size; 230 dst->last += size;
230 231
231 if (src->in_file && sendfile) { 232 if (src->in_file) {
232 dst->in_file = 1; 233
233 dst->file = src->file; 234 if (sendfile) {
234 dst->file_pos = src->file_pos; 235 dst->in_file = 1;
236 dst->file = src->file;
237 dst->file_pos = src->file_pos;
238 dst->file_last = src->file_pos + size;
239
240 } else {
241 dst->in_file = 0;
242 }
243
235 src->file_pos += size; 244 src->file_pos += size;
236 dst->file_last = src->file_pos;
237 245
238 } else { 246 } else {
239 dst->in_file = 0; 247 dst->in_file = 0;
240 } 248 }
241 249
269 277
270 if (sendfile) { 278 if (sendfile) {
271 dst->in_file = 1; 279 dst->in_file = 1;
272 dst->file = src->file; 280 dst->file = src->file;
273 dst->file_pos = src->file_pos; 281 dst->file_pos = src->file_pos;
274 src->file_pos += size; 282 dst->file_last = src->file_pos + n;
275 dst->file_last = src->file_pos;
276 283
277 } else { 284 } else {
278 dst->in_file = 0; 285 dst->in_file = 0;
279 src->file_pos += n; 286 }
280 } 287
288 src->file_pos += n;
281 289
282 if (src->last_buf && src->file_pos == src->file_last) { 290 if (src->last_buf && src->file_pos == src->file_last) {
283 dst->last_buf = 1; 291 dst->last_buf = 1;
284 } 292 }
285 } 293 }