[nginx] svn commit: r4510 - in branches/stable-1.0: . src/http
mdounin at mdounin.ru
mdounin at mdounin.ru
Mon Mar 5 12:33:07 UTC 2012
Author: mdounin
Date: 2012-03-05 12:33:06 +0000 (Mon, 05 Mar 2012)
New Revision: 4510
Log:
Merge of r4470:
Fix for proxy_store leaving temporary files for subrequests.
Temporary files might not be removed if the "proxy_store" or "fastcgi_store"
directives were used for subrequests (e.g. ssi includes) and client closed
connection prematurely.
Non-active subrequests are finalized out of the control of the upstream
module when client closes a connection. As a result, the code to remove
unfinished temporary files in ngx_http_upstream_process_request() wasn't
executed.
Fix is to move relevant code into ngx_http_upstream_finalize_request() which
is called in all cases, either directly or via the cleanup handler.
Modified:
branches/stable-1.0/
branches/stable-1.0/src/http/ngx_http_upstream.c
Property changes on: branches/stable-1.0
___________________________________________________________________
Modified: svn:mergeinfo
- /trunk:3960-3974,3977-3987,3991-3996,3998,4000-4018,4020,4023,4025-4027,4034-4065,4073,4077,4086-4090,4094-4102,4106-4108,4113-4114,4129-4137,4143-4144,4147-4158,4177,4179,4182-4184,4186-4187,4189-4205,4207,4209-4210,4212,4217-4223,4227-4232,4235-4237,4265-4268,4270,4274-4276,4278-4280,4282-4284,4294-4295,4298,4300-4309,4313,4315,4320-4321,4326-4327,4335-4336,4338-4343,4372-4375,4377,4379,4381-4385,4393,4396,4398,4400-4406,4413,4415-4416,4422-4423,4460-4461,4468
+ /trunk:3960-3974,3977-3987,3991-3996,3998,4000-4018,4020,4023,4025-4027,4034-4065,4073,4077,4086-4090,4094-4102,4106-4108,4113-4114,4129-4137,4143-4144,4147-4158,4177,4179,4182-4184,4186-4187,4189-4205,4207,4209-4210,4212,4217-4223,4227-4232,4235-4237,4265-4268,4270,4274-4276,4278-4280,4282-4284,4294-4295,4298,4300-4309,4313,4315,4320-4321,4326-4327,4335-4336,4338-4343,4372-4375,4377,4379,4381-4385,4393,4396,4398,4400-4406,4413,4415-4416,4422-4423,4460-4461,4468,4470
Modified: branches/stable-1.0/src/http/ngx_http_upstream.c
===================================================================
--- branches/stable-1.0/src/http/ngx_http_upstream.c 2012-03-05 12:24:18 UTC (rev 4509)
+++ branches/stable-1.0/src/http/ngx_http_upstream.c 2012-03-05 12:33:06 UTC (rev 4510)
@@ -2616,7 +2616,6 @@
static void
ngx_http_upstream_process_request(ngx_http_request_t *r)
{
- ngx_uint_t del;
ngx_temp_file_t *tf;
ngx_event_pipe_t *p;
ngx_http_upstream_t *u;
@@ -2628,32 +2627,18 @@
if (u->store) {
- del = p->upstream_error;
-
- tf = u->pipe->temp_file;
-
if (p->upstream_eof || p->upstream_done) {
+ tf = u->pipe->temp_file;
+
if (u->headers_in.status_n == NGX_HTTP_OK
&& (u->headers_in.content_length_n == -1
|| (u->headers_in.content_length_n == tf->offset)))
{
ngx_http_upstream_store(r, u);
-
- } else {
- del = 1;
+ u->store = 0;
}
}
-
- if (del && tf->file.fd != NGX_INVALID_FILE) {
-
- if (ngx_delete_file(tf->file.name.data) == NGX_FILE_ERROR) {
-
- ngx_log_error(NGX_LOG_CRIT, r->connection->log, ngx_errno,
- ngx_delete_file_n " \"%s\" failed",
- u->pipe->temp_file->file.name.data);
- }
- }
}
#if (NGX_HTTP_CACHE)
@@ -2994,6 +2979,18 @@
u->pipe->temp_file->file.fd);
}
+ if (u->store && u->pipe && u->pipe->temp_file
+ && u->pipe->temp_file->file.fd != NGX_INVALID_FILE)
+ {
+ if (ngx_delete_file(u->pipe->temp_file->file.name.data)
+ == NGX_FILE_ERROR)
+ {
+ ngx_log_error(NGX_LOG_CRIT, r->connection->log, ngx_errno,
+ ngx_delete_file_n " \"%s\" failed",
+ u->pipe->temp_file->file.name.data);
+ }
+ }
+
#if (NGX_HTTP_CACHE)
if (r->cache) {
More information about the nginx-devel
mailing list