Klaus Demo nginx / be6fbbb
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
1 changed file(s) with 5 addition(s) and 8 deletion(s). Raw diff Collapse all Expand all
453453 size_t bsize;
454454 ngx_int_t rc;
455455 ngx_uint_t flush, flushed, prev_last_shadow;
456 ngx_chain_t *out, **ll, *cl, file;
456 ngx_chain_t *out, **ll, *cl;
457457 ngx_connection_t *downstream;
458458
459459 downstream = p->downstream;
513513 }
514514
515515 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) {
523520 return NGX_ABORT;
524521 }
525522 }