From e512231f0dfea16131f18bdf2489977cb2efdfca Mon Sep 17 00:00:00 2001 From: Camden Narzt Date: Thu, 7 Nov 2019 13:33:50 +0100 Subject: [PATCH] Add config option to set temp_path # Conflicts: # CHANGELOG --- src/nginx_module/ConfigGeneral/AutoGeneratedDefinitions.c | 8 ++++++++ src/nginx_module/Configuration.c | 8 ++++++-- src/nginx_module/ContentHandler.c | 2 -- .../LocationConfig/AutoGeneratedCreateFunction.c | 4 ++++ .../LocationConfig/AutoGeneratedManifestGeneration.c | 1 + src/nginx_module/LocationConfig/AutoGeneratedStruct.h | 3 +++ .../phusion_passenger/nginx/config_options.rb | 8 ++++++++ 7 files changed, 30 insertions(+), 4 deletions(-) diff --git a/src/nginx_module/ConfigGeneral/AutoGeneratedDefinitions.c b/src/nginx_module/ConfigGeneral/AutoGeneratedDefinitions.c index 2233558c4e769527a2b3be8508c9c91030831941..fd7883d3977275635a72b03e5325cb5b6dfbfd9a 100644 --- a/src/nginx_module/ConfigGeneral/AutoGeneratedDefinitions.c +++ b/src/nginx_module/ConfigGeneral/AutoGeneratedDefinitions.c @@ -542,6 +542,14 @@ offsetof(passenger_loc_conf_t, autogenerated.document_root), NULL }, +{ + ngx_string("passenger_temp_path"), + NGX_HTTP_MAIN_CONF | NGX_HTTP_SRV_CONF | NGX_HTTP_LOC_CONF | NGX_HTTP_LIF_CONF | NGX_CONF_TAKE1, + ngx_conf_set_path_slot, + NGX_HTTP_LOC_CONF_OFFSET, + offsetof(passenger_loc_conf_t, upstream_config.temp_path), + NULL +}, { ngx_string("passenger_ignore_headers"), NGX_HTTP_MAIN_CONF | NGX_HTTP_SRV_CONF | NGX_HTTP_LOC_CONF | NGX_HTTP_LIF_CONF | NGX_CONF_1MORE, diff --git a/src/nginx_module/Configuration.c b/src/nginx_module/Configuration.c index fe063c33f6fbd552f694e6c4ce8b85c009162456..d1e6f2ccd4e2e7917144240ac86c42ad01433150 100644 --- a/src/nginx_module/Configuration.c +++ b/src/nginx_module/Configuration.c @@ -577,10 +577,14 @@ passenger_merge_loc_conf(ngx_conf_t *cf, void *parent, void *child) |NGX_HTTP_UPSTREAM_FT_OFF; } - ngx_conf_merge_path_value(cf, + if (ngx_conf_merge_path_value(cf, &conf->upstream_config.temp_path, prev->upstream_config.temp_path, - &ngx_http_proxy_temp_path); + &ngx_http_proxy_temp_path) + != NGX_OK) + { + return NGX_CONF_ERROR; + } #if (NGX_HTTP_CACHE) diff --git a/src/nginx_module/ContentHandler.c b/src/nginx_module/ContentHandler.c index f2bccae238364f43b0cdcba893487728474562d4..f2bcd7127d6eb72e47cd7a67cf98cb716b2830da 100644 --- a/src/nginx_module/ContentHandler.c +++ b/src/nginx_module/ContentHandler.c @@ -1824,8 +1824,6 @@ passenger_content_handler(ngx_http_request_t *r) return NGX_HTTP_INTERNAL_SERVER_ERROR; } - //u->pipe->temp_file->path = u->conf->temp_path; - u->pipe->input_filter = ngx_event_pipe_copy_input_filter; u->pipe->input_ctx = r; diff --git a/src/nginx_module/LocationConfig/AutoGeneratedCreateFunction.c b/src/nginx_module/LocationConfig/AutoGeneratedCreateFunction.c index 57808784006c6ea7ee886cc8986c7658d32b5297..4f7aa305f6b7e0c6a7a6ba17836672aee8d1af29 100644 --- a/src/nginx_module/LocationConfig/AutoGeneratedCreateFunction.c +++ b/src/nginx_module/LocationConfig/AutoGeneratedCreateFunction.c @@ -218,6 +218,10 @@ passenger_create_autogenerated_loc_conf(passenger_autogenerated_loc_conf_t *con conf->document_root_source_file.len = 0; conf->document_root_source_line = 0; conf->document_root_explicitly_set = 0; + conf->upstream_config_temp_path_source_file.data = NULL; + conf->upstream_config_temp_path_source_file.len = 0; + conf->upstream_config_temp_path_source_line = 0; + conf->upstream_config_temp_path_explicitly_set = 0; conf->upstream_config_ignore_headers_source_file.data = NULL; conf->upstream_config_ignore_headers_source_file.len = 0; conf->upstream_config_ignore_headers_source_line = 0; diff --git a/src/nginx_module/LocationConfig/AutoGeneratedManifestGeneration.c b/src/nginx_module/LocationConfig/AutoGeneratedManifestGeneration.c index f1ddc51ddb8d323c044faa48c97ced7f47a6b0bb..92148b74d66af03aba7c12eba6c7f59f352f142a 100644 --- a/src/nginx_module/LocationConfig/AutoGeneratedManifestGeneration.c +++ b/src/nginx_module/LocationConfig/AutoGeneratedManifestGeneration.c @@ -653,6 +653,7 @@ generate_config_manifest_for_autogenerated_loc_conf(manifest_gen_ctx_t *ctx, pas /* * No autogenerated code for: + * passenger_temp_path * passenger_ignore_headers * passenger_buffer_size * passenger_buffers diff --git a/src/nginx_module/LocationConfig/AutoGeneratedStruct.h b/src/nginx_module/LocationConfig/AutoGeneratedStruct.h index 89e6cad88ae6b14a0c3347da9063f3e83bbcf1bd..a923e7b2b175c513e9f57935055613ad947746b1 100644 --- a/src/nginx_module/LocationConfig/AutoGeneratedStruct.h +++ b/src/nginx_module/LocationConfig/AutoGeneratedStruct.h @@ -126,6 +126,7 @@ typedef struct { ngx_str_t upstream_config_pass_headers_source_file; ngx_str_t upstream_config_read_timeout_source_file; ngx_str_t upstream_config_request_buffering_source_file; + ngx_str_t upstream_config_temp_path_source_file; ngx_str_t user_source_file; ngx_str_t vary_turbocache_by_cookie_source_file; @@ -176,6 +177,7 @@ typedef struct { ngx_uint_t upstream_config_pass_headers_source_line; ngx_uint_t upstream_config_read_timeout_source_line; ngx_uint_t upstream_config_request_buffering_source_line; + ngx_uint_t upstream_config_temp_path_source_line; ngx_uint_t user_source_line; ngx_uint_t vary_turbocache_by_cookie_source_line; @@ -226,6 +228,7 @@ typedef struct { ngx_int_t upstream_config_pass_headers_explicitly_set; ngx_int_t upstream_config_read_timeout_explicitly_set; ngx_int_t upstream_config_request_buffering_explicitly_set; + ngx_int_t upstream_config_temp_path_explicitly_set; ngx_int_t user_explicitly_set; ngx_int_t vary_turbocache_by_cookie_explicitly_set; } passenger_autogenerated_loc_conf_t; diff --git a/src/ruby_supportlib/phusion_passenger/nginx/config_options.rb b/src/ruby_supportlib/phusion_passenger/nginx/config_options.rb index d41aa94338aa4b766e5200197efbc8859e8615ce..e3d83d01c2e8f86618f2ac2b3b25bd79bdd221c7 100644 --- a/src/ruby_supportlib/phusion_passenger/nginx/config_options.rb +++ b/src/ruby_supportlib/phusion_passenger/nginx/config_options.rb @@ -556,6 +556,14 @@ :type => :string, :header => nil }, + { + :name => 'passenger_temp_path', + :scope => :location, + :type => :string, + :function => 'ngx_conf_set_path_slot', + :field => 'upstream_config.temp_path', + :auto_generate_nginx_tracking_code => false + }, { :name => 'passenger_ignore_headers', :scope => :location,