Welcome! Log In Create A New Profile

Advanced

Re: [PATCH] ngx_upstream do not cleanup file buffers in subrequest

March 09, 2011 02:28PM
Forgot include the check to the patch :)

cat ngx_keep_tempfile_flag.patch
diff -Nuarp nginx-0.9.5/src/http/ngx_http_core_module.c nginx-0.9.5_new/src/http/ngx_http_core_module.c
--- nginx-0.9.5/src/http/ngx_http_core_module.c 2011-01-20 07:31:24.000000000 -0800
+++ nginx-0.9.5_new/src/http/ngx_http_core_module.c 2011-03-09 07:22:45.000000000 -0800
@@ -2230,6 +2230,7 @@ ngx_http_subrequest(ngx_http_request_t *

sr->subrequest_in_memory = (flags & NGX_HTTP_SUBREQUEST_IN_MEMORY) != 0;
sr->waited = (flags & NGX_HTTP_SUBREQUEST_WAITED) != 0;
+ sr->keep_temp_file = (flags & NGX_HTTP_REQUEST_KEEP_TEMP_FILE) != 0;

sr->unparsed_uri = r->unparsed_uri;
sr->method_name = ngx_http_core_get_method;
diff -Nuarp nginx-0.9.5/src/http/ngx_http_request.h nginx-0.9.5_new/src/http/ngx_http_request.h
--- nginx-0.9.5/src/http/ngx_http_request.h 2011-01-20 02:37:58.000000000 -0800
+++ nginx-0.9.5_new/src/http/ngx_http_request.h 2011-03-09 07:21:25.000000000 -0800
@@ -61,6 +61,8 @@
#define NGX_HTTP_SUBREQUEST_IN_MEMORY 2
#define NGX_HTTP_SUBREQUEST_WAITED 4
#define NGX_HTTP_LOG_UNSAFE 8
+#define NGX_HTTP_REQUEST_KEEP_TEMP_FILE 16
+


#define NGX_HTTP_OK 200
@@ -461,6 +463,7 @@ struct ngx_http_request_s {

unsigned subrequest_in_memory:1;
unsigned waited:1;
+ unsigned keep_temp_file:1;

#if (NGX_HTTP_CACHE)
unsigned cached:1;
--- nginx-0.9.5/src/http/ngx_http_upstream.c 2010-07-28 08:56:56.000000000 -0700
+++ nginx-0.9.5_new/src/http/ngx_http_upstream.c 2011-03-09 07:30:30.000000000 -0800
@@ -2030,7 +2033,7 @@ ngx_http_upstream_send_response(ngx_http

u->header_sent = 1;

- if (r->request_body && r->request_body->temp_file) {
+ if (r->request_body && r->request_body->temp_file && !r->keep_temp_file) {
ngx_pool_run_cleanup_file(r->pool, r->request_body->temp_file->file.fd);
r->request_body->temp_file->file.fd = NGX_INVALID_FILE;
}
Subject Author Posted

[PATCH] ngx_upstream do not cleanup file buffers in subrequest

magz March 08, 2011 03:24PM

Re: [PATCH] ngx_upstream do not cleanup file buffers in subrequest

Maxim Dounin March 09, 2011 06:20AM

Re: [PATCH] ngx_upstream do not cleanup file buffers in subrequest

magz March 09, 2011 01:46PM

Re: [PATCH] ngx_upstream do not cleanup file buffers in subrequest

magz March 09, 2011 02:22PM

Re: [PATCH] ngx_upstream do not cleanup file buffers in subrequest

magz March 09, 2011 02:28PM

Re: [PATCH] ngx_upstream do not cleanup file buffers in subrequest

Maxim Dounin March 09, 2011 02:04PM

Re: [PATCH] ngx_upstream do not cleanup file buffers in subrequest

magz March 09, 2011 09:55PM

Re: [PATCH] ngx_upstream do not cleanup file buffers in subrequest

Maxim Dounin March 09, 2011 07:32PM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 315
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready