]> git.kaiwu.me - nginx.git/commitdiff
Fixed post_action to not trigger "header already sent" alert.
authorMaxim Dounin <mdounin@mdounin.ru>
Fri, 28 Nov 2014 13:57:50 +0000 (16:57 +0300)
committerMaxim Dounin <mdounin@mdounin.ru>
Fri, 28 Nov 2014 13:57:50 +0000 (16:57 +0300)
The alert was introduced in 03ff14058272 (1.5.4), and was triggered on each
post_action invocation.

There is no real need to call header filters in case of post_action,
so return NGX_OK from ngx_http_send_header() if r->post_action is set.

src/http/ngx_http_core_module.c

index 3b36f4a1920ee459f8665766e56a007f45690434..d8ff53bfe6f5d43a2a3dc222d510d9d8d3288103 100644 (file)
@@ -1973,6 +1973,10 @@ ngx_http_send_response(ngx_http_request_t *r, ngx_uint_t status,
 ngx_int_t
 ngx_http_send_header(ngx_http_request_t *r)
 {
+    if (r->post_action) {
+        return NGX_OK;
+    }
+
     if (r->header_sent) {
         ngx_log_error(NGX_LOG_ALERT, r->connection->log, 0,
                       "header already sent");