Mercurial > hg > nginx-vendor-0-8
comparison src/event/ngx_event_pipe.c @ 10:46833bd150cb NGINX_0_1_5
nginx 0.1.5
*) Bugfix: on Solaris and Linux there may be too many "recvmsg()
returned not enough data" alerts.
*) Bugfix: there were the "writev() failed (22: Invalid argument)"
errors on Solaris in proxy mode without sendfile. On other platforms
that do not support sendfile at all the process got caught in an
endless loop.
*) Bugfix: segmentation fault on Solaris in proxy mode and using
sendfile.
*) Bugfix: segmentation fault on Solaris.
*) Bugfix: on-line upgrade did not work on Linux.
*) Bugfix: the ngx_http_autoindex_module module did not escape the
spaces, the quotes, and the percent signs in the directory listing.
*) Change: the decrease of the copy operations.
*) Feature: the userid_p3p directive.
author | Igor Sysoev <http://sysoev.ru> |
---|---|
date | Thu, 11 Nov 2004 00:00:00 +0300 |
parents | 80ba094c6b3e |
children | 74b1868dd3cd |
comparison
equal
deleted
inserted
replaced
9:77eee314ddbd | 10:46833bd150cb |
---|---|
77 } | 77 } |
78 | 78 |
79 | 79 |
80 ngx_int_t ngx_event_pipe_read_upstream(ngx_event_pipe_t *p) | 80 ngx_int_t ngx_event_pipe_read_upstream(ngx_event_pipe_t *p) |
81 { | 81 { |
82 int n, rc, size; | 82 ssize_t n, size; |
83 ngx_int_t rc; | |
83 ngx_buf_t *b; | 84 ngx_buf_t *b; |
84 ngx_chain_t *chain, *cl, *tl; | 85 ngx_chain_t *chain, *cl, *tl; |
85 | 86 |
86 if (p->upstream_eof || p->upstream_error || p->upstream_done) { | 87 if (p->upstream_eof || p->upstream_error || p->upstream_done) { |
87 return NGX_OK; | 88 return NGX_OK; |
107 chain = p->preread_bufs; | 108 chain = p->preread_bufs; |
108 p->preread_bufs = NULL; | 109 p->preread_bufs = NULL; |
109 n = p->preread_size; | 110 n = p->preread_size; |
110 | 111 |
111 ngx_log_debug1(NGX_LOG_DEBUG_EVENT, p->log, 0, | 112 ngx_log_debug1(NGX_LOG_DEBUG_EVENT, p->log, 0, |
112 "pipe preread: %d", n); | 113 "pipe preread: %z", n); |
113 | 114 |
114 if (n) { | 115 if (n) { |
115 p->read = 1; | 116 p->read = 1; |
116 } | 117 } |
117 | 118 |
195 */ | 196 */ |
196 | 197 |
197 rc = ngx_event_pipe_write_chain_to_temp_file(p); | 198 rc = ngx_event_pipe_write_chain_to_temp_file(p); |
198 | 199 |
199 ngx_log_debug1(NGX_LOG_DEBUG_EVENT, p->log, 0, | 200 ngx_log_debug1(NGX_LOG_DEBUG_EVENT, p->log, 0, |
200 "pipe temp offset: %d", p->temp_file->offset); | 201 "pipe temp offset: %O", p->temp_file->offset); |
201 | 202 |
202 if (rc == NGX_AGAIN) { | 203 if (rc == NGX_AGAIN) { |
203 if (ngx_event_flags & NGX_USE_LEVEL_EVENT | 204 if (ngx_event_flags & NGX_USE_LEVEL_EVENT |
204 && p->upstream->read->active | 205 && p->upstream->read->active |
205 && p->upstream->read->ready) | 206 && p->upstream->read->ready) |
235 } | 236 } |
236 | 237 |
237 n = ngx_recv_chain(p->upstream, chain); | 238 n = ngx_recv_chain(p->upstream, chain); |
238 | 239 |
239 ngx_log_debug1(NGX_LOG_DEBUG_EVENT, p->log, 0, | 240 ngx_log_debug1(NGX_LOG_DEBUG_EVENT, p->log, 0, |
240 "pipe recv chain: %d", n); | 241 "pipe recv chain: %z", n); |
241 | 242 |
242 if (p->free_raw_bufs) { | 243 if (p->free_raw_bufs) { |
243 chain->next = p->free_raw_bufs; | 244 chain->next = p->free_raw_bufs; |
244 } | 245 } |
245 p->free_raw_bufs = chain; | 246 p->free_raw_bufs = chain; |
301 ngx_log_debug0(NGX_LOG_DEBUG_EVENT, p->log, 0, "pipe buf"); | 302 ngx_log_debug0(NGX_LOG_DEBUG_EVENT, p->log, 0, "pipe buf"); |
302 } | 303 } |
303 | 304 |
304 for (cl = p->busy; cl; cl = cl->next) { | 305 for (cl = p->busy; cl; cl = cl->next) { |
305 ngx_log_debug3(NGX_LOG_DEBUG_EVENT, p->log, 0, | 306 ngx_log_debug3(NGX_LOG_DEBUG_EVENT, p->log, 0, |
306 "pipe buf busy " PTR_FMT ", pos " PTR_FMT ", size: %d", | 307 "pipe buf busy %p, pos %p, size: %z", |
307 cl->buf->start, cl->buf->pos, | 308 cl->buf->start, cl->buf->pos, |
308 cl->buf->last - cl->buf->pos); | 309 cl->buf->last - cl->buf->pos); |
309 } | 310 } |
310 | 311 |
311 for (cl = p->out; cl; cl = cl->next) { | 312 for (cl = p->out; cl; cl = cl->next) { |
312 if (cl->buf->in_file && cl->buf->temporary) { | 313 if (cl->buf->in_file && cl->buf->temporary) { |
313 ngx_log_debug5(NGX_LOG_DEBUG_EVENT, p->log, 0, | 314 ngx_log_debug5(NGX_LOG_DEBUG_EVENT, p->log, 0, |
314 "pipe buf out shadow " | 315 "pipe buf out shadow %p, pos %p, size: %z " |
315 PTR_FMT ", pos " PTR_FMT ", size: %d " | 316 "file: %O, size: %z", |
316 "file: " OFF_T_FMT ", size: %d", | |
317 cl->buf->start, cl->buf->pos, | 317 cl->buf->start, cl->buf->pos, |
318 cl->buf->last - cl->buf->pos, | 318 cl->buf->last - cl->buf->pos, |
319 cl->buf->file_pos, | 319 cl->buf->file_pos, |
320 cl->buf->file_last - cl->buf->file_pos); | 320 cl->buf->file_last - cl->buf->file_pos); |
321 | 321 |
322 } else if (cl->buf->in_file) { | 322 } else if (cl->buf->in_file) { |
323 ngx_log_debug2(NGX_LOG_DEBUG_EVENT, p->log, 0, | 323 ngx_log_debug2(NGX_LOG_DEBUG_EVENT, p->log, 0, |
324 "pipe buf out file " OFF_T_FMT ", size: %d", | 324 "pipe buf out file %O, size: %z", |
325 cl->buf->file_pos, | 325 cl->buf->file_pos, |
326 cl->buf->file_last - cl->buf->file_pos); | 326 cl->buf->file_last - cl->buf->file_pos); |
327 } else { | 327 } else { |
328 ngx_log_debug3(NGX_LOG_DEBUG_EVENT, p->log, 0, | 328 ngx_log_debug3(NGX_LOG_DEBUG_EVENT, p->log, 0, |
329 "pipe buf out " PTR_FMT ", pos " PTR_FMT | 329 "pipe buf out %p, pos %p, size: %z", |
330 ", size: %d", | |
331 cl->buf->start, cl->buf->pos, | 330 cl->buf->start, cl->buf->pos, |
332 cl->buf->last - cl->buf->pos); | 331 cl->buf->last - cl->buf->pos); |
333 } | 332 } |
334 } | 333 } |
335 | 334 |
336 for (cl = p->in; cl; cl = cl->next) { | 335 for (cl = p->in; cl; cl = cl->next) { |
337 ngx_log_debug3(NGX_LOG_DEBUG_EVENT, p->log, 0, | 336 ngx_log_debug3(NGX_LOG_DEBUG_EVENT, p->log, 0, |
338 "pipe buf in " PTR_FMT ", pos " PTR_FMT ", size: %d", | 337 "pipe buf in %p, pos %p, size: %z", |
339 cl->buf->start, cl->buf->pos, | 338 cl->buf->start, cl->buf->pos, |
340 cl->buf->last - cl->buf->pos); | 339 cl->buf->last - cl->buf->pos); |
341 } | 340 } |
342 | 341 |
343 for (cl = p->free_raw_bufs; cl; cl = cl->next) { | 342 for (cl = p->free_raw_bufs; cl; cl = cl->next) { |
344 ngx_log_debug3(NGX_LOG_DEBUG_EVENT, p->log, 0, | 343 ngx_log_debug3(NGX_LOG_DEBUG_EVENT, p->log, 0, |
345 "pipe buf free " PTR_FMT ", last " PTR_FMT ", size: %d", | 344 "pipe buf free %p, last %p, size: %z", |
346 cl->buf->start, cl->buf->last, | 345 cl->buf->start, cl->buf->last, |
347 cl->buf->end - cl->buf->last); | 346 cl->buf->end - cl->buf->last); |
348 } | 347 } |
349 | 348 |
350 #endif | 349 #endif |
441 for (cl = p->busy; cl; cl = cl->next) { | 440 for (cl = p->busy; cl; cl = cl->next) { |
442 bsize += cl->buf->end - cl->buf->start; | 441 bsize += cl->buf->end - cl->buf->start; |
443 } | 442 } |
444 | 443 |
445 ngx_log_debug1(NGX_LOG_DEBUG_EVENT, p->log, 0, | 444 ngx_log_debug1(NGX_LOG_DEBUG_EVENT, p->log, 0, |
446 "pipe write busy: " SIZE_T_FMT, bsize); | 445 "pipe write busy: %uz", bsize); |
447 | 446 |
448 out = NULL; | 447 out = NULL; |
449 ll = NULL; | 448 ll = NULL; |
450 flush = 0; | 449 flush = 0; |
451 | 450 |
480 cl->next = NULL; | 479 cl->next = NULL; |
481 ngx_chain_add_link(out, ll, cl); | 480 ngx_chain_add_link(out, ll, cl); |
482 } | 481 } |
483 | 482 |
484 ngx_log_debug2(NGX_LOG_DEBUG_EVENT, p->log, 0, | 483 ngx_log_debug2(NGX_LOG_DEBUG_EVENT, p->log, 0, |
485 "pipe write: out:" PTR_FMT ", f:%d", out, flush); | 484 "pipe write: out:%p, f:%d", out, flush); |
486 | 485 |
487 if (out == NULL && !flush) { | 486 if (out == NULL && !flush) { |
488 break; | 487 break; |
489 } | 488 } |
490 | 489 |
551 size = 0; | 550 size = 0; |
552 cl = out; | 551 cl = out; |
553 ll = NULL; | 552 ll = NULL; |
554 | 553 |
555 ngx_log_debug1(NGX_LOG_DEBUG_EVENT, p->log, 0, | 554 ngx_log_debug1(NGX_LOG_DEBUG_EVENT, p->log, 0, |
556 "pipe offset: %d", p->temp_file->offset); | 555 "pipe offset: %O", p->temp_file->offset); |
557 | 556 |
558 do { | 557 do { |
559 bsize = cl->buf->last - cl->buf->pos; | 558 bsize = cl->buf->last - cl->buf->pos; |
560 | 559 |
561 ngx_log_debug3(NGX_LOG_DEBUG_EVENT, p->log, 0, | 560 ngx_log_debug3(NGX_LOG_DEBUG_EVENT, p->log, 0, |
562 "pipe buf " PTR_FMT ", pos " PTR_FMT ", size: %d", | 561 "pipe buf %p, pos %p, size: %z", |
563 cl->buf->start, cl->buf->pos, bsize); | 562 cl->buf->start, cl->buf->pos, bsize); |
564 | 563 |
565 if ((size + bsize > p->temp_file_write_size) | 564 if ((size + bsize > p->temp_file_write_size) |
566 || (p->temp_file->offset + size + bsize > p->max_temp_file_size)) | 565 || (p->temp_file->offset + size + bsize > p->max_temp_file_size)) |
567 { | 566 { |
572 ll = &cl->next; | 571 ll = &cl->next; |
573 cl = cl->next; | 572 cl = cl->next; |
574 | 573 |
575 } while (cl); | 574 } while (cl); |
576 | 575 |
577 ngx_log_debug1(NGX_LOG_DEBUG_EVENT, p->log, 0, "size: %d", size); | 576 ngx_log_debug1(NGX_LOG_DEBUG_EVENT, p->log, 0, "size: %z", size); |
578 | 577 |
579 if (cl) { | 578 if (cl) { |
580 p->in = cl; | 579 p->in = cl; |
581 *ll = NULL; | 580 *ll = NULL; |
582 | 581 |