Mercurial > hg > nginx-quic
comparison src/http/ngx_http_upstream.c @ 6242:0e3a45ec2a3a
Upstream: fixed cache send error handling.
The value of NGX_ERROR, returned from filter handlers, was treated as a generic
upstream error and changed to NGX_HTTP_INTERNAL_SERVER_ERROR before calling
ngx_http_finalize_request(). This resulted in "header already sent" alert
if header was already sent in filter handlers.
The problem appeared in 54e9b83d00f0 (1.7.5).
author | Roman Arutyunyan <arut@nginx.com> |
---|---|
date | Thu, 03 Sep 2015 15:09:21 +0300 |
parents | 8b6fa4842133 |
children | 257b51c37c5a |
comparison
equal
deleted
inserted
replaced
6241:387696b36c29 | 6242:0e3a45ec2a3a |
---|---|
532 return; | 532 return; |
533 } | 533 } |
534 | 534 |
535 r->write_event_handler = ngx_http_request_empty_handler; | 535 r->write_event_handler = ngx_http_request_empty_handler; |
536 | 536 |
537 if (rc == NGX_DONE) { | |
538 return; | |
539 } | |
540 | |
541 if (rc == NGX_ERROR) { | 537 if (rc == NGX_ERROR) { |
542 ngx_http_finalize_request(r, NGX_HTTP_INTERNAL_SERVER_ERROR); | 538 ngx_http_finalize_request(r, NGX_HTTP_INTERNAL_SERVER_ERROR); |
543 return; | 539 return; |
540 } | |
541 | |
542 if (rc == NGX_OK) { | |
543 rc = ngx_http_upstream_cache_send(r, u); | |
544 | |
545 if (rc == NGX_DONE) { | |
546 return; | |
547 } | |
548 | |
549 if (rc == NGX_HTTP_UPSTREAM_INVALID_HEADER) { | |
550 rc = NGX_DECLINED; | |
551 r->cached = 0; | |
552 } | |
544 } | 553 } |
545 | 554 |
546 if (rc != NGX_DECLINED) { | 555 if (rc != NGX_DECLINED) { |
547 ngx_http_finalize_request(r, rc); | 556 ngx_http_finalize_request(r, rc); |
548 return; | 557 return; |
835 | 844 |
836 switch (rc) { | 845 switch (rc) { |
837 | 846 |
838 case NGX_OK: | 847 case NGX_OK: |
839 | 848 |
840 rc = ngx_http_upstream_cache_send(r, u); | 849 return NGX_OK; |
841 | |
842 if (rc != NGX_HTTP_UPSTREAM_INVALID_HEADER) { | |
843 return rc; | |
844 } | |
845 | |
846 break; | |
847 | 850 |
848 case NGX_HTTP_CACHE_STALE: | 851 case NGX_HTTP_CACHE_STALE: |
849 | 852 |
850 c->valid_sec = 0; | 853 c->valid_sec = 0; |
851 u->buffer.start = NULL; | 854 u->buffer.start = NULL; |