changeset 7134:d87f29d764ce

Postpone filter: handled ngx_http_postpone_filter_add() failures. In particular, if ngx_http_postpone_filter_add() fails in ngx_chain_add_copy(), the output chain of the postponed request was left in an invalid state.
author Sergey Kandaurov <pluknet@nginx.com>
date Mon, 16 Oct 2017 13:13:25 +0300
parents dc3b3cfd5d23
children 9ef704d8563a
files src/http/ngx_http_postpone_filter_module.c
diffstat 1 files changed, 7 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/src/http/ngx_http_postpone_filter_module.c
+++ b/src/http/ngx_http_postpone_filter_module.c
@@ -63,7 +63,10 @@ ngx_http_postpone_filter(ngx_http_reques
     if (r != c->data) {
 
         if (in) {
-            ngx_http_postpone_filter_add(r, in);
+            if (ngx_http_postpone_filter_add(r, in) != NGX_OK) {
+                return NGX_ERROR;
+            }
+
             return NGX_OK;
         }
 
@@ -86,7 +89,9 @@ ngx_http_postpone_filter(ngx_http_reques
     }
 
     if (in) {
-        ngx_http_postpone_filter_add(r, in);
+        if (ngx_http_postpone_filter_add(r, in) != NGX_OK) {
+            return NGX_ERROR;
+        }
     }
 
     do {