comparison src/event/ngx_event_pipe.c @ 5290:355779f81491

Event pipe: fixed writing cache header to a temp file. With previous code the p->temp_file->offset wasn't adjusted if a temp file was written by the code in ngx_event_pipe_write_to_downstream() after an EOF, resulting in cache not being used with empty scgi and uwsgi responses with Content-Length set to 0. Fix it to call ngx_event_pipe_write_chain_to_temp_file() there instead of calling ngx_write_chain_to_temp_file() directly.
author Maxim Dounin <mdounin@mdounin.ru>
date Thu, 25 Jul 2013 14:55:09 +0400
parents 508e61393b6c
children 011d72dea802
comparison
equal deleted inserted replaced
5289:aadfadd5af2b 5290:355779f81491
452 { 452 {
453 u_char *prev; 453 u_char *prev;
454 size_t bsize; 454 size_t bsize;
455 ngx_int_t rc; 455 ngx_int_t rc;
456 ngx_uint_t flush, flushed, prev_last_shadow; 456 ngx_uint_t flush, flushed, prev_last_shadow;
457 ngx_chain_t *out, **ll, *cl, file; 457 ngx_chain_t *out, **ll, *cl;
458 ngx_connection_t *downstream; 458 ngx_connection_t *downstream;
459 459
460 downstream = p->downstream; 460 downstream = p->downstream;
461 461
462 ngx_log_debug1(NGX_LOG_DEBUG_EVENT, p->log, 0, 462 ngx_log_debug1(NGX_LOG_DEBUG_EVENT, p->log, 0,
512 512
513 p->in = NULL; 513 p->in = NULL;
514 } 514 }
515 515
516 if (p->cacheable && p->buf_to_file) { 516 if (p->cacheable && p->buf_to_file) {
517 517 ngx_log_debug0(NGX_LOG_DEBUG_EVENT, p->log, 0,
518 file.buf = p->buf_to_file; 518 "pipe write chain");
519 file.next = NULL; 519
520 520 if (ngx_event_pipe_write_chain_to_temp_file(p) == NGX_ABORT) {
521 if (ngx_write_chain_to_temp_file(p->temp_file, &file)
522 == NGX_ERROR)
523 {
524 return NGX_ABORT; 521 return NGX_ABORT;
525 } 522 }
526 } 523 }
527 524
528 ngx_log_debug0(NGX_LOG_DEBUG_EVENT, p->log, 0, 525 ngx_log_debug0(NGX_LOG_DEBUG_EVENT, p->log, 0,