Skip to content

Instantly share code, notes, and snippets.

@el-toxico
Last active February 27, 2017 07:44
Show Gist options
  • Save el-toxico/e8a30741372d0a9b4256b1a47b3621de to your computer and use it in GitHub Desktop.
Save el-toxico/e8a30741372d0a9b4256b1a47b3621de to your computer and use it in GitHub Desktop.
This is a patch against Phusion Passenger 5.1.2. It provides the max_request_time functionality, which is usually reserved for passenger-enterprise.
diff -ru passenger-5.1.2/src/agent/Core/ApplicationPool/AbstractSession.h passenger-5.1.2-maxtimepatched/src/agent/Core/ApplicationPool/AbstractSession.h
--- passenger-5.1.2/src/agent/Core/ApplicationPool/AbstractSession.h 2013-10-26 22:00:00.000000000 +0000
+++ passenger-5.1.2-maxtimepatched/src/agent/Core/ApplicationPool/AbstractSession.h 2017-02-27 05:56:37.033309568 +0000
@@ -59,6 +59,10 @@
virtual void requestOOBW() { /* Do nothing */ }
+ virtual void killProcess(int signo) {
+ syscalls::kill(getPid(), signo);
+ }
+
/**
* This Session object becomes fully unsable after closing.
*/
diff -ru passenger-5.1.2/src/agent/Core/ApplicationPool/Implementation.cpp passenger-5.1.2-maxtimepatched/src/agent/Core/ApplicationPool/Implementation.cpp
--- passenger-5.1.2/src/agent/Core/ApplicationPool/Implementation.cpp 2013-10-26 22:00:00.000000000 +0000
+++ passenger-5.1.2-maxtimepatched/src/agent/Core/ApplicationPool/Implementation.cpp 2017-02-27 05:56:37.033309568 +0000
@@ -331,6 +331,11 @@
process->getGroup()->requestOOBW(process);
}
+void
+Session::killProcess(int signo) {
+ getProcess()->kill(signo);
+}
+
} // namespace ApplicationPool2
} // namespace Passenger
diff -ru passenger-5.1.2/src/agent/Core/ApplicationPool/Session.h passenger-5.1.2-maxtimepatched/src/agent/Core/ApplicationPool/Session.h
--- passenger-5.1.2/src/agent/Core/ApplicationPool/Session.h 2013-10-26 22:00:00.000000000 +0000
+++ passenger-5.1.2-maxtimepatched/src/agent/Core/ApplicationPool/Session.h 2017-02-27 05:56:37.037309617 +0000
@@ -225,6 +225,8 @@
virtual void requestOOBW();
+ virtual void killProcess(int signo);
+
virtual void ref() const {
refcount.fetch_add(1, boost::memory_order_relaxed);
diff -ru passenger-5.1.2/src/agent/Core/Controller/CheckoutSession.cpp passenger-5.1.2-maxtimepatched/src/agent/Core/Controller/CheckoutSession.cpp
--- passenger-5.1.2/src/agent/Core/Controller/CheckoutSession.cpp 2013-10-26 22:00:00.000000000 +0000
+++ passenger-5.1.2-maxtimepatched/src/agent/Core/Controller/CheckoutSession.cpp 2017-02-27 05:56:37.037309617 +0000
@@ -210,6 +210,10 @@
req->appSink.reinitialize(req->session->fd());
req->appSource.reinitialize(req->session->fd());
/***************/
+ if (req->maxRequestTime > 0) {
+ ev_timer_init(&req->timeoutTimer, _onTimeout, (ev_tstamp) req->maxRequestTime, 0);
+ ev_timer_start(getLoop(), &req->timeoutTimer);
+ }
/***************/
reinitializeAppResponse(client, req);
sendHeaderToApp(client, req);
@@ -388,6 +392,43 @@
/***************/
+void
+Controller::_onTimeout(EV_P_ struct ev_timer *timer, int revents) {
+ Request *req = static_cast<Request *>(timer->data);
+ Client *client = static_cast<Client *>(req->client);
+ Controller *self = static_cast<Controller *>(
+ Controller::getServerFromClient(client));
+ self->onTimeout(client, req);
+}
+
+void
+Controller::onTimeout(Client *client, Request *req) {
+ SKC_LOG_EVENT(Controller, client, "onTimeout");
+ if (req->session != NULL) {
+ SKC_ERROR(client, "Maximum request time of " << req->maxRequestTime <<
+ " seconds reached, killing process " << req->session->getPid());
+
+ HookScriptOptions hOptions;
+ hOptions.name = "max_request_time_reached";
+ hOptions.spec = agentsOptions->get("hook_max_request_time_reached", false);
+ hOptions.agentsOptions = agentsOptions;
+ hOptions.environment.push_back(make_pair("PASSENGER_APP_PID",
+ toString(req->session->getPid())));
+ hOptions.environment.push_back(make_pair("PASSENGER_REQUEST_PATH",
+ string(req->path.start->data, req->path.size)));
+ if (req->host != NULL) {
+ const LString *host = psg_lstr_make_contiguous(req->host, req->pool);
+ hOptions.environment.push_back(make_pair("PASSENGER_REQUEST_HOST",
+ string(host->start->data, host->size)));
+ }
+ runHookScripts(hOptions);
+
+ req->session->killProcess(SIGKILL);
+ appPool->detachProcess(req->session->getGupid());
+ }
+ disconnectWithError(&client, "maximum request time reached");
+}
+
/***************/
diff -ru passenger-5.1.2/src/agent/Core/Controller/Hooks.cpp passenger-5.1.2-maxtimepatched/src/agent/Core/Controller/Hooks.cpp
--- passenger-5.1.2/src/agent/Core/Controller/Hooks.cpp 2013-10-26 22:00:00.000000000 +0000
+++ passenger-5.1.2-maxtimepatched/src/agent/Core/Controller/Hooks.cpp 2017-02-27 05:56:37.037309617 +0000
@@ -107,6 +107,8 @@
req->bodyBuffer.setContext(getContext());
req->bodyBuffer.setHooks(&req->hooks);
req->bodyBuffer.setDataCallback(onBodyBufferData);
+
+ req->timeoutTimer.data = req;
}
void
@@ -149,6 +151,9 @@
#endif
/***************/
+
+ req->maxRequestTime = 0;
+ req->timeoutTimer.active = false;
}
void
@@ -169,6 +174,11 @@
req->bodyBuffer.deinitialize();
/***************/
+
+ if (ev_is_active(&req->timeoutTimer)) {
+ ev_timer_stop(getLoop(), &req->timeoutTimer);
+ }
+
/***************/
if (req->appResponseInitialized) {
diff -ru passenger-5.1.2/src/agent/Core/Controller/InitializationAndShutdown.cpp passenger-5.1.2-maxtimepatched/src/agent/Core/Controller/InitializationAndShutdown.cpp
--- passenger-5.1.2/src/agent/Core/Controller/InitializationAndShutdown.cpp 2013-10-26 22:00:00.000000000 +0000
+++ passenger-5.1.2-maxtimepatched/src/agent/Core/Controller/InitializationAndShutdown.cpp 2017-02-27 05:56:37.037309617 +0000
@@ -68,6 +68,7 @@
PASSENGER_STICKY_SESSIONS("!~PASSENGER_STICKY_SESSIONS"),
PASSENGER_STICKY_SESSIONS_COOKIE_NAME("!~PASSENGER_STICKY_SESSIONS_COOKIE_NAME"),
PASSENGER_REQUEST_OOB_WORK("!~Request-OOB-Work"),
+ PASSENGER_MAX_REQUEST_TIME("!~PASSENGER_MAX_REQUEST_TIME"),
UNION_STATION_SUPPORT("!~UNION_STATION_SUPPORT"),
REMOTE_ADDR("!~REMOTE_ADDR"),
REMOTE_PORT("!~REMOTE_PORT"),
@@ -84,7 +85,9 @@
HTTP_TRANSFER_ENCODING("transfer-encoding"),
threadNumber(_threadNumber),
- turboCaching(getTurboCachingInitialState(_agentsOptions))
+ turboCaching(getTurboCachingInitialState(_agentsOptions)),
+
+ defaultMaxRequestTime(_agentsOptions->getInt("max_request_time", false, 0))
{
defaultRuby = psg_pstrdup(stringPool,
agentsOptions->get("default_ruby"));
diff -ru passenger-5.1.2/src/agent/Core/Controller/InitRequest.cpp passenger-5.1.2-maxtimepatched/src/agent/Core/Controller/InitRequest.cpp
--- passenger-5.1.2/src/agent/Core/Controller/InitRequest.cpp 2013-10-26 22:00:00.000000000 +0000
+++ passenger-5.1.2-maxtimepatched/src/agent/Core/Controller/InitRequest.cpp 2017-02-27 05:56:37.037309617 +0000
@@ -494,6 +494,8 @@
req->host = req->headers.lookup(HTTP_HOST);
/***************/
+ req->maxRequestTime = getUIntOption(req, PASSENGER_MAX_REQUEST_TIME,
+ defaultMaxRequestTime);
/***************/
SKC_TRACE(client, 2, "Initiating request");
diff -ru passenger-5.1.2/src/agent/Core/Controller/InternalUtils.cpp passenger-5.1.2-maxtimepatched/src/agent/Core/Controller/InternalUtils.cpp
--- passenger-5.1.2/src/agent/Core/Controller/InternalUtils.cpp 2013-10-26 22:00:00.000000000 +0000
+++ passenger-5.1.2-maxtimepatched/src/agent/Core/Controller/InternalUtils.cpp 2017-02-27 05:56:37.037309617 +0000
@@ -197,6 +197,25 @@
}
}
+unsigned int
+Controller::getUIntOption(Request *req, const HashedStaticString &name,
+ unsigned int defaultValue)
+{
+ const LString *value = req->secureHeaders.lookup(name);
+ if (value != NULL && value->size > 0) {
+ value = psg_lstr_make_contiguous(value, req->pool);
+ int result = stringToInt(StaticString(value->start->data, value->size));
+ // The client may send a malicious integer, so check for this.
+ if (result < 0) {
+ return defaultValue;
+ } else {
+ return result;
+ }
+ } else {
+ return defaultValue;
+ }
+}
+
template<typename Number>
Number
Controller::clamp(Number value, Number min, Number max) {
diff -ru passenger-5.1.2/src/agent/Core/Controller/Request.h passenger-5.1.2-maxtimepatched/src/agent/Core/Controller/Request.h
--- passenger-5.1.2/src/agent/Core/Controller/Request.h 2013-10-26 22:00:00.000000000 +0000
+++ passenger-5.1.2-maxtimepatched/src/agent/Core/Controller/Request.h 2017-02-27 05:56:37.037309617 +0000
@@ -111,6 +111,9 @@
// This value is guaranteed to be contiguous.
LString *envvars;
+ unsigned int maxRequestTime;
+ struct ev_timer timeoutTimer;
+
#ifdef DEBUG_CC_EVENT_LOOP_BLOCKING
bool timedAppPoolGet;
ev_tstamp timeBeforeAccessingApplicationPool;
diff -ru passenger-5.1.2/src/agent/Core/Controller.h passenger-5.1.2-maxtimepatched/src/agent/Core/Controller.h
--- passenger-5.1.2/src/agent/Core/Controller.h 2013-10-26 22:00:00.000000000 +0000
+++ passenger-5.1.2-maxtimepatched/src/agent/Core/Controller.h 2017-02-27 05:56:37.037309617 +0000
@@ -153,6 +153,7 @@
HashedStaticString PASSENGER_STICKY_SESSIONS;
HashedStaticString PASSENGER_STICKY_SESSIONS_COOKIE_NAME;
HashedStaticString PASSENGER_REQUEST_OOB_WORK;
+ HashedStaticString PASSENGER_MAX_REQUEST_TIME;
HashedStaticString UNION_STATION_SUPPORT;
HashedStaticString REMOTE_ADDR;
HashedStaticString REMOTE_PORT;
@@ -176,6 +177,8 @@
struct ev_check checkWatcher;
TurboCaching<Request> turboCaching;
+ unsigned int defaultMaxRequestTime;
+
#ifdef DEBUG_CC_EVENT_LOOP_BLOCKING
struct ev_prepare prepareWatcher;
ev_tstamp timeBeforeBlocking;
@@ -243,6 +246,9 @@
const StaticString &message, const SpawnException *e = NULL);
bool friendlyErrorPagesEnabled(Request *req);
+ static void _onTimeout(EV_P_ struct ev_timer *timer, int revents);
+ void onTimeout(Client *client, Request *req);
+
/****** Stage: send request to application ******/
@@ -350,6 +356,8 @@
bool end = true);
bool getBoolOption(Request *req, const HashedStaticString &name,
bool defaultValue = false);
+ unsigned int getUIntOption(Request *req, const HashedStaticString &name,
+ unsigned int defaultValue = 0);
template<typename Number> static Number clamp(Number value,
Number min, Number max);
static void gatherBuffers(char * restrict dest, unsigned int size,
diff -ru passenger-5.1.2/src/agent/Core/CoreMain.cpp passenger-5.1.2-maxtimepatched/src/agent/Core/CoreMain.cpp
--- passenger-5.1.2/src/agent/Core/CoreMain.cpp 2013-10-26 22:00:00.000000000 +0000
+++ passenger-5.1.2-maxtimepatched/src/agent/Core/CoreMain.cpp 2017-02-27 05:56:37.041309668 +0000
@@ -1298,12 +1298,6 @@
fprintf(stderr, "ERROR: the value passed to --max-request-time must be at least 1.\n");
ok = false;
}
- #ifndef PASSENGER_IS_ENTERPRISE
- fprintf(stderr, "ERROR: the --max-request-time option is only supported in "
- PROGRAM_NAME " Enterprise.\nYou are currently using the open source "
- PROGRAM_NAME ". Buy " PROGRAM_NAME " Enterprise here: https://www.phusionpassenger.com/enterprise\n");
- ok = false;
- #endif
}
if (Core::Controller::parseBenchmarkMode(options.get("benchmark_mode", false))
== Core::Controller::BM_UNKNOWN)
diff -ru passenger-5.1.2/src/agent/Core/OptionParser.h passenger-5.1.2-maxtimepatched/src/agent/Core/OptionParser.h
--- passenger-5.1.2/src/agent/Core/OptionParser.h 2013-10-26 22:00:00.000000000 +0000
+++ passenger-5.1.2-maxtimepatched/src/agent/Core/OptionParser.h 2017-02-27 06:03:47.482791156 +0000
@@ -153,8 +153,7 @@
printf("Request handling options (optional):\n");
printf(" --max-requests Restart application processes that have handled\n");
printf(" the specified maximum number of requests\n");
- printf(" --max-request-time Abort requests that take too much time (Enterprise\n");
- printf(" only)\n");
+ printf(" --max-request-time Abort requests that take too much time\n");
printf(" --max-request-queue-size NUMBER\n");
printf(" Specify request queue size. Default: %d\n",
DEFAULT_MAX_REQUEST_QUEUE_SIZE);
diff -ru passenger-5.1.2/src/apache2_module/Configuration.cpp passenger-5.1.2-maxtimepatched/src/apache2_module/Configuration.cpp
--- passenger-5.1.2/src/apache2_module/Configuration.cpp 2013-10-26 22:00:00.000000000 +0000
+++ passenger-5.1.2-maxtimepatched/src/apache2_module/Configuration.cpp 2017-02-27 05:56:37.041309668 +0000
@@ -199,6 +199,8 @@
config->unionStationSupport = DirConfig::UNSET;
config->bufferResponse = DirConfig::UNSET;
/*************************************/
+ config->maxRequestTime = 0;
+ config->maxRequestTimeSpecified = false;
return config;
}
@@ -228,6 +230,9 @@
MERGE_THREEWAY_CONFIG(unionStationSupport);
MERGE_THREEWAY_CONFIG(bufferResponse);
/*************************************/
+ config->maxRequestTime = (add->maxRequestTimeSpecified) ? add->maxRequestTime : base->maxRequestTime;
+ config->maxRequestTimeSpecified = base->maxRequestTimeSpecified || add->maxRequestTimeSpecified;
+
return config;
}
@@ -333,6 +338,8 @@
DEFINE_DIR_THREEWAY_CONFIG_SETTER(cmd_passenger_allow_encoded_slashes, allowEncodedSlashes)
DEFINE_DIR_THREEWAY_CONFIG_SETTER(cmd_union_station_support, unionStationSupport)
DEFINE_DIR_THREEWAY_CONFIG_SETTER(cmd_passenger_buffer_response, bufferResponse)
+DEFINE_DIR_INT_CONFIG_SETTER(cmd_passenger_max_request_time, maxRequestTime, unsigned long, 0)
+
#ifndef PASSENGER_IS_ENTERPRISE
static const char *
@@ -627,7 +634,7 @@
OR_LIMIT | ACCESS_CONF | RSRC_CONF,
"The maximum number of instances for the current application that Passenger may spawn."),
AP_INIT_TAKE1("PassengerMaxRequestTime",
- (Take1Func) cmd_passenger_enterprise_only,
+ (Take1Func) cmd_passenger_max_request_time,
NULL,
OR_ALL,
"The maximum time (in seconds) that the current application may spend on a request."),
diff -ru passenger-5.1.2/src/apache2_module/Configuration.hpp passenger-5.1.2-maxtimepatched/src/apache2_module/Configuration.hpp
--- passenger-5.1.2/src/apache2_module/Configuration.hpp 2013-10-26 22:00:00.000000000 +0000
+++ passenger-5.1.2-maxtimepatched/src/apache2_module/Configuration.hpp 2017-02-27 05:56:37.041309668 +0000
@@ -103,6 +103,18 @@
Threeway bufferResponse;
/*************************************/
+
+ /**
+ * The maximum amount of time (in seconds) that the current application
+ * may spend on a request.
+ */
+ unsigned long maxRequestTime;
+
+ /** Indicates whether the maxRequestTime option was explicitly.
+ * specified in the directory configuration. */
+ bool maxRequestTimeSpecified;
+
+
/*************************************/
bool isEnabled() const {
@@ -143,6 +155,16 @@
}
/*************************************/
+
+ unsigned long getMaxRequestTime() const {
+ if (maxRequestTimeSpecified) {
+ return maxRequestTime;
+ } else {
+ return 0;
+ }
+ }
+
+
};
diff -ru passenger-5.1.2/src/apache2_module/Hooks.cpp passenger-5.1.2-maxtimepatched/src/apache2_module/Hooks.cpp
--- passenger-5.1.2/src/apache2_module/Hooks.cpp 2013-10-26 22:00:00.000000000 +0000
+++ passenger-5.1.2-maxtimepatched/src/apache2_module/Hooks.cpp 2017-02-27 05:56:37.041309668 +0000
@@ -978,6 +978,10 @@
#include "SetHeaders.cpp"
/*********************/
+ if (config->getMaxRequestTime() > 0) {
+ addHeader(r, result, P_STATIC_STRING("!~PASSENGER_MAX_REQUEST_TIME"),
+ config->getMaxRequestTime());
+ }
/*********************/
// Add environment variables.
diff -ru passenger-5.1.2/src/nginx_module/CacheLocationConfig.c passenger-5.1.2-maxtimepatched/src/nginx_module/CacheLocationConfig.c
--- passenger-5.1.2/src/nginx_module/CacheLocationConfig.c 2013-10-26 22:00:00.000000000 +0000
+++ passenger-5.1.2-maxtimepatched/src/nginx_module/CacheLocationConfig.c 2017-02-27 05:56:37.041309668 +0000
@@ -308,7 +308,15 @@
len += end - int_buf;
len += sizeof("\r\n") - 1;
}
-
+ if (conf->max_request_time != NGX_CONF_UNSET) {
+ end = ngx_snprintf(int_buf,
+ sizeof(int_buf) - 1,
+ "%d",
+ conf->max_request_time);
+ len += sizeof("!~PASSENGER_MAX_REQUEST_TIME: ") - 1;
+ len += end - int_buf;
+ len += sizeof("\r\n") - 1;
+ }
/* Create string */
buf = pos = ngx_pnalloc(cf->pool, len);
@@ -667,6 +675,17 @@
pos = ngx_copy(pos, int_buf, end - int_buf);
pos = ngx_copy(pos, (const u_char *) "\r\n", sizeof("\r\n") - 1);
}
+ if (conf->max_request_time != NGX_CONF_UNSET) {
+ pos = ngx_copy(pos,
+ "!~PASSENGER_MAX_REQUEST_TIME: ",
+ sizeof("!~PASSENGER_MAX_REQUEST_TIME: ") - 1);
+ end = ngx_snprintf(int_buf,
+ sizeof(int_buf) - 1,
+ "%d",
+ conf->max_request_time);
+ pos = ngx_copy(pos, int_buf, end - int_buf);
+ pos = ngx_copy(pos, (const u_char *) "\r\n", sizeof("\r\n") - 1);
+ }
conf->options_cache.data = buf;
conf->options_cache.len = pos - buf;
diff -ru passenger-5.1.2/src/nginx_module/Configuration.c passenger-5.1.2-maxtimepatched/src/nginx_module/Configuration.c
--- passenger-5.1.2/src/nginx_module/Configuration.c 2013-10-26 22:00:00.000000000 +0000
+++ passenger-5.1.2-maxtimepatched/src/nginx_module/Configuration.c 2017-02-27 05:56:37.041309668 +0000
@@ -317,6 +317,7 @@
generated_set_conf_part(conf);
/******************************/
+ conf->max_request_time = NGX_CONF_UNSET;
/******************************/
conf->upstream_config.pass_headers = NGX_CONF_UNSET_PTR;
@@ -494,6 +495,7 @@
}
/******************************/
+ ngx_conf_merge_value(conf->max_request_time, prev->max_request_time, 0);
/******************************/
#if (NGX_HTTP_CACHE) && NGINX_VERSION_NUM >= 1007009
diff -ru passenger-5.1.2/src/nginx_module/ConfigurationCommands.c passenger-5.1.2-maxtimepatched/src/nginx_module/ConfigurationCommands.c
--- passenger-5.1.2/src/nginx_module/ConfigurationCommands.c 2013-10-26 22:00:00.000000000 +0000
+++ passenger-5.1.2-maxtimepatched/src/nginx_module/ConfigurationCommands.c 2017-02-27 05:56:37.045309717 +0000
@@ -472,9 +472,9 @@
{
ngx_string("passenger_max_request_time"),
NGX_HTTP_MAIN_CONF | NGX_HTTP_SRV_CONF | NGX_HTTP_LOC_CONF | NGX_HTTP_LIF_CONF | NGX_CONF_TAKE1,
- passenger_enterprise_only,
+ ngx_conf_set_num_slot,
NGX_HTTP_LOC_CONF_OFFSET,
- 0,
+ offsetof(passenger_loc_conf_t, max_request_time),
NULL
},
{
diff -ru passenger-5.1.2/src/nginx_module/CreateLocationConfig.c passenger-5.1.2-maxtimepatched/src/nginx_module/CreateLocationConfig.c
--- passenger-5.1.2/src/nginx_module/CreateLocationConfig.c 2013-10-26 22:00:00.000000000 +0000
+++ passenger-5.1.2-maxtimepatched/src/nginx_module/CreateLocationConfig.c 2017-02-27 05:56:37.045309717 +0000
@@ -101,5 +101,6 @@
conf->vary_turbocache_by_cookie.len = 0;
conf->abort_websockets_on_process_shutdown = NGX_CONF_UNSET;
conf->force_max_concurrent_requests_per_process = NGX_CONF_UNSET;
+ conf->max_request_time = NGX_CONF_UNSET;
}
diff -ru passenger-5.1.2/src/nginx_module/LocationConfig.h passenger-5.1.2-maxtimepatched/src/nginx_module/LocationConfig.h
--- passenger-5.1.2/src/nginx_module/LocationConfig.h 2013-10-26 22:00:00.000000000 +0000
+++ passenger-5.1.2-maxtimepatched/src/nginx_module/LocationConfig.h 2017-02-27 05:56:37.045309717 +0000
@@ -66,6 +66,7 @@
ngx_int_t max_preloader_idle_time;
ngx_int_t max_request_queue_size;
ngx_int_t max_requests;
+ ngx_int_t max_request_time;
ngx_int_t min_instances;
ngx_int_t request_queue_overflow_status_code;
ngx_int_t socket_backlog;
diff -ru passenger-5.1.2/src/nginx_module/MergeLocationConfig.c passenger-5.1.2-maxtimepatched/src/nginx_module/MergeLocationConfig.c
--- passenger-5.1.2/src/nginx_module/MergeLocationConfig.c 2013-10-26 22:00:00.000000000 +0000
+++ passenger-5.1.2-maxtimepatched/src/nginx_module/MergeLocationConfig.c 2017-02-27 05:56:37.045309717 +0000
@@ -177,6 +177,9 @@
ngx_conf_merge_value(conf->force_max_concurrent_requests_per_process,
prev->force_max_concurrent_requests_per_process,
NGX_CONF_UNSET);
+ ngx_conf_merge_value(conf->max_request_time,
+ prev->max_request_time,
+ NGX_CONF_UNSET);
return 1;
}
diff -ru passenger-5.1.2/src/ruby_supportlib/phusion_passenger/config/install_agent_command.rb passenger-5.1.2-maxtimepatched/src/ruby_supportlib/phusion_passenger/config/install_agent_command.rb
--- passenger-5.1.2/src/ruby_supportlib/phusion_passenger/config/install_agent_command.rb 2013-10-26 22:00:00.000000000 +0000
+++ passenger-5.1.2-maxtimepatched/src/ruby_supportlib/phusion_passenger/config/install_agent_command.rb 2017-02-27 05:56:37.045309717 +0000
@@ -50,9 +50,7 @@
parse_options
initialize_objects
sanity_check
- if !download
- compile
- end
+ compile
end
private
@@ -178,11 +176,12 @@
puts "---------------------------------------"
puts
if @options[:compile]
- puts "The #{PROGRAM_NAME} agent binary could not be downloaded. Compiling it from source instead."
+ puts "This version of #{PROGRAM_NAME} agent contains an unofficial patch and must be compiled from source."
puts
CompileAgentCommand.new(@options[:compile_args]).run
else
- abort "No precompiled agent binary could be downloaded. Refusing to compile because --no-compile is given."
+ puts "This version of #{PROGRAM_NAME} agent contains an unofficial patch and must be compiled from source."
+ abort "Refusing to compile because --no-compile is given."
end
end
end
diff -ru passenger-5.1.2/src/ruby_supportlib/phusion_passenger/config/install_standalone_runtime_command.rb passenger-5.1.2-maxtimepatched/src/ruby_supportlib/phusion_passenger/config/install_standalone_runtime_command.rb
--- passenger-5.1.2/src/ruby_supportlib/phusion_passenger/config/install_standalone_runtime_command.rb 2013-10-26 22:00:00.000000000 +0000
+++ passenger-5.1.2-maxtimepatched/src/ruby_supportlib/phusion_passenger/config/install_standalone_runtime_command.rb 2017-02-27 05:56:37.045309717 +0000
@@ -57,9 +57,7 @@
sanity_check
PhusionPassenger::Utils.mktmpdir("passenger-install.", PlatformInfo.tmpexedir) do |tmpdir|
install_agent(tmpdir)
- if !download_nginx_engine
- compile_nginx_engine(tmpdir)
- end
+ compile_nginx_engine(tmpdir)
end
end
@@ -258,7 +256,7 @@
puts "---------------------------------------"
puts
if @options[:compile]
- puts "No precompiled Nginx engine could be downloaded. Compiling it from source instead."
+ puts "This source tree contains an unofficial patch. Nginx must be compiled from source."
puts
args = @options[:compile_args].dup
args << "--working-dir"
diff -ru passenger-5.1.2/src/ruby_supportlib/phusion_passenger/nginx/config_options.rb passenger-5.1.2-maxtimepatched/src/ruby_supportlib/phusion_passenger/nginx/config_options.rb
--- passenger-5.1.2/src/ruby_supportlib/phusion_passenger/nginx/config_options.rb 2013-10-26 22:00:00.000000000 +0000
+++ passenger-5.1.2-maxtimepatched/src/ruby_supportlib/phusion_passenger/nginx/config_options.rb 2017-02-27 05:56:37.045309717 +0000
@@ -361,8 +361,7 @@
{
:name => 'passenger_max_request_time',
:type => :integer,
- :function => 'passenger_enterprise_only',
- :field => nil
+ :field => :max_request_time
},
{
:name => 'passenger_memory_limit',
diff -ru passenger-5.1.2/src/ruby_supportlib/phusion_passenger/standalone/start_command/builtin_engine.rb passenger-5.1.2-maxtimepatched/src/ruby_supportlib/phusion_passenger/standalone/start_command/builtin_engine.rb
--- passenger-5.1.2/src/ruby_supportlib/phusion_passenger/standalone/start_command/builtin_engine.rb 2013-10-26 22:00:00.000000000 +0000
+++ passenger-5.1.2-maxtimepatched/src/ruby_supportlib/phusion_passenger/standalone/start_command/builtin_engine.rb 2017-02-27 05:56:37.045309717 +0000
@@ -160,7 +160,7 @@
add_enterprise_param(command, :concurrency_model, "--concurrency-model")
add_enterprise_param(command, :thread_count, "--app-thread-count")
add_param(command, :max_requests, "--max-requests")
- add_enterprise_param(command, :max_request_time, "--max-request-time")
+ add_param(command, :max_request_time, "--max-request-time")
add_enterprise_param(command, :memory_limit, "--memory-limit")
add_enterprise_flag_param(command, :rolling_restarts, "--rolling-restarts")
add_enterprise_flag_param(command, :resist_deployment_errors, "--resist-deployment-errors")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment