passenger 5.0.21 → 5.0.22

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of passenger might be problematic. Click here for more details.

Files changed (203) hide show
  1. checksums.yaml +8 -8
  2. checksums.yaml.gz.asc +7 -7
  3. data.tar.gz.asc +7 -7
  4. data/CHANGELOG +38 -2
  5. data/CONTRIBUTORS +3 -0
  6. data/README.md +5 -1
  7. data/bin/passenger-status +2 -7
  8. data/build/agent.rb +2 -0
  9. data/build/cxx_dependency_map.rb +1464 -162
  10. data/build/node_tests.rb +1 -1
  11. data/build/packaging.rb +1 -1
  12. data/dev/ci/run_travis.sh +1 -1
  13. data/dev/vagrant/provision.sh +1 -1
  14. data/npm-shrinkwrap.json +635 -125
  15. data/package.json +1 -1
  16. data/resources/templates/standalone/config.erb +33 -161
  17. data/resources/templates/standalone/global.erb +15 -0
  18. data/resources/templates/standalone/http.erb +40 -0
  19. data/resources/templates/standalone/mass_deployment_default_server.erb +11 -0
  20. data/resources/templates/standalone/rails_asset_pipeline.erb +22 -0
  21. data/resources/templates/standalone/server.erb +58 -0
  22. data/src/agent/Core/ApiServer.h +37 -32
  23. data/src/agent/Core/ApplicationPool/BasicGroupInfo.h +1 -1
  24. data/src/agent/Core/ApplicationPool/BasicProcessInfo.h +6 -0
  25. data/src/agent/Core/ApplicationPool/Common.h +1 -1
  26. data/src/agent/Core/ApplicationPool/Group/OutOfBandWork.cpp +1 -1
  27. data/src/agent/Core/ApplicationPool/Group/ProcessListManagement.cpp +4 -0
  28. data/src/agent/Core/ApplicationPool/Implementation.cpp +2 -2
  29. data/src/agent/Core/ApplicationPool/Options.h +18 -1
  30. data/src/agent/Core/ApplicationPool/Pool.h +1 -1
  31. data/src/agent/Core/ApplicationPool/Pool/AnalyticsCollection.cpp +6 -6
  32. data/src/agent/Core/ApplicationPool/Pool/GeneralUtils.cpp +3 -3
  33. data/src/agent/Core/ApplicationPool/Pool/InitializationAndShutdown.cpp +1 -1
  34. data/src/agent/Core/ApplicationPool/Pool/Miscellaneous.cpp +6 -0
  35. data/src/agent/Core/ApplicationPool/Process.h +6 -1
  36. data/src/agent/Core/ApplicationPool/Socket.h +9 -12
  37. data/src/agent/Core/Controller.h +422 -0
  38. data/src/agent/Core/{RequestHandler → Controller}/AppResponse.h +2 -0
  39. data/src/agent/Core/{RequestHandler → Controller}/BufferBody.cpp +27 -5
  40. data/src/agent/Core/{RequestHandler → Controller}/CheckoutSession.cpp +61 -31
  41. data/src/agent/Core/{RequestHandler → Controller}/Client.h +5 -2
  42. data/src/agent/Core/{RequestHandler → Controller}/ForwardResponse.cpp +93 -42
  43. data/src/agent/Core/{RequestHandler → Controller}/Hooks.cpp +107 -60
  44. data/src/agent/Core/Controller/Implementation.cpp +38 -0
  45. data/src/agent/Core/{RequestHandler → Controller}/InitRequest.cpp +134 -80
  46. data/src/agent/Core/Controller/InitializationAndShutdown.cpp +165 -0
  47. data/src/agent/Core/{RequestHandler/Utils.cpp → Controller/InternalUtils.cpp} +49 -32
  48. data/src/agent/Core/Controller/Miscellaneous.cpp +116 -0
  49. data/src/agent/Core/{RequestHandler → Controller}/Request.h +6 -4
  50. data/src/agent/Core/{RequestHandler → Controller}/SendRequest.cpp +205 -130
  51. data/src/agent/Core/Controller/StateInspectionAndConfiguration.cpp +161 -0
  52. data/src/agent/Core/{RequestHandler → Controller}/TurboCaching.h +3 -0
  53. data/src/agent/Core/CoreMain.cpp +62 -51
  54. data/src/agent/Core/OptionParser.h +24 -0
  55. data/src/agent/Core/ResponseCache.h +5 -5
  56. data/src/agent/Core/SpawningKit/Config.h +2 -2
  57. data/src/agent/Core/SpawningKit/SmartSpawner.h +1 -1
  58. data/src/agent/Core/UnionStation/{Core.h → Context.h} +14 -18
  59. data/src/agent/Core/UnionStation/StopwatchLog.h +3 -2
  60. data/src/agent/Core/UnionStation/Transaction.h +7 -7
  61. data/src/agent/Shared/ApiServerUtils.h +9 -1
  62. data/src/agent/UstRouter/ApiServer.h +5 -2
  63. data/src/agent/UstRouter/Controller.h +27 -9
  64. data/src/agent/UstRouter/UstRouterMain.cpp +1 -0
  65. data/src/agent/Watchdog/ApiServer.h +5 -2
  66. data/src/apache2_module/ConfigurationCommands.cpp +7 -0
  67. data/src/apache2_module/ConfigurationFields.hpp +2 -0
  68. data/src/apache2_module/ConfigurationSetters.cpp +24 -0
  69. data/src/apache2_module/CreateDirConfig.cpp +1 -0
  70. data/src/apache2_module/Hooks.cpp +6 -5
  71. data/src/apache2_module/MergeDirConfig.cpp +7 -0
  72. data/src/apache2_module/SetHeaders.cpp +5 -0
  73. data/src/cxx_supportlib/Constants.h +5 -3
  74. data/src/cxx_supportlib/SafeLibev.h +2 -1
  75. data/src/cxx_supportlib/UnionStationFilterSupport.h +2 -1
  76. data/src/cxx_supportlib/Utils/ReleaseableScopedPointer.h +70 -0
  77. data/src/cxx_supportlib/vendor-modified/boost/libs/regex/src/regex_raw_buffer.cpp +6 -6
  78. data/src/helper-scripts/node-loader.js +59 -0
  79. data/src/nginx_module/CacheLocationConfig.c +48 -0
  80. data/src/nginx_module/ConfigurationCommands.c +20 -0
  81. data/src/nginx_module/ConfigurationFields.h +4 -0
  82. data/src/nginx_module/CreateLocationConfig.c +8 -0
  83. data/src/nginx_module/MergeLocationConfig.c +12 -0
  84. data/src/nodejs_supportlib/phusion_passenger/log_express.js +106 -0
  85. data/src/nodejs_supportlib/phusion_passenger/log_mongodb.js +203 -0
  86. data/src/nodejs_supportlib/phusion_passenger/ustreporter.js +227 -0
  87. data/src/nodejs_supportlib/phusion_passenger/ustrouter_connector.js +446 -0
  88. data/src/nodejs_supportlib/vendor-copy/codify/codify.js +44 -0
  89. data/src/nodejs_supportlib/vendor-copy/codify/package.json +29 -0
  90. data/src/nodejs_supportlib/vendor-copy/continuation-local-storage/context.js +200 -0
  91. data/src/nodejs_supportlib/vendor-copy/continuation-local-storage/node_modules/async-listener/glue.js +488 -0
  92. data/src/nodejs_supportlib/vendor-copy/continuation-local-storage/node_modules/async-listener/index.js +407 -0
  93. data/src/nodejs_supportlib/vendor-copy/continuation-local-storage/node_modules/async-listener/node_modules/shimmer/index.js +90 -0
  94. data/src/nodejs_supportlib/vendor-copy/continuation-local-storage/node_modules/async-listener/node_modules/shimmer/package.json +40 -0
  95. data/src/nodejs_supportlib/vendor-copy/continuation-local-storage/node_modules/async-listener/package.json +54 -0
  96. data/src/nodejs_supportlib/vendor-copy/continuation-local-storage/node_modules/emitter-listener/listener.js +160 -0
  97. data/src/nodejs_supportlib/vendor-copy/continuation-local-storage/node_modules/emitter-listener/node_modules/shimmer/index.js +90 -0
  98. data/src/nodejs_supportlib/vendor-copy/continuation-local-storage/node_modules/emitter-listener/node_modules/shimmer/package.json +40 -0
  99. data/src/nodejs_supportlib/vendor-copy/continuation-local-storage/node_modules/emitter-listener/package.json +46 -0
  100. data/src/nodejs_supportlib/vendor-copy/continuation-local-storage/package.json +56 -0
  101. data/src/nodejs_supportlib/vendor-copy/network-byte-order/lib/index.js +102 -0
  102. data/src/nodejs_supportlib/vendor-copy/network-byte-order/package.json +51 -0
  103. data/src/nodejs_supportlib/vendor-copy/winston/LICENSE +19 -0
  104. data/src/nodejs_supportlib/vendor-copy/winston/lib/winston.js +165 -0
  105. data/src/nodejs_supportlib/vendor-copy/winston/lib/winston/common.js +483 -0
  106. data/src/nodejs_supportlib/vendor-copy/winston/lib/winston/config.js +62 -0
  107. data/src/nodejs_supportlib/vendor-copy/winston/lib/winston/config/cli-config.js +35 -0
  108. data/src/nodejs_supportlib/vendor-copy/winston/lib/winston/config/npm-config.js +27 -0
  109. data/src/nodejs_supportlib/vendor-copy/winston/lib/winston/config/syslog-config.js +31 -0
  110. data/src/nodejs_supportlib/vendor-copy/winston/lib/winston/container.js +127 -0
  111. data/src/nodejs_supportlib/vendor-copy/winston/lib/winston/exception.js +56 -0
  112. data/src/nodejs_supportlib/vendor-copy/winston/lib/winston/logger.js +701 -0
  113. data/src/nodejs_supportlib/vendor-copy/winston/lib/winston/transports.js +34 -0
  114. data/src/nodejs_supportlib/vendor-copy/winston/lib/winston/transports/console.js +128 -0
  115. data/src/nodejs_supportlib/vendor-copy/winston/lib/winston/transports/daily-rotate-file.js +601 -0
  116. data/src/nodejs_supportlib/vendor-copy/winston/lib/winston/transports/file.js +675 -0
  117. data/src/nodejs_supportlib/vendor-copy/winston/lib/winston/transports/http.js +232 -0
  118. data/src/nodejs_supportlib/vendor-copy/winston/lib/winston/transports/memory.js +89 -0
  119. data/src/nodejs_supportlib/vendor-copy/winston/lib/winston/transports/transport.js +135 -0
  120. data/src/nodejs_supportlib/vendor-copy/winston/lib/winston/transports/webhook.js +146 -0
  121. data/src/nodejs_supportlib/vendor-copy/winston/node_modules/async/LICENSE +19 -0
  122. data/src/nodejs_supportlib/vendor-copy/winston/node_modules/async/lib/async.js +1283 -0
  123. data/src/nodejs_supportlib/vendor-copy/winston/node_modules/async/package.json +66 -0
  124. data/src/nodejs_supportlib/vendor-copy/winston/node_modules/async/support/sync-package-managers.js +53 -0
  125. data/src/nodejs_supportlib/vendor-copy/winston/node_modules/colors/MIT-LICENSE.txt +23 -0
  126. data/src/nodejs_supportlib/vendor-copy/winston/node_modules/colors/lib/colors.js +176 -0
  127. data/src/nodejs_supportlib/vendor-copy/winston/node_modules/colors/lib/custom/trap.js +45 -0
  128. data/src/nodejs_supportlib/vendor-copy/winston/node_modules/colors/lib/custom/zalgo.js +104 -0
  129. data/src/nodejs_supportlib/vendor-copy/winston/node_modules/colors/lib/extendStringPrototype.js +118 -0
  130. data/src/nodejs_supportlib/vendor-copy/winston/node_modules/colors/lib/index.js +12 -0
  131. data/src/nodejs_supportlib/vendor-copy/winston/node_modules/colors/lib/maps/america.js +12 -0
  132. data/src/nodejs_supportlib/vendor-copy/winston/node_modules/colors/lib/maps/rainbow.js +13 -0
  133. data/src/nodejs_supportlib/vendor-copy/winston/node_modules/colors/lib/maps/random.js +8 -0
  134. data/src/nodejs_supportlib/vendor-copy/winston/node_modules/colors/lib/maps/zebra.js +5 -0
  135. data/src/nodejs_supportlib/vendor-copy/winston/node_modules/colors/lib/styles.js +77 -0
  136. data/src/nodejs_supportlib/vendor-copy/winston/node_modules/colors/lib/system/supports-colors.js +61 -0
  137. data/src/nodejs_supportlib/vendor-copy/winston/node_modules/colors/package.json +35 -0
  138. data/src/nodejs_supportlib/vendor-copy/winston/node_modules/colors/safe.js +9 -0
  139. data/src/nodejs_supportlib/vendor-copy/winston/node_modules/colors/themes/generic-logging.js +12 -0
  140. data/src/nodejs_supportlib/vendor-copy/winston/node_modules/cycle/cycle.js +170 -0
  141. data/src/nodejs_supportlib/vendor-copy/winston/node_modules/cycle/package.json +30 -0
  142. data/src/nodejs_supportlib/vendor-copy/winston/node_modules/eyes/LICENSE +20 -0
  143. data/src/nodejs_supportlib/vendor-copy/winston/node_modules/eyes/lib/eyes.js +236 -0
  144. data/src/nodejs_supportlib/vendor-copy/winston/node_modules/eyes/package.json +42 -0
  145. data/src/nodejs_supportlib/vendor-copy/winston/node_modules/isstream/LICENSE.md +11 -0
  146. data/src/nodejs_supportlib/vendor-copy/winston/node_modules/isstream/isstream.js +27 -0
  147. data/src/nodejs_supportlib/vendor-copy/winston/node_modules/isstream/package.json +42 -0
  148. data/src/nodejs_supportlib/vendor-copy/winston/node_modules/pkginfo/LICENSE +19 -0
  149. data/src/nodejs_supportlib/vendor-copy/winston/node_modules/pkginfo/lib/pkginfo.js +136 -0
  150. data/src/nodejs_supportlib/vendor-copy/winston/node_modules/pkginfo/package.json +56 -0
  151. data/src/nodejs_supportlib/vendor-copy/winston/node_modules/stack-trace/License +19 -0
  152. data/src/nodejs_supportlib/vendor-copy/winston/node_modules/stack-trace/lib/stack-trace.js +111 -0
  153. data/src/nodejs_supportlib/vendor-copy/winston/node_modules/stack-trace/package.json +33 -0
  154. data/src/nodejs_supportlib/vendor-copy/winston/package.json +87 -0
  155. data/src/ruby_supportlib/phusion_passenger.rb +3 -4
  156. data/src/ruby_supportlib/phusion_passenger/admin_tools/instance.rb +19 -2
  157. data/src/ruby_supportlib/phusion_passenger/apache2/config_options.rb +8 -0
  158. data/src/ruby_supportlib/phusion_passenger/config/list_instances_command.rb +2 -6
  159. data/src/ruby_supportlib/phusion_passenger/config/reopen_logs_command.rb +13 -0
  160. data/src/ruby_supportlib/phusion_passenger/config/restart_app_command.rb +3 -0
  161. data/src/ruby_supportlib/phusion_passenger/config/utils.rb +9 -7
  162. data/src/ruby_supportlib/phusion_passenger/config/validate_install_command.rb +8 -1
  163. data/src/ruby_supportlib/phusion_passenger/constants.rb +3 -1
  164. data/src/ruby_supportlib/phusion_passenger/native_support.rb +20 -4
  165. data/src/ruby_supportlib/phusion_passenger/nginx/config_options.rb +8 -0
  166. data/src/ruby_supportlib/phusion_passenger/packaging.rb +1 -0
  167. data/src/ruby_supportlib/phusion_passenger/platform_info/apache_detector.rb +1 -1
  168. data/src/ruby_supportlib/phusion_passenger/platform_info/operating_system.rb +11 -4
  169. data/src/ruby_supportlib/phusion_passenger/rack/thread_handler_extension.rb +1 -1
  170. data/src/ruby_supportlib/phusion_passenger/standalone/config_options_list.rb +647 -0
  171. data/src/ruby_supportlib/phusion_passenger/standalone/config_utils.rb +229 -15
  172. data/src/ruby_supportlib/phusion_passenger/standalone/start_command.rb +35 -323
  173. data/src/ruby_supportlib/phusion_passenger/standalone/start_command/builtin_engine.rb +36 -12
  174. data/src/ruby_supportlib/phusion_passenger/standalone/start_command/nginx_engine.rb +123 -14
  175. data/src/ruby_supportlib/phusion_passenger/standalone/status_command.rb +32 -17
  176. data/src/ruby_supportlib/phusion_passenger/standalone/stop_command.rb +32 -21
  177. data/src/ruby_supportlib/phusion_passenger/standalone/version_command.rb +5 -5
  178. data/src/ruby_supportlib/phusion_passenger/vendor/union_station_hooks_core/README.md +2 -2
  179. data/src/ruby_supportlib/phusion_passenger/vendor/union_station_hooks_core/Rakefile +5 -1
  180. data/src/ruby_supportlib/phusion_passenger/vendor/union_station_hooks_core/lib/union_station_hooks_core.rb +68 -24
  181. data/src/ruby_supportlib/phusion_passenger/vendor/union_station_hooks_core/lib/union_station_hooks_core/api.rb +9 -1
  182. data/src/ruby_supportlib/phusion_passenger/vendor/union_station_hooks_core/lib/union_station_hooks_core/context.rb +9 -7
  183. data/src/ruby_supportlib/phusion_passenger/vendor/union_station_hooks_core/lib/union_station_hooks_core/request_reporter.rb +3 -2
  184. data/src/ruby_supportlib/phusion_passenger/vendor/union_station_hooks_core/lib/union_station_hooks_core/request_reporter/basics.rb +8 -5
  185. data/src/ruby_supportlib/phusion_passenger/vendor/union_station_hooks_core/lib/union_station_hooks_core/simple_json.rb +395 -0
  186. data/src/ruby_supportlib/phusion_passenger/vendor/union_station_hooks_core/lib/union_station_hooks_core/transaction.rb +10 -7
  187. data/src/ruby_supportlib/phusion_passenger/vendor/union_station_hooks_core/lib/union_station_hooks_core/utils.rb +14 -0
  188. data/src/ruby_supportlib/phusion_passenger/vendor/union_station_hooks_core/lib/union_station_hooks_core/version_data.rb +2 -2
  189. data/src/ruby_supportlib/phusion_passenger/vendor/union_station_hooks_core/ruby_versions.yml +4 -2
  190. data/src/ruby_supportlib/phusion_passenger/vendor/union_station_hooks_core/ruby_versions.yml.example +2 -2
  191. data/src/ruby_supportlib/phusion_passenger/vendor/union_station_hooks_core/ruby_versions.yml.travis +2 -2
  192. data/src/ruby_supportlib/phusion_passenger/vendor/union_station_hooks_core/ruby_versions.yml.travis-with-sudo +16 -0
  193. data/src/ruby_supportlib/phusion_passenger/vendor/union_station_hooks_rails/Gemfile +1 -1
  194. data/src/ruby_supportlib/phusion_passenger/vendor/union_station_hooks_rails/Gemfile.lock +2 -2
  195. data/src/ruby_supportlib/phusion_passenger/vendor/union_station_hooks_rails/README.md +1 -1
  196. data/src/ruby_supportlib/phusion_passenger/vendor/union_station_hooks_rails/lib/union_station_hooks_rails.rb +44 -17
  197. data/src/ruby_supportlib/phusion_passenger/vendor/union_station_hooks_rails/lib/union_station_hooks_rails/active_support_cache_subscriber.rb +16 -7
  198. data/src/ruby_supportlib/phusion_passenger/vendor/union_station_hooks_rails/lib/union_station_hooks_rails/version_data.rb +2 -2
  199. data/src/ruby_supportlib/phusion_passenger/vendor/union_station_hooks_rails/union_station_hooks_rails.gemspec +1 -1
  200. metadata +99 -16
  201. metadata.gz.asc +7 -7
  202. data/resources/oss-binaries.phusionpassenger.com.crt +0 -248
  203. data/src/agent/Core/RequestHandler.h +0 -471
@@ -40,6 +40,7 @@
40
40
  #include <DataStructures/LString.h>
41
41
 
42
42
  namespace Passenger {
43
+ namespace Core {
43
44
 
44
45
 
45
46
  class HttpHeaderParser;
@@ -226,6 +227,7 @@ public:
226
227
  };
227
228
 
228
229
 
230
+ } // namespace Core
229
231
  } // namespace Passenger
230
232
 
231
233
  #endif /* _PASSENGER_APP_RESPONSE_H_ */
@@ -23,13 +23,31 @@
23
23
  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
24
24
  * THE SOFTWARE.
25
25
  */
26
+ #include <Core/Controller.h>
27
+
28
+ /*************************************************************************
29
+ *
30
+ * Implements Core::Controller methods pertaining buffering the request
31
+ * body.
32
+ *
33
+ *************************************************************************/
34
+
35
+ namespace Passenger {
36
+ namespace Core {
37
+
38
+ using namespace std;
39
+ using namespace boost;
26
40
 
27
- // This file is included inside the RequestHandler class.
28
41
 
29
- private:
42
+ /****************************
43
+ *
44
+ * Private methods
45
+ *
46
+ ****************************/
47
+
30
48
 
31
49
  void
32
- beginBufferingBody(Client *client, Request *req) {
50
+ Controller::beginBufferingBody(Client *client, Request *req) {
33
51
  TRACE_POINT();
34
52
  req->state = Request::BUFFERING_REQUEST_BODY;
35
53
  req->bodyChannel.start();
@@ -38,8 +56,8 @@ beginBufferingBody(Client *client, Request *req) {
38
56
  req->beginStopwatchLog(&req->stopwatchLogs.bufferingRequestBody, "buffering request body");
39
57
  }
40
58
 
41
- Channel::Result
42
- whenBufferingBody_onRequestBody(Client *client, Request *req,
59
+ ServerKit::Channel::Result
60
+ Controller::whenBufferingBody_onRequestBody(Client *client, Request *req,
43
61
  const MemoryKit::mbuf &buffer, int errcode)
44
62
  {
45
63
  TRACE_POINT();
@@ -97,3 +115,7 @@ whenBufferingBody_onRequestBody(Client *client, Request *req,
97
115
  return Channel::Result(0, true);
98
116
  }
99
117
  }
118
+
119
+
120
+ } // namespace Core
121
+ } // namespace Passenger
@@ -23,17 +23,35 @@
23
23
  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
24
24
  * THE SOFTWARE.
25
25
  */
26
+ #include <Core/Controller.h>
26
27
 
27
- // This file is included inside the RequestHandler class.
28
+ /*************************************************************************
29
+ *
30
+ * Implements Core::Controller methods pertaining selecting an application
31
+ * process to handle the current request.
32
+ *
33
+ *************************************************************************/
34
+
35
+ namespace Passenger {
36
+ namespace Core {
37
+
38
+ using namespace std;
39
+ using namespace boost;
40
+
41
+
42
+ /****************************
43
+ *
44
+ * Private methods
45
+ *
46
+ ****************************/
28
47
 
29
- private:
30
48
 
31
49
  void
32
- checkoutSession(Client *client, Request *req) {
50
+ Controller::checkoutSession(Client *client, Request *req) {
33
51
  GetCallback callback;
34
52
  Options &options = req->options;
35
53
 
36
- RH_BENCHMARK_POINT(client, req, BM_BEFORE_CHECKOUT);
54
+ CC_BENCHMARK_POINT(client, req, BM_BEFORE_CHECKOUT);
37
55
  SKC_TRACE(client, 2, "Checking out session: appRoot=" << options.appRoot);
38
56
  req->state = Request::CHECKING_OUT_SESSION;
39
57
  req->beginStopwatchLog(&req->stopwatchLogs.getFromPool, "get from pool");
@@ -49,11 +67,11 @@ checkoutSession(Client *client, Request *req) {
49
67
  options.currentTime = (unsigned long long) (ev_now(getLoop()) * 1000000);
50
68
 
51
69
  refRequest(req, __FILE__, __LINE__);
52
- #ifdef DEBUG_RH_EVENT_LOOP_BLOCKING
70
+ #ifdef DEBUG_CC_EVENT_LOOP_BLOCKING
53
71
  req->timeBeforeAccessingApplicationPool = ev_now(getLoop());
54
72
  #endif
55
73
  appPool->asyncGet(options, callback);
56
- #ifdef DEBUG_RH_EVENT_LOOP_BLOCKING
74
+ #ifdef DEBUG_CC_EVENT_LOOP_BLOCKING
57
75
  if (!req->timedAppPoolGet) {
58
76
  req->timedAppPoolGet = true;
59
77
  ev_now_update(getLoop());
@@ -63,35 +81,35 @@ checkoutSession(Client *client, Request *req) {
63
81
  #endif
64
82
  }
65
83
 
66
- static void
67
- sessionCheckedOut(const SessionPtr &session, const ExceptionPtr &e,
84
+ void
85
+ Controller::sessionCheckedOut(const SessionPtr &session, const ExceptionPtr &e,
68
86
  void *userData)
69
87
  {
70
88
  Request *req = static_cast<Request *>(userData);
71
89
  Client *client = static_cast<Client *>(req->client);
72
- RequestHandler *self = static_cast<RequestHandler *>(getServerFromClient(client));
90
+ Controller *self = static_cast<Controller *>(getServerFromClient(client));
73
91
 
74
92
  if (self->getContext()->libev->onEventLoopThread()) {
75
93
  self->sessionCheckedOutFromEventLoopThread(client, req, session, e);
76
94
  self->unrefRequest(req, __FILE__, __LINE__);
77
95
  } else {
78
96
  self->getContext()->libev->runLater(
79
- boost::bind(&RequestHandler::sessionCheckedOutFromAnotherThread,
97
+ boost::bind(&Controller::sessionCheckedOutFromAnotherThread,
80
98
  self, client, req, session, e));
81
99
  }
82
100
  }
83
101
 
84
102
  void
85
- sessionCheckedOutFromAnotherThread(Client *client, Request *req,
103
+ Controller::sessionCheckedOutFromAnotherThread(Client *client, Request *req,
86
104
  SessionPtr session, ExceptionPtr e)
87
105
  {
88
- SKC_LOG_EVENT(RequestHandler, client, "sessionCheckedOutFromAnotherThread");
106
+ SKC_LOG_EVENT(Controller, client, "sessionCheckedOutFromAnotherThread");
89
107
  sessionCheckedOutFromEventLoopThread(client, req, session, e);
90
108
  unrefRequest(req, __FILE__, __LINE__);
91
109
  }
92
110
 
93
111
  void
94
- sessionCheckedOutFromEventLoopThread(Client *client, Request *req,
112
+ Controller::sessionCheckedOutFromEventLoopThread(Client *client, Request *req,
95
113
  const SessionPtr &session, const ExceptionPtr &e)
96
114
  {
97
115
  if (req->ended()) {
@@ -99,9 +117,9 @@ sessionCheckedOutFromEventLoopThread(Client *client, Request *req,
99
117
  }
100
118
 
101
119
  TRACE_POINT();
102
- RH_BENCHMARK_POINT(client, req, BM_AFTER_CHECKOUT);
120
+ CC_BENCHMARK_POINT(client, req, BM_AFTER_CHECKOUT);
103
121
 
104
- #ifdef DEBUG_RH_EVENT_LOOP_BLOCKING
122
+ #ifdef DEBUG_CC_EVENT_LOOP_BLOCKING
105
123
  if (!req->timedAppPoolGet) {
106
124
  req->timedAppPoolGet = true;
107
125
  ev_now_update(getLoop());
@@ -126,7 +144,7 @@ sessionCheckedOutFromEventLoopThread(Client *client, Request *req,
126
144
  }
127
145
 
128
146
  void
129
- maybeSend100Continue(Client *client, Request *req) {
147
+ Controller::maybeSend100Continue(Client *client, Request *req) {
130
148
  int httpVersion = req->httpMajor * 1000 + req->httpMinor * 10;
131
149
  if (httpVersion >= 1010 && req->hasBody() && !req->strip100ContinueHeader) {
132
150
  // Apps with the "session" protocol don't respond with 100-Continue,
@@ -150,7 +168,7 @@ maybeSend100Continue(Client *client, Request *req) {
150
168
  }
151
169
 
152
170
  void
153
- initiateSession(Client *client, Request *req) {
171
+ Controller::initiateSession(Client *client, Request *req) {
154
172
  TRACE_POINT();
155
173
  req->sessionCheckoutTry++;
156
174
  try {
@@ -189,12 +207,12 @@ initiateSession(Client *client, Request *req) {
189
207
  sendHeaderToApp(client, req);
190
208
  }
191
209
 
192
- static void
193
- checkoutSessionLater(Request *req) {
210
+ void
211
+ Controller::checkoutSessionLater(Request *req) {
194
212
  Client *client = static_cast<Client *>(req->client);
195
- RequestHandler *self = static_cast<RequestHandler *>(
196
- RequestHandler::getServerFromClient(client));
197
- SKC_LOG_EVENT_FROM_STATIC(self, RequestHandler, client, "checkoutSessionLater");
213
+ Controller *self = static_cast<Controller *>(
214
+ Controller::getServerFromClient(client));
215
+ SKC_LOG_EVENT_FROM_STATIC(self, Controller, client, "checkoutSessionLater");
198
216
 
199
217
  if (!req->ended()) {
200
218
  self->checkoutSession(client, req);
@@ -203,7 +221,9 @@ checkoutSessionLater(Request *req) {
203
221
  }
204
222
 
205
223
  void
206
- reportSessionCheckoutError(Client *client, Request *req, const ExceptionPtr &e) {
224
+ Controller::reportSessionCheckoutError(Client *client, Request *req,
225
+ const ExceptionPtr &e)
226
+ {
207
227
  TRACE_POINT();
208
228
  {
209
229
  boost::shared_ptr<RequestQueueFullException> e2 =
@@ -224,9 +244,12 @@ reportSessionCheckoutError(Client *client, Request *req, const ExceptionPtr &e)
224
244
  }
225
245
 
226
246
  void
227
- writeRequestQueueFullExceptionErrorResponse(Client *client, Request *req, const boost::shared_ptr<RequestQueueFullException> &e) {
247
+ Controller::writeRequestQueueFullExceptionErrorResponse(Client *client, Request *req,
248
+ const boost::shared_ptr<RequestQueueFullException> &e)
249
+ {
228
250
  TRACE_POINT();
229
- const LString *value = req->secureHeaders.lookup("!~PASSENGER_REQUEST_QUEUE_OVERFLOW_STATUS_CODE");
251
+ const LString *value = req->secureHeaders.lookup(
252
+ "!~PASSENGER_REQUEST_QUEUE_OVERFLOW_STATUS_CODE");
230
253
  int requestQueueOverflowStatusCode = 503;
231
254
  if (value != NULL && value->size > 0) {
232
255
  value = psg_lstr_make_contiguous(value, req->pool);
@@ -234,7 +257,8 @@ writeRequestQueueFullExceptionErrorResponse(Client *client, Request *req, const
234
257
  StaticString(value->start->data, value->size));
235
258
  }
236
259
 
237
- SKC_WARN(client, "Returning HTTP " << requestQueueOverflowStatusCode << " due to: " << e->what());
260
+ SKC_WARN(client, "Returning HTTP " << requestQueueOverflowStatusCode <<
261
+ " due to: " << e->what());
238
262
 
239
263
  endRequestWithSimpleResponse(&client, &req,
240
264
  "<h1>This website is under heavy load</h1>"
@@ -244,7 +268,7 @@ writeRequestQueueFullExceptionErrorResponse(Client *client, Request *req, const
244
268
  }
245
269
 
246
270
  void
247
- writeSpawnExceptionErrorResponse(Client *client, Request *req,
271
+ Controller::writeSpawnExceptionErrorResponse(Client *client, Request *req,
248
272
  const boost::shared_ptr<SpawnException> &e)
249
273
  {
250
274
  TRACE_POINT();
@@ -255,7 +279,7 @@ writeSpawnExceptionErrorResponse(Client *client, Request *req,
255
279
  }
256
280
 
257
281
  void
258
- writeOtherExceptionErrorResponse(Client *client, Request *req, const ExceptionPtr &e) {
282
+ Controller::writeOtherExceptionErrorResponse(Client *client, Request *req, const ExceptionPtr &e) {
259
283
  TRACE_POINT();
260
284
  string typeName;
261
285
  #ifdef CXX_ABI_API_AVAILABLE
@@ -304,8 +328,8 @@ writeOtherExceptionErrorResponse(Client *client, Request *req, const ExceptionPt
304
328
  * `message` will be copied and doesn't need to outlive the request.
305
329
  */
306
330
  void
307
- endRequestWithErrorResponse(Client **c, Request **r, const StaticString &message,
308
- const SpawnException *e = NULL)
331
+ Controller::endRequestWithErrorResponse(Client **c, Request **r, const StaticString &message,
332
+ const SpawnException *e)
309
333
  {
310
334
  TRACE_POINT();
311
335
  Client *client = *c;
@@ -335,7 +359,7 @@ endRequestWithErrorResponse(Client **c, Request **r, const StaticString &message
335
359
  }
336
360
 
337
361
  bool
338
- friendlyErrorPagesEnabled(Request *req) {
362
+ Controller::friendlyErrorPagesEnabled(Request *req) {
339
363
  bool defaultValue;
340
364
  string defaultStr = agentsOptions->get("friendly_error_pages");
341
365
  if (defaultStr == "auto") {
@@ -348,3 +372,9 @@ friendlyErrorPagesEnabled(Request *req) {
348
372
  }
349
373
 
350
374
  /***************/
375
+
376
+ /***************/
377
+
378
+
379
+ } // namespace Core
380
+ } // namespace Passenger
@@ -29,9 +29,10 @@
29
29
  #include <ev++.h>
30
30
  #include <ostream>
31
31
  #include <ServerKit/HttpClient.h>
32
- #include <Core/RequestHandler/Request.h>
32
+ #include <Core/Controller/Request.h>
33
33
 
34
34
  namespace Passenger {
35
+ namespace Core {
35
36
 
36
37
  using namespace std;
37
38
  using namespace boost;
@@ -48,10 +49,12 @@ public:
48
49
  SERVER_KIT_BASE_HTTP_CLIENT_INIT();
49
50
  }
50
51
 
51
- DEFINE_SERVER_KIT_BASE_HTTP_CLIENT_FOOTER(Client, Request);
52
+ DEFINE_SERVER_KIT_BASE_HTTP_CLIENT_FOOTER(Passenger::Core::Client,
53
+ Passenger::Core::Request);
52
54
  };
53
55
 
54
56
 
57
+ } // namespace Client
55
58
  } // namespace Passenger
56
59
 
57
60
  #endif /* _PASSENGER_REQUEST_HANDLER_CLIENT_H_ */
@@ -23,25 +23,45 @@
23
23
  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
24
24
  * THE SOFTWARE.
25
25
  */
26
+ #include <Core/Controller.h>
26
27
 
27
- // This file is included inside the RequestHandler class.
28
- // It handles app --> client data forwarding.
28
+ /*************************************************************************
29
+ *
30
+ * Implements Core::Controller methods pertaining sending application
31
+ * response data to the client. This happens in parallel to the process
32
+ * of sending request data to the application.
33
+ *
34
+ *************************************************************************/
35
+
36
+ namespace Passenger {
37
+ namespace Core {
38
+
39
+ using namespace std;
40
+ using namespace boost;
29
41
 
30
- private:
31
42
 
32
- static Channel::Result
33
- _onAppSourceData(Channel *_channel, const MemoryKit::mbuf &buffer, int errcode) {
43
+ /****************************
44
+ *
45
+ * Private methods
46
+ *
47
+ ****************************/
48
+
49
+
50
+ ServerKit::Channel::Result
51
+ Controller::_onAppSourceData(Channel *_channel, const MemoryKit::mbuf &buffer, int errcode) {
34
52
  FdSourceChannel *channel = reinterpret_cast<FdSourceChannel *>(_channel);
35
53
  Request *req = static_cast<Request *>(static_cast<
36
54
  ServerKit::BaseHttpRequest *>(channel->getHooks()->userData));
37
55
  Client *client = static_cast<Client *>(req->client);
38
- RequestHandler *self = static_cast<RequestHandler *>(getServerFromClient(client));
56
+ Controller *self = static_cast<Controller *>(getServerFromClient(client));
39
57
  return self->onAppSourceData(client, req, buffer, errcode);
40
58
  }
41
59
 
42
- Channel::Result
43
- onAppSourceData(Client *client, Request *req, const MemoryKit::mbuf &buffer, int errcode) {
44
- SKC_LOG_EVENT(RequestHandler, client, "onAppSourceData");
60
+ ServerKit::Channel::Result
61
+ Controller::onAppSourceData(Client *client, Request *req, const MemoryKit::mbuf &buffer,
62
+ int errcode)
63
+ {
64
+ SKC_LOG_EVENT(Controller, client, "onAppSourceData");
45
65
  AppResponse *resp = &req->appResponse;
46
66
 
47
67
  switch (resp->httpState) {
@@ -292,13 +312,13 @@ onAppSourceData(Client *client, Request *req, const MemoryKit::mbuf &buffer, int
292
312
  }
293
313
 
294
314
  void
295
- onAppResponseBegin(Client *client, Request *req) {
315
+ Controller::onAppResponseBegin(Client *client, Request *req) {
296
316
  TRACE_POINT();
297
317
  AppResponse *resp = &req->appResponse;
298
318
  ssize_t bytesWritten;
299
319
  bool oobw;
300
320
 
301
- #ifdef DEBUG_RH_EVENT_LOOP_BLOCKING
321
+ #ifdef DEBUG_CC_EVENT_LOOP_BLOCKING
302
322
  req->timeOnRequestHeaderSent = ev_now(getLoop());
303
323
  reportLargeTimeDiff(client,
304
324
  "Headers sent until response begun",
@@ -375,7 +395,8 @@ onAppResponseBegin(Client *client, Request *req) {
375
395
  }
376
396
  }
377
397
 
378
- void prepareAppResponseCaching(Client *client, Request *req) {
398
+ void
399
+ Controller::prepareAppResponseCaching(Client *client, Request *req) {
379
400
  if (turboCaching.isEnabled() && !req->cacheKey.empty()) {
380
401
  TRACE_POINT();
381
402
  AppResponse *resp = &req->appResponse;
@@ -408,7 +429,7 @@ void prepareAppResponseCaching(Client *client, Request *req) {
408
429
  }
409
430
 
410
431
  void
411
- onAppResponse100Continue(Client *client, Request *req) {
432
+ Controller::onAppResponse100Continue(Client *client, Request *req) {
412
433
  TRACE_POINT();
413
434
  if (!req->strip100ContinueHeader) {
414
435
  UPDATE_TRACE_POINT();
@@ -445,7 +466,7 @@ onAppResponse100Continue(Client *client, Request *req) {
445
466
  * In this case, this method always returns true.
446
467
  */
447
468
  bool
448
- constructHeaderBuffersForResponse(Request *req, struct iovec *buffers,
469
+ Controller::constructHeaderBuffersForResponse(Request *req, struct iovec *buffers,
449
470
  unsigned int maxbuffers, unsigned int & restrict_ref nbuffers,
450
471
  unsigned int & restrict_ref dataSize,
451
472
  unsigned int & restrict_ref nCacheableBuffers)
@@ -768,7 +789,7 @@ constructHeaderBuffersForResponse(Request *req, struct iovec *buffers,
768
789
  }
769
790
 
770
791
  unsigned int
771
- constructDateHeaderBuffersForResponse(char *dateStr, unsigned int bufsize) {
792
+ Controller::constructDateHeaderBuffersForResponse(char *dateStr, unsigned int bufsize) {
772
793
  char *pos = dateStr;
773
794
  const char *end = dateStr + bufsize - 1;
774
795
  time_t the_time = (time_t) ev_now(getContext()->libev->getLoop());
@@ -781,7 +802,9 @@ constructDateHeaderBuffersForResponse(char *dateStr, unsigned int bufsize) {
781
802
  }
782
803
 
783
804
  bool
784
- sendResponseHeaderWithWritev(Client *client, Request *req, ssize_t &bytesWritten) {
805
+ Controller::sendResponseHeaderWithWritev(Client *client, Request *req,
806
+ ssize_t &bytesWritten)
807
+ {
785
808
  TRACE_POINT();
786
809
 
787
810
  if (OXT_UNLIKELY(benchmarkMode == BM_RESPONSE_BEGIN)) {
@@ -816,7 +839,9 @@ sendResponseHeaderWithWritev(Client *client, Request *req, ssize_t &bytesWritten
816
839
  }
817
840
 
818
841
  void
819
- sendResponseHeaderWithBuffering(Client *client, Request *req, unsigned int offset) {
842
+ Controller::sendResponseHeaderWithBuffering(Client *client, Request *req,
843
+ unsigned int offset)
844
+ {
820
845
  struct iovec *buffers;
821
846
  unsigned int nbuffers, dataSize, nCacheableBuffers;
822
847
  bool ok;
@@ -852,7 +877,7 @@ sendResponseHeaderWithBuffering(Client *client, Request *req, unsigned int offse
852
877
  }
853
878
 
854
879
  void
855
- logResponseHeaders(Client *client, Request *req, struct iovec *buffers,
880
+ Controller::logResponseHeaders(Client *client, Request *req, struct iovec *buffers,
856
881
  unsigned int nbuffers, unsigned int dataSize)
857
882
  {
858
883
  if (OXT_UNLIKELY(getLogLevel() >= LVL_DEBUG3)) {
@@ -869,12 +894,28 @@ logResponseHeaders(Client *client, Request *req, struct iovec *buffers,
869
894
  } else {
870
895
  req->logMessage("Status: " + toString(req->appResponse.statusCode));
871
896
  }
897
+
898
+ if (req->appResponse.statusCode >= 500 && req->appResponse.statusCode <= 599) {
899
+ // Log the request headers like Request headers: { header1: values1-concatenated, header2: values2-concatenated } (single line)
900
+ // Concatenation was already done by HeaderTable.h:insert (using a comma ',' for joining, or a semicolon ';' for Cookie headers
901
+ ServerKit::HeaderTable::Iterator it(req->headers);
902
+ Json::Value json;
903
+ while (*it != NULL) {
904
+ const LString *hdr = psg_lstr_make_contiguous(&it->header->key, req->pool);
905
+ const LString *val = psg_lstr_make_contiguous(&it->header->val, req->pool);
906
+ // Due to the above mentioned concatenation, header keys are unique and we don't need to worry
907
+ // about encountering multiple of the same key, so we can just assign.
908
+ json[std::string(hdr->start->data, hdr->size)] = std::string(val->start->data, val->size);
909
+ it.next();
910
+ }
911
+ req->logMessage("Request headers: " + stringifyJson(json));
912
+ }
872
913
  }
873
914
  }
874
915
 
875
916
  void
876
- markHeaderBuffersForTurboCaching(Client *client, Request *req, struct iovec *buffers,
877
- unsigned int nbuffers)
917
+ Controller::markHeaderBuffersForTurboCaching(Client *client, Request *req,
918
+ struct iovec *buffers, unsigned int nbuffers)
878
919
  {
879
920
  if (turboCaching.isEnabled() && !req->cacheKey.empty()) {
880
921
  unsigned int totalSize = 0;
@@ -897,22 +938,23 @@ markHeaderBuffersForTurboCaching(Client *client, Request *req, struct iovec *buf
897
938
  }
898
939
  }
899
940
 
900
- static ServerKit::HttpHeaderParser<AppResponse, ServerKit::HttpParseResponse>
901
- createAppResponseHeaderParser(ServerKit::Context *ctx, Request *req) {
941
+ ServerKit::HttpHeaderParser<AppResponse, ServerKit::HttpParseResponse>
942
+ Controller::createAppResponseHeaderParser(ServerKit::Context *ctx, Request *req) {
902
943
  return ServerKit::HttpHeaderParser<AppResponse, ServerKit::HttpParseResponse>(
903
944
  ctx, req->appResponse.parserState.headerParser,
904
945
  &req->appResponse, req->pool, req->method);
905
946
  }
906
947
 
907
- static ServerKit::HttpChunkedBodyParser
908
- createAppResponseChunkedBodyParser(Request *req) {
948
+ ServerKit::HttpChunkedBodyParser
949
+ Controller::createAppResponseChunkedBodyParser(Request *req) {
909
950
  return ServerKit::HttpChunkedBodyParser(
910
951
  &req->appResponse.parserState.chunkedBodyParser,
911
952
  formatAppResponseChunkedBodyParserLoggingPrefix,
912
953
  req);
913
954
  }
914
955
 
915
- static unsigned int formatAppResponseChunkedBodyParserLoggingPrefix(char *buf,
956
+ unsigned int
957
+ Controller::formatAppResponseChunkedBodyParserLoggingPrefix(char *buf,
916
958
  unsigned int bufsize, void *userData)
917
959
  {
918
960
  Request *req = static_cast<Request *>(userData);
@@ -921,13 +963,16 @@ static unsigned int formatAppResponseChunkedBodyParserLoggingPrefix(char *buf,
921
963
  static_cast<Client *>(req->client)->number);
922
964
  }
923
965
 
924
- void prepareAppResponseChunkedBodyParsing(Client *client, Request *req) {
966
+ void
967
+ Controller::prepareAppResponseChunkedBodyParsing(Client *client, Request *req) {
925
968
  P_ASSERT_EQ(req->appResponse.bodyType, AppResponse::RBT_CHUNKED);
926
969
  createAppResponseChunkedBodyParser(req).initialize();
927
970
  }
928
971
 
929
972
  void
930
- writeResponseAndMarkForTurboCaching(Client *client, Request *req, const MemoryKit::mbuf &buffer) {
973
+ Controller::writeResponseAndMarkForTurboCaching(Client *client, Request *req,
974
+ const MemoryKit::mbuf &buffer)
975
+ {
931
976
  if (OXT_LIKELY(benchmarkMode != BM_RESPONSE_BEGIN)) {
932
977
  writeResponse(client, buffer);
933
978
  }
@@ -935,7 +980,9 @@ writeResponseAndMarkForTurboCaching(Client *client, Request *req, const MemoryKi
935
980
  }
936
981
 
937
982
  void
938
- markResponsePartForTurboCaching(Client *client, Request *req, const MemoryKit::mbuf &buffer) {
983
+ Controller::markResponsePartForTurboCaching(Client *client, Request *req,
984
+ const MemoryKit::mbuf &buffer)
985
+ {
939
986
  if (!req->ended() && turboCaching.isEnabled() && !req->cacheKey.empty()) {
940
987
  unsigned int totalSize = req->appResponse.bodyCacheBuffer.size + buffer.size();
941
988
  if (totalSize > ResponseCache<Request>::MAX_BODY_SIZE) {
@@ -954,7 +1001,7 @@ markResponsePartForTurboCaching(Client *client, Request *req, const MemoryKit::m
954
1001
  }
955
1002
 
956
1003
  void
957
- maybeThrottleAppSource(Client *client, Request *req) {
1004
+ Controller::maybeThrottleAppSource(Client *client, Request *req) {
958
1005
  if (!req->ended()) {
959
1006
  assert(client->output.getBuffersFlushedCallback() == NULL);
960
1007
  assert(client->output.getDataFlushedCallback() == getClientOutputDataFlushedCallback());
@@ -975,20 +1022,20 @@ maybeThrottleAppSource(Client *client, Request *req) {
975
1022
  }
976
1023
  }
977
1024
 
978
- static void
979
- _outputBuffersFlushed(FileBufferedChannel *_channel) {
1025
+ void
1026
+ Controller::_outputBuffersFlushed(FileBufferedChannel *_channel) {
980
1027
  FileBufferedFdSinkChannel *channel = reinterpret_cast<FileBufferedFdSinkChannel *>(_channel);
981
1028
  Client *client = static_cast<Client *>(static_cast<
982
1029
  ServerKit::BaseClient *>(channel->getHooks()->userData));
983
1030
  Request *req = static_cast<Request *>(client->currentRequest);
984
- RequestHandler *self = static_cast<RequestHandler *>(getServerFromClient(client));
1031
+ Controller *self = static_cast<Controller *>(getServerFromClient(client));
985
1032
  if (client->connected() && req != NULL) {
986
1033
  self->outputBuffersFlushed(client, req);
987
1034
  }
988
1035
  }
989
1036
 
990
1037
  void
991
- outputBuffersFlushed(Client *client, Request *req) {
1038
+ Controller::outputBuffersFlushed(Client *client, Request *req) {
992
1039
  if (!req->ended()) {
993
1040
  assert(!req->appSource.isStarted());
994
1041
  SKC_TRACE(client, 2, "Buffered response data has been written to disk. Resuming application socket");
@@ -997,13 +1044,13 @@ outputBuffersFlushed(Client *client, Request *req) {
997
1044
  }
998
1045
  }
999
1046
 
1000
- static void
1001
- _outputDataFlushed(FileBufferedChannel *_channel) {
1047
+ void
1048
+ Controller::_outputDataFlushed(FileBufferedChannel *_channel) {
1002
1049
  FileBufferedFdSinkChannel *channel = reinterpret_cast<FileBufferedFdSinkChannel *>(_channel);
1003
1050
  Client *client = static_cast<Client *>(static_cast<
1004
1051
  ServerKit::BaseClient *>(channel->getHooks()->userData));
1005
1052
  Request *req = static_cast<Request *>(client->currentRequest);
1006
- RequestHandler *self = static_cast<RequestHandler *>(getServerFromClient(client));
1053
+ Controller *self = static_cast<Controller *>(getServerFromClient(client));
1007
1054
 
1008
1055
  getClientOutputDataFlushedCallback()(_channel);
1009
1056
  if (client->connected() && req != NULL) {
@@ -1012,7 +1059,7 @@ _outputDataFlushed(FileBufferedChannel *_channel) {
1012
1059
  }
1013
1060
 
1014
1061
  void
1015
- outputDataFlushed(Client *client, Request *req) {
1062
+ Controller::outputDataFlushed(Client *client, Request *req) {
1016
1063
  if (!req->ended()) {
1017
1064
  assert(!req->appSource.isStarted());
1018
1065
  SKC_TRACE(client, 2, "The client is ready to receive more data. Resuming application socket");
@@ -1022,7 +1069,7 @@ outputDataFlushed(Client *client, Request *req) {
1022
1069
  }
1023
1070
 
1024
1071
  void
1025
- handleAppResponseBodyEnd(Client *client, Request *req) {
1072
+ Controller::handleAppResponseBodyEnd(Client *client, Request *req) {
1026
1073
  keepAliveAppConnection(client, req);
1027
1074
  storeAppResponseInTurboCache(client, req);
1028
1075
  finalizeUnionStationWithSuccess(client, req);
@@ -1030,12 +1077,12 @@ handleAppResponseBodyEnd(Client *client, Request *req) {
1030
1077
  }
1031
1078
 
1032
1079
  OXT_FORCE_INLINE void
1033
- keepAliveAppConnection(Client *client, Request *req) {
1080
+ Controller::keepAliveAppConnection(Client *client, Request *req) {
1034
1081
  req->session->close(true, req->appResponse.wantKeepAlive);
1035
1082
  }
1036
1083
 
1037
1084
  void
1038
- storeAppResponseInTurboCache(Client *client, Request *req) {
1085
+ Controller::storeAppResponseInTurboCache(Client *client, Request *req) {
1039
1086
  if (turboCaching.isEnabled() && !req->cacheKey.empty()) {
1040
1087
  TRACE_POINT();
1041
1088
  AppResponse *resp = &req->appResponse;
@@ -1072,7 +1119,11 @@ storeAppResponseInTurboCache(Client *client, Request *req) {
1072
1119
  }
1073
1120
 
1074
1121
  void
1075
- finalizeUnionStationWithSuccess(Client *client, Request *req) {
1076
- req->endStopwatchLog(&req->stopwatchLogs.requestProcessing, true);
1122
+ Controller::finalizeUnionStationWithSuccess(Client *client, Request *req) {
1077
1123
  req->endStopwatchLog(&req->stopwatchLogs.requestProxying, true);
1124
+ req->endStopwatchLog(&req->stopwatchLogs.requestProcessing, true);
1078
1125
  }
1126
+
1127
+
1128
+ } // namespace Core
1129
+ } // namespace Passenger