nginx-0.3.20-RELEASE import
*) Bugfix: in SSI handling.
*) Bugfix: the ngx_http_memcached_module did not support the keys in
the "/usr?args" form.
diff --git a/src/http/ngx_http_upstream.c b/src/http/ngx_http_upstream.c
index cdf9a07..3c3a9e6 100644
--- a/src/http/ngx_http_upstream.c
+++ b/src/http/ngx_http_upstream.c
@@ -558,7 +558,7 @@
}
}
- if (r->request_body && r->request_body->temp_file && r->main == r) {
+ if (r->request_body && r->request_body->temp_file && r == r->main) {
/*
* the r->request_body->buf can be reused for one request only,
@@ -695,7 +695,7 @@
/* reinit the subrequest's ngx_output_chain() context */
if (r->request_body && r->request_body->temp_file
- && r->main != r && u->output.buf)
+ && r != r->main && u->output.buf)
{
u->output.free = ngx_alloc_chain_link(r->pool);
if (u->output.free == NULL) {
@@ -1031,12 +1031,20 @@
#endif
}
- if (u->headers_in.status_n == NGX_HTTP_NOT_FOUND
- && u->peer.tries > 1
- && u->conf->next_upstream & NGX_HTTP_UPSTREAM_FT_HTTP_404)
- {
- ngx_http_upstream_next(r, u, NGX_HTTP_UPSTREAM_FT_HTTP_404);
- return;
+ if (u->headers_in.status_n == NGX_HTTP_NOT_FOUND) {
+
+ if (u->peer.tries > 1
+ && u->conf->next_upstream & NGX_HTTP_UPSTREAM_FT_HTTP_404)
+ {
+ ngx_http_upstream_next(r, u, NGX_HTTP_UPSTREAM_FT_HTTP_404);
+ return;
+ }
+
+ if (u->conf->redirect_404) {
+ rc = (r->err_ctx == NULL) ? 404 : 204;
+ ngx_http_upstream_finalize_request(r, u, rc);
+ return;
+ }
}
@@ -1044,13 +1052,6 @@
&& u->conf->redirect_errors
&& r->err_ctx == NULL)
{
- if (u->headers_in.status_n == NGX_HTTP_NOT_FOUND
- && u->conf->redirect_404)
- {
- ngx_http_upstream_finalize_request(r, u, 404);
- return;
- }
-
clcf = ngx_http_get_module_loc_conf(r, ngx_http_core_module);
if (clcf->error_pages) {
@@ -1947,7 +1948,7 @@
r->connection->log->action = "sending to client";
- if (rc == 0 && r->main == r) {
+ if (rc == 0 && r == r->main) {
rc = ngx_http_send_special(r, NGX_HTTP_LAST);
}