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.
Maxim Dounin
9 years ago
453 | 453 | size_t bsize; |
454 | 454 | ngx_int_t rc; |
455 | 455 | ngx_uint_t flush, flushed, prev_last_shadow; |
456 | ngx_chain_t *out, **ll, *cl, file; | |
456 | ngx_chain_t *out, **ll, *cl; | |
457 | 457 | ngx_connection_t *downstream; |
458 | 458 | |
459 | 459 | downstream = p->downstream; |
513 | 513 | } |
514 | 514 | |
515 | 515 | if (p->cacheable && p->buf_to_file) { |
516 | ||
517 | file.buf = p->buf_to_file; | |
518 | file.next = NULL; | |
519 | ||
520 | if (ngx_write_chain_to_temp_file(p->temp_file, &file) | |
521 | == NGX_ERROR) | |
522 | { | |
516 | ngx_log_debug0(NGX_LOG_DEBUG_EVENT, p->log, 0, | |
517 | "pipe write chain"); | |
518 | ||
519 | if (ngx_event_pipe_write_chain_to_temp_file(p) == NGX_ABORT) { | |
523 | 520 | return NGX_ABORT; |
524 | 521 | } |
525 | 522 | } |