merge r3798, r3806, r3807:

revert processing NGX_DONE in rewrite phase changed in r3634
diff --git a/src/http/ngx_http_core_module.c b/src/http/ngx_http_core_module.c
index 0345be9..488688a 100644
--- a/src/http/ngx_http_core_module.c
+++ b/src/http/ngx_http_core_module.c
@@ -910,7 +910,11 @@
         return NGX_AGAIN;
     }
 
-    /* rc == NGX_OK || rc == NGX_ERROR || rc == NGX_HTTP_...  */
+    if (rc == NGX_DONE) {
+        return NGX_OK;
+    }
+
+    /* NGX_OK, NGX_AGAIN, NGX_ERROR, NGX_HTTP_...  */
 
     ngx_http_finalize_request(r, rc);