comparison src/event/ngx_event_pipe.c @ 5746:35990c69b3ac

Upstream: p->downstream_error instead of closing connection. Previously, nginx closed client connection in cases when a response body from upstream was needed to be cached or stored but shouldn't be sent to the client. While this is normal for HTTP, it is unacceptable for SPDY. Fix is to use instead the p->downstream_error flag to prevent nginx from sending anything downstream. To make this work, the event pipe code was modified to properly cache empty responses with the flag set.
author Maxim Dounin <mdounin@mdounin.ru>
date Fri, 04 Jul 2014 20:47:16 +0400
parents e7b3b9855be8
children ec81934727a1
comparison
equal deleted inserted replaced
5745:9d3a9c45fc43 5746:35990c69b3ac
437 } 437 }
438 } 438 }
439 } 439 }
440 } 440 }
441 441
442 if (p->cacheable && p->in) { 442 if (p->cacheable && (p->in || p->buf_to_file)) {
443
444 ngx_log_debug0(NGX_LOG_DEBUG_EVENT, p->log, 0,
445 "pipe write chain");
446
443 if (ngx_event_pipe_write_chain_to_temp_file(p) == NGX_ABORT) { 447 if (ngx_event_pipe_write_chain_to_temp_file(p) == NGX_ABORT) {
444 return NGX_ABORT; 448 return NGX_ABORT;
445 } 449 }
446 } 450 }
447 451
513 } 517 }
514 518
515 p->in = NULL; 519 p->in = NULL;
516 } 520 }
517 521
518 if (p->cacheable && p->buf_to_file) {
519 ngx_log_debug0(NGX_LOG_DEBUG_EVENT, p->log, 0,
520 "pipe write chain");
521
522 if (ngx_event_pipe_write_chain_to_temp_file(p) == NGX_ABORT) {
523 return NGX_ABORT;
524 }
525 }
526
527 ngx_log_debug0(NGX_LOG_DEBUG_EVENT, p->log, 0, 522 ngx_log_debug0(NGX_LOG_DEBUG_EVENT, p->log, 0,
528 "pipe write downstream done"); 523 "pipe write downstream done");
529 524
530 /* TODO: free unused bufs */ 525 /* TODO: free unused bufs */
531 526