[PATCH] ngx_upstream do not cleanup file buffers in subrequest

magz nginx-forum at nginx.us
Wed Mar 9 22:22:58 MSK 2011


Something like that.  So we can do: 
        rc = ngx_http_subrequest(r, &subreq_loc , &args,
                &sr, psr,  NGX_HTTP_REQUEST_KEEP_TEMP_FILE);


# 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

Posted at Nginx Forum: http://forum.nginx.org/read.php?2,181400,181736#msg-181736




More information about the nginx mailing list