passenger 3.9.2.beta → 4.0.0.rc4

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 (159) hide show
  1. data/.travis.yml +3 -0
  2. data/NEWS +77 -7
  3. data/README.md +3 -11
  4. data/bin/passenger-install-apache2-module +24 -20
  5. data/bin/passenger-install-nginx-module +25 -23
  6. data/build/agents.rb +11 -0
  7. data/build/apache2.rb +9 -5
  8. data/build/basics.rb +37 -30
  9. data/build/common_library.rb +4 -1
  10. data/build/cplusplus_support.rb +5 -5
  11. data/build/cxx_tests.rb +28 -8
  12. data/build/integration_tests.rb +6 -3
  13. data/build/nginx.rb +3 -3
  14. data/build/packaging.rb +95 -57
  15. data/build/ruby_extension.rb +34 -21
  16. data/build/ruby_tests.rb +4 -2
  17. data/build/test_basics.rb +1 -1
  18. data/dev/run_travis.sh +36 -1
  19. data/doc/Users guide Apache.html +425 -308
  20. data/doc/Users guide Apache.idmap.txt +78 -70
  21. data/doc/Users guide Apache.index.sqlite3 +0 -0
  22. data/doc/Users guide Apache.txt +33 -92
  23. data/doc/Users guide Nginx.html +519 -220
  24. data/doc/Users guide Nginx.idmap.txt +78 -60
  25. data/doc/Users guide Nginx.txt +115 -26
  26. data/doc/Users guide Standalone.html +8 -2
  27. data/doc/users_guide_snippets/analysis_and_system_maintenance.txt +1 -7
  28. data/doc/users_guide_snippets/installation.txt +167 -22
  29. data/doc/users_guide_snippets/rackup_specifications.txt +4 -0
  30. data/doc/users_guide_snippets/since_version.txt +1 -0
  31. data/doc/users_guide_snippets/support_information.txt +3 -7
  32. data/doc/users_guide_snippets/tips.txt +0 -24
  33. data/ext/apache2/Configuration.cpp +11 -33
  34. data/ext/apache2/Configuration.hpp +3 -18
  35. data/ext/apache2/DirectoryMapper.h +20 -70
  36. data/ext/apache2/Hooks.cpp +2 -2
  37. data/ext/common/AgentsStarter.cpp +0 -2
  38. data/ext/common/AgentsStarter.h +0 -1
  39. data/ext/common/AgentsStarter.hpp +1 -3
  40. data/ext/common/ApplicationPool2/AppTypes.cpp +74 -0
  41. data/ext/common/ApplicationPool2/AppTypes.h +202 -0
  42. data/ext/common/ApplicationPool2/Common.h +12 -10
  43. data/ext/common/ApplicationPool2/DirectSpawner.h +256 -0
  44. data/ext/common/ApplicationPool2/DummySpawner.h +90 -0
  45. data/ext/common/ApplicationPool2/Group.h +311 -94
  46. data/ext/common/ApplicationPool2/Implementation.cpp +405 -145
  47. data/ext/common/ApplicationPool2/Options.h +24 -26
  48. data/ext/common/ApplicationPool2/PipeWatcher.h +20 -13
  49. data/ext/common/ApplicationPool2/Pool.h +326 -183
  50. data/ext/common/ApplicationPool2/Process.h +205 -55
  51. data/ext/common/ApplicationPool2/README.md +1 -1
  52. data/ext/common/ApplicationPool2/Session.h +21 -10
  53. data/ext/common/ApplicationPool2/SmartSpawner.h +801 -0
  54. data/ext/common/ApplicationPool2/Spawner.h +141 -1149
  55. data/ext/common/ApplicationPool2/SpawnerFactory.h +132 -0
  56. data/ext/common/ApplicationPool2/SuperGroup.h +146 -223
  57. data/ext/common/Constants.h +4 -2
  58. data/ext/common/Exceptions.h +23 -1
  59. data/ext/common/Logging.cpp +17 -6
  60. data/ext/common/Logging.h +37 -7
  61. data/ext/common/ResourceLocator.h +1 -1
  62. data/ext/common/Utils.cpp +49 -1
  63. data/ext/common/Utils.h +13 -4
  64. data/ext/common/{AnsiColorConstants.h → Utils/AnsiColorConstants.h} +0 -0
  65. data/ext/common/{BCrypt.cpp → Utils/BCrypt.cpp} +0 -0
  66. data/ext/common/{BCrypt.h → Utils/BCrypt.h} +0 -0
  67. data/ext/common/{Blowfish.c → Utils/Blowfish.c} +0 -0
  68. data/ext/common/{Blowfish.h → Utils/Blowfish.h} +0 -0
  69. data/ext/common/Utils/CachedFileStat.hpp +27 -25
  70. data/ext/common/Utils/Curl.h +184 -0
  71. data/ext/common/{HttpConstants.h → Utils/HttpConstants.h} +3 -0
  72. data/ext/common/Utils/IOUtils.cpp +6 -2
  73. data/ext/common/{IniFile.h → Utils/IniFile.h} +0 -0
  74. data/ext/common/Utils/LargeFiles.cpp +30 -0
  75. data/ext/common/Utils/LargeFiles.h +40 -0
  76. data/ext/common/Utils/StrIntUtils.cpp +72 -8
  77. data/ext/common/Utils/StrIntUtils.h +24 -2
  78. data/ext/common/Utils/StringMap.h +12 -2
  79. data/ext/common/Utils/VariantMap.h +51 -2
  80. data/ext/common/Utils/jsoncpp.cpp +1 -1
  81. data/ext/common/agents/Base.cpp +147 -11
  82. data/ext/common/agents/HelperAgent/AgentOptions.h +14 -6
  83. data/ext/common/agents/HelperAgent/Main.cpp +79 -19
  84. data/ext/common/agents/HelperAgent/RequestHandler.h +36 -16
  85. data/ext/common/agents/LoggingAgent/LoggingServer.h +3 -5
  86. data/ext/common/agents/LoggingAgent/Main.cpp +2 -4
  87. data/ext/common/agents/LoggingAgent/RemoteSender.h +18 -24
  88. data/ext/common/agents/SpawnPreparer.cpp +7 -0
  89. data/ext/common/agents/Watchdog/Main.cpp +96 -38
  90. data/ext/nginx/Configuration.c +26 -22
  91. data/ext/nginx/Configuration.h +4 -2
  92. data/ext/nginx/ContentHandler.c +23 -52
  93. data/ext/nginx/ContentHandler.h +5 -11
  94. data/ext/nginx/config +10 -3
  95. data/ext/nginx/ngx_http_passenger_module.c +21 -6
  96. data/ext/nginx/ngx_http_passenger_module.h +4 -1
  97. data/ext/oxt/dynamic_thread_group.hpp +9 -1
  98. data/ext/oxt/system_calls.cpp +2 -2
  99. data/ext/ruby/extconf.rb +2 -1
  100. data/helper-scripts/backtrace-sanitizer.rb +2 -0
  101. data/helper-scripts/wsgi-loader.py +54 -21
  102. data/lib/phusion_passenger.rb +5 -3
  103. data/lib/phusion_passenger/abstract_installer.rb +18 -41
  104. data/lib/phusion_passenger/admin_tools/memory_stats.rb +2 -2
  105. data/lib/phusion_passenger/admin_tools/server_instance.rb +2 -2
  106. data/lib/phusion_passenger/common_library.rb +23 -3
  107. data/lib/phusion_passenger/debug_logging.rb +10 -3
  108. data/lib/phusion_passenger/packaging.rb +1 -0
  109. data/lib/phusion_passenger/platform_info.rb +113 -115
  110. data/lib/phusion_passenger/platform_info/compiler.rb +224 -134
  111. data/lib/phusion_passenger/platform_info/cxx_portability.rb +143 -0
  112. data/lib/phusion_passenger/platform_info/depcheck.rb +371 -0
  113. data/lib/phusion_passenger/platform_info/depcheck_specs/apache2.rb +124 -0
  114. data/lib/phusion_passenger/platform_info/depcheck_specs/compiler_toolchain.rb +97 -0
  115. data/lib/phusion_passenger/platform_info/depcheck_specs/gems.rb +39 -0
  116. data/lib/phusion_passenger/platform_info/depcheck_specs/libs.rb +118 -0
  117. data/lib/phusion_passenger/platform_info/depcheck_specs/ruby.rb +137 -0
  118. data/lib/phusion_passenger/platform_info/depcheck_specs/utilities.rb +15 -0
  119. data/lib/phusion_passenger/platform_info/operating_system.rb +6 -5
  120. data/lib/phusion_passenger/platform_info/ruby.rb +45 -34
  121. data/lib/phusion_passenger/request_handler.rb +35 -22
  122. data/lib/phusion_passenger/request_handler/thread_handler.rb +5 -6
  123. data/lib/phusion_passenger/ruby_core_enhancements.rb +7 -1
  124. data/lib/phusion_passenger/standalone/runtime_installer.rb +43 -34
  125. data/lib/phusion_passenger/utils/robust_interruption.rb +34 -18
  126. data/passenger.gemspec +25 -0
  127. data/resources/templates/standalone/config.erb +3 -1
  128. data/test/config.json.travis +2 -2
  129. data/test/cxx/ApplicationPool2/DirectSpawnerTest.cpp +37 -5
  130. data/test/cxx/ApplicationPool2/PoolTest.cpp +143 -50
  131. data/test/cxx/ApplicationPool2/ProcessTest.cpp +8 -0
  132. data/test/cxx/ApplicationPool2/SmartSpawnerTest.cpp +28 -17
  133. data/test/cxx/ApplicationPool2/SpawnerTestCases.cpp +31 -26
  134. data/test/cxx/RequestHandlerTest.cpp +17 -1
  135. data/test/cxx/UtilsTest.cpp +84 -10
  136. data/test/integration_tests/apache2_tests.rb +49 -163
  137. data/test/integration_tests/hello_world_wsgi_spec.rb +2 -2
  138. data/test/integration_tests/mycook_spec.rb +1 -1
  139. data/test/integration_tests/nginx_tests.rb +37 -19
  140. data/test/ruby/request_handler_spec.rb +1 -0
  141. data/test/ruby/spec_helper.rb +52 -1
  142. data/test/stub/nginx/nginx.conf.erb +2 -0
  143. data/test/stub/rack/start.rb +5 -0
  144. data/test/stub/rails3.0/Gemfile.lock +30 -30
  145. data/test/stub/rails3.1/Gemfile +1 -1
  146. data/test/stub/rails3.1/Gemfile.lock +3 -3
  147. data/test/stub/rails3.2/Gemfile +1 -1
  148. data/test/stub/rails3.2/Gemfile.lock +4 -4
  149. data/test/stub/rails_apps/2.3/mycook/app/controllers/welcome_controller.rb +1 -1
  150. data/test/stub/rails_apps/2.3/mycook/app/helpers/recipes_helper.rb +2 -0
  151. data/test/stub/rails_apps/2.3/mycook/app/helpers/test_helper.rb +2 -0
  152. data/test/stub/rails_apps/2.3/mycook/app/helpers/uploads_helper.rb +2 -0
  153. data/test/stub/rails_apps/2.3/mycook/app/helpers/welcome_helper.rb +2 -0
  154. data/test/support/nginx_controller.rb +2 -1
  155. metadata +160 -156
  156. data/build/gempackagetask.rb +0 -99
  157. data/build/packagetask.rb +0 -186
  158. data/ext/common/StringListCreator.h +0 -83
  159. data/lib/phusion_passenger/dependencies.rb +0 -657
@@ -65,6 +65,10 @@ run Ramaze::Adapter::Base
65
65
  ------------------------------------------------------
66
66
  require 'rubygems'
67
67
  require 'sinatra'
68
+
69
+ set :environment, ENV['RACK_ENV'].to_sym
70
+ disable :run, :reload
71
+
68
72
  require 'app.rb'
69
73
 
70
74
  run Sinatra::Application
@@ -0,0 +1 @@
1
+ **Introduced in version {version}.**
@@ -5,13 +5,8 @@ words: practically any operating system on earth, except Microsoft Windows.
5
5
 
6
6
  Phusion Passenger is confirmed on a large number of operating systems and Linux
7
7
  distributions, including, but not limited to, Ubuntu, Debian, CentOS/Fedora/RHEL,
8
- Gentoo, Mac OS X, FreeBSD and Solaris. Both 32-bit and 64-bit platforms are supported.
9
-
10
- ifdef::apache[]
11
- The only POSIX-compliant operating system on which Phusion Passenger for Apache is
12
- known not to work at this time, is OpenBSD. Please use Phusion Passenger for Nginx
13
- or Phusion Passenger Standalone instead.
14
- endif::[]
8
+ Gentoo, Mac OS X, FreeBSD and Solaris. OpenBSD is supported since version 5.2.
9
+ Both 32-bit and 64-bit platforms are supported.
15
10
 
16
11
  Please
17
12
  link:http://code.google.com/p/phusion-passenger/issues/list[report a bug]
@@ -27,5 +22,6 @@ if it doesn't work on your POSIX-compliant operating system.
27
22
  message here if you're experiencing problems. Support on this forum is provided by the community on a best-effort basis, so a (timely) response is not guaranteed.
28
23
  * Email support@phusion.nl if you are a link:https://www.phusionpassenger.com/enterprise[Phusion Passenger Enterprise] customer. Please mention your order reference. If you are not an Enterprise customer, we kindly redirect you to the community discussion forum instead.
29
24
  * link:https://www.phusionpassenger.com/commercial_support[Commercial support contracts] are also available.
25
+ * Report security vulnerabilities to support@phusion.nl. We will do our best to respond to you as quickly as we can, so please do not disclose the vulnerability until then.
30
26
 
31
27
  Please consult link:https://www.phusionpassenger.com/support[the Phusion Passenger website] for a full list of support resources.
@@ -109,30 +109,6 @@ you can override Phusion Passenger's Bundler support code by creating a file
109
109
  the application startup file. In this file you can do whatever you need to setup Bundler
110
110
  or a similar system.
111
111
 
112
-
113
- [[moving_phusion_passenger]]
114
- === Moving Phusion Passenger to a different directory ===
115
-
116
- It is possible to relocate the Phusion Passenger files to a different directory. It
117
- involves two steps:
118
-
119
- 1. Moving the directory.
120
- 2. Updating the ``PassengerRoot'' configuration option in Apache.
121
-
122
- For example, if Phusion Passenger is located in '/opt/passenger/', and you'd like to
123
- move it to '/usr/local/passenger/', then do this:
124
-
125
- 1. Run the following command:
126
- +
127
- ------------------------------------
128
- mv /opt/passenger /usr/local/passenger
129
- ------------------------------------
130
- 2. Edit your Apache configuration file, and set:
131
- +
132
- ------------------------------------
133
- PassengerRoot /usr/local/passenger
134
- ------------------------------------
135
-
136
112
  === Installing multiple Ruby on Rails versions ===
137
113
 
138
114
  Each Ruby on Rails applications that are going to be deployed may require a
@@ -1,6 +1,6 @@
1
1
  /*
2
2
  * Phusion Passenger - https://www.phusionpassenger.com/
3
- * Copyright (c) 2010, 2011, 2012 Phusion
3
+ * Copyright (c) 2010-2013 Phusion
4
4
  *
5
5
  * "Phusion Passenger" is a trademark of Hongli Lai & Ninh Bui.
6
6
  *
@@ -186,10 +186,8 @@ void *
186
186
  passenger_config_create_dir(apr_pool_t *p, char *dirspec) {
187
187
  DirConfig *config = create_dir_config_struct(p);
188
188
  config->enabled = DirConfig::UNSET;
189
- config->autoDetectRails = DirConfig::UNSET;
190
- config->autoDetectRack = DirConfig::UNSET;
191
- config->autoDetectWSGI = DirConfig::UNSET;
192
189
  config->ruby = NULL;
190
+ config->python = NULL;
193
191
  config->environment = NULL;
194
192
  config->appRoot = NULL;
195
193
  config->user = NULL;
@@ -231,10 +229,8 @@ passenger_config_merge_dir(apr_pool_t *p, void *basev, void *addv) {
231
229
  config->rackBaseURIs.insert(*it);
232
230
  }
233
231
 
234
- MERGE_THREEWAY_CONFIG(autoDetectRails);
235
- MERGE_THREEWAY_CONFIG(autoDetectRack);
236
- MERGE_THREEWAY_CONFIG(autoDetectWSGI);
237
232
  MERGE_STR_CONFIG(ruby);
233
+ MERGE_STR_CONFIG(python);
238
234
  MERGE_STR_CONFIG(environment);
239
235
  MERGE_STR_CONFIG(appRoot);
240
236
  MERGE_STRING_CONFIG(appGroupName);
@@ -283,7 +279,6 @@ DEFINE_SERVER_STR_CONFIG_SETTER(cmd_union_station_gateway_address, unionStationG
283
279
  DEFINE_SERVER_INT_CONFIG_SETTER(cmd_union_station_gateway_port, unionStationGatewayPort, int, 1)
284
280
  DEFINE_SERVER_STR_CONFIG_SETTER(cmd_union_station_gateway_cert, unionStationGatewayCert)
285
281
  DEFINE_SERVER_STR_CONFIG_SETTER(cmd_union_station_proxy_address, unionStationProxyAddress)
286
- DEFINE_SERVER_STR_CONFIG_SETTER(cmd_union_station_proxy_type, unionStationProxyType)
287
282
  DEFINE_SERVER_STR_CONFIG_SETTER(cmd_passenger_analytics_log_user, analyticsLogUser)
288
283
  DEFINE_SERVER_STR_CONFIG_SETTER(cmd_passenger_analytics_log_group, analyticsLogGroup)
289
284
 
@@ -298,6 +293,7 @@ DEFINE_DIR_INT_CONFIG_SETTER(cmd_passenger_max_requests, maxRequests, unsigned l
298
293
  DEFINE_DIR_THREEWAY_CONFIG_SETTER(cmd_passenger_high_performance, highPerformance)
299
294
  DEFINE_DIR_THREEWAY_CONFIG_SETTER(cmd_passenger_enabled, enabled)
300
295
  DEFINE_DIR_STR_CONFIG_SETTER(cmd_passenger_ruby, ruby)
296
+ DEFINE_DIR_STR_CONFIG_SETTER(cmd_passenger_python, python)
301
297
  DEFINE_DIR_STR_CONFIG_SETTER(cmd_environment, environment)
302
298
  DEFINE_DIR_INT_CONFIG_SETTER(cmd_passenger_stat_throttle_rate, statThrottleRate, unsigned long, 0)
303
299
  DEFINE_DIR_STR_CONFIG_SETTER(cmd_passenger_app_root, appRoot)
@@ -373,8 +369,6 @@ cmd_rails_base_uri(cmd_parms *cmd, void *pcfg, const char *arg) {
373
369
  }
374
370
  }
375
371
 
376
- DEFINE_DIR_THREEWAY_CONFIG_SETTER(cmd_rails_auto_detect, autoDetectRails)
377
-
378
372
 
379
373
 
380
374
  static const char *
@@ -414,14 +408,12 @@ cmd_rack_base_uri(cmd_parms *cmd, void *pcfg, const char *arg) {
414
408
  }
415
409
  }
416
410
 
417
- DEFINE_DIR_THREEWAY_CONFIG_SETTER(cmd_rack_auto_detect, autoDetectRack)
418
-
419
411
 
420
412
  /*************************************************
421
413
  * WSGI-specific settings
422
414
  *************************************************/
423
415
 
424
- DEFINE_DIR_THREEWAY_CONFIG_SETTER(cmd_wsgi_auto_detect, autoDetectWSGI)
416
+ // none
425
417
 
426
418
 
427
419
  /*************************************************
@@ -479,6 +471,11 @@ const command_rec passenger_commands[] = {
479
471
  NULL,
480
472
  OR_OPTIONS | ACCESS_CONF | RSRC_CONF,
481
473
  "The Ruby interpreter to use."),
474
+ AP_INIT_TAKE1("PassengerPython",
475
+ (Take1Func) cmd_passenger_python,
476
+ NULL,
477
+ OR_OPTIONS | ACCESS_CONF | RSRC_CONF,
478
+ "The Python interpreter to use."),
482
479
  AP_INIT_TAKE1("PassengerLogLevel",
483
480
  (Take1Func) cmd_passenger_log_level,
484
481
  NULL,
@@ -639,11 +636,6 @@ const command_rec passenger_commands[] = {
639
636
  NULL,
640
637
  RSRC_CONF,
641
638
  "The address of the proxy that should be used for sending data to Union Station."),
642
- AP_INIT_TAKE1("UnionStationProxyType",
643
- (Take1Func) cmd_union_station_proxy_type,
644
- NULL,
645
- RSRC_CONF,
646
- "The type of the proxy that should be used for sending data to Union Station."),
647
639
  AP_INIT_TAKE1("PassengerAnalyticsLogUser",
648
640
  (Take1Func) cmd_passenger_analytics_log_user,
649
641
  NULL,
@@ -713,11 +705,6 @@ const command_rec passenger_commands[] = {
713
705
  NULL,
714
706
  OR_OPTIONS | ACCESS_CONF | RSRC_CONF,
715
707
  "Reserve the given URI to a Rails application."),
716
- AP_INIT_FLAG("RailsAutoDetect",
717
- (FlagFunc) cmd_rails_auto_detect,
718
- NULL,
719
- RSRC_CONF,
720
- "Whether auto-detection of Ruby on Rails applications should be enabled."),
721
708
  AP_INIT_TAKE1("RailsEnv",
722
709
  (Take1Func) cmd_environment,
723
710
  NULL,
@@ -730,11 +717,6 @@ const command_rec passenger_commands[] = {
730
717
  NULL,
731
718
  OR_OPTIONS | ACCESS_CONF | RSRC_CONF,
732
719
  "Reserve the given URI to a Rack application."),
733
- AP_INIT_FLAG("RackAutoDetect",
734
- (FlagFunc) cmd_rack_auto_detect,
735
- NULL,
736
- RSRC_CONF,
737
- "Whether auto-detection of Rack applications should be enabled."),
738
720
  AP_INIT_TAKE1("RackEnv",
739
721
  (Take1Func) cmd_environment,
740
722
  NULL,
@@ -742,11 +724,7 @@ const command_rec passenger_commands[] = {
742
724
  "The environment under which a Rack app must run."),
743
725
 
744
726
  // WSGI-specific settings.
745
- AP_INIT_FLAG("PassengerWSGIAutoDetect",
746
- (FlagFunc) cmd_wsgi_auto_detect,
747
- NULL,
748
- RSRC_CONF,
749
- "Whether auto-detection of WSGI applications should be enabled."),
727
+ // none
750
728
 
751
729
  // Backwards compatibility options.
752
730
  AP_INIT_TAKE1("RailsRuby",
@@ -68,17 +68,11 @@ struct DirConfig {
68
68
  std::set<std::string> railsBaseURIs;
69
69
  std::set<std::string> rackBaseURIs;
70
70
 
71
- /** Whether to autodetect Rails applications. */
72
- Threeway autoDetectRails;
73
-
74
- /** Whether to autodetect Rack applications. */
75
- Threeway autoDetectRack;
76
-
77
- /** Whether to autodetect WSGI applications. */
78
- Threeway autoDetectWSGI;
79
-
80
71
  /** The Ruby interpreter to use. */
81
72
  const char *ruby;
73
+
74
+ /** The Python interpreter to use. */
75
+ const char *python;
82
76
 
83
77
  /** The environment (RAILS_ENV/RACK_ENV/WSGI_ENV) under which
84
78
  * applications should operate. */
@@ -377,7 +371,6 @@ struct ServerConfig {
377
371
  int unionStationGatewayPort;
378
372
  string unionStationGatewayCert;
379
373
  string unionStationProxyAddress;
380
- string unionStationProxyType;
381
374
 
382
375
  /** Directory in which analytics logs should be saved. */
383
376
  string analyticsLogUser;
@@ -399,7 +392,6 @@ struct ServerConfig {
399
392
  unionStationGatewayPort = DEFAULT_UNION_STATION_GATEWAY_PORT;
400
393
  unionStationGatewayCert = string();
401
394
  unionStationProxyAddress = string();
402
- unionStationProxyType = string();
403
395
  analyticsLogUser = DEFAULT_ANALYTICS_LOG_USER;
404
396
  analyticsLogGroup = DEFAULT_ANALYTICS_LOG_GROUP;
405
397
  }
@@ -427,13 +419,6 @@ struct ServerConfig {
427
419
 
428
420
  defaultGroup = groupEntry->gr_name;
429
421
  }
430
-
431
- if (unionStationProxyType != ""
432
- && unionStationProxyType != "http"
433
- && unionStationProxyType != "socks5") {
434
- throw ConfigurationException(string("The option 'UnionStationProxyType' ") +
435
- "may only be set to 'http' or 'socks5'.");
436
- }
437
422
  }
438
423
  };
439
424
 
@@ -32,8 +32,9 @@
32
32
  #include <oxt/backtrace.hpp>
33
33
 
34
34
  #include "Configuration.hpp"
35
- #include "Utils.h"
36
- #include "Utils/CachedFileStat.hpp"
35
+ #include <ApplicationPool2/AppTypes.h>
36
+ #include <Utils.h>
37
+ #include <Utils/CachedFileStat.hpp>
37
38
 
38
39
  // The Apache/APR headers *must* come after the Boost headers, otherwise
39
40
  // compilation will fail on OpenBSD.
@@ -44,6 +45,7 @@ namespace Passenger {
44
45
 
45
46
  using namespace std;
46
47
  using namespace oxt;
48
+ using namespace Passenger::ApplicationPool2;
47
49
 
48
50
  /**
49
51
  * Utility class for determining URI-to-application directory mappings.
@@ -55,14 +57,6 @@ using namespace oxt;
55
57
  * @ingroup Core
56
58
  */
57
59
  class DirectoryMapper {
58
- public:
59
- enum ApplicationType {
60
- NONE,
61
- CLASSIC_RAILS,
62
- RACK,
63
- WSGI
64
- };
65
-
66
60
  private:
67
61
  DirConfig *config;
68
62
  request_rec *r;
@@ -70,22 +64,7 @@ private:
70
64
  unsigned int throttleRate;
71
65
  bool baseURIKnown;
72
66
  const char *baseURI;
73
- ApplicationType appType;
74
-
75
- inline bool shouldAutoDetectClassicRails() {
76
- return config->autoDetectRails == DirConfig::ENABLED ||
77
- config->autoDetectRails == DirConfig::UNSET;
78
- }
79
-
80
- inline bool shouldAutoDetectRack() {
81
- return config->autoDetectRack == DirConfig::ENABLED ||
82
- config->autoDetectRack == DirConfig::UNSET;
83
- }
84
-
85
- inline bool shouldAutoDetectWSGI() {
86
- return config->autoDetectWSGI == DirConfig::ENABLED ||
87
- config->autoDetectWSGI == DirConfig::UNSET;
88
- }
67
+ PassengerAppType appType;
89
68
 
90
69
  public:
91
70
  /**
@@ -102,7 +81,7 @@ public:
102
81
  this->config = config;
103
82
  this->cstat = cstat;
104
83
  this->throttleRate = throttleRate;
105
- appType = NONE;
84
+ appType = PAT_NONE;
106
85
  baseURIKnown = false;
107
86
  baseURI = NULL;
108
87
  }
@@ -112,9 +91,8 @@ public:
112
91
  * RailsBaseURIs or RackBaseURIs. If yes, then the first matching base URI will
113
92
  * be returned.
114
93
  *
115
- * If Rails/Rack autodetection was enabled in the configuration, and the document
116
- * root seems to be a valid Rails/Rack 'public' folder, then this method will
117
- * return "/".
94
+ * If the document root seems to be a valid application 'public' folder, then this
95
+ * method will return "/".
118
96
  *
119
97
  * Otherwise, NULL will be returned.
120
98
  *
@@ -149,7 +127,7 @@ public:
149
127
  ) {
150
128
  baseURIKnown = true;
151
129
  baseURI = base.c_str();
152
- appType = CLASSIC_RAILS;
130
+ appType = PAT_CLASSIC_RAILS;
153
131
  return baseURI;
154
132
  }
155
133
  }
@@ -164,40 +142,21 @@ public:
164
142
  ) {
165
143
  baseURIKnown = true;
166
144
  baseURI = base.c_str();
167
- appType = RACK;
145
+ appType = PAT_RACK;
168
146
  return baseURI;
169
147
  }
170
148
  }
171
149
 
172
150
  UPDATE_TRACE_POINT();
173
- if (shouldAutoDetectRack()
174
- && verifyRackDir(config->getAppRoot(ap_document_root(r)), cstat, throttleRate)) {
175
- baseURIKnown = true;
176
- baseURI = "/";
177
- appType = RACK;
178
- return baseURI;
179
- }
180
-
181
- UPDATE_TRACE_POINT();
182
- if (shouldAutoDetectClassicRails()
183
- && verifyRailsDir(config->getAppRoot(ap_document_root(r)), cstat, throttleRate)) {
184
- baseURIKnown = true;
185
- baseURI = "/";
186
- appType = CLASSIC_RAILS;
187
- return baseURI;
188
- }
189
-
190
- UPDATE_TRACE_POINT();
191
- if (shouldAutoDetectWSGI()
192
- && verifyWSGIDir(config->getAppRoot(ap_document_root(r)), cstat, throttleRate)) {
193
- baseURIKnown = true;
151
+ baseURIKnown = true;
152
+ AppTypeDetector detector(cstat, throttleRate);
153
+ appType = detector.checkAppRoot(config->getAppRoot(ap_document_root(r)));
154
+ if (appType != PAT_NONE) {
194
155
  baseURI = "/";
195
- appType = WSGI;
196
- return baseURI;
156
+ } else {
157
+ baseURI = NULL;
197
158
  }
198
-
199
- baseURIKnown = true;
200
- return NULL;
159
+ return baseURI;
201
160
  }
202
161
 
203
162
  /**
@@ -244,7 +203,7 @@ public:
244
203
  *
245
204
  * @throws FileSystemException An error occured while examening the filesystem.
246
205
  */
247
- ApplicationType getApplicationType() {
206
+ PassengerAppType getApplicationType() {
248
207
  if (!baseURIKnown) {
249
208
  getBaseURI();
250
209
  }
@@ -257,20 +216,11 @@ public:
257
216
  *
258
217
  * @throws FileSystemException An error occured while examening the filesystem.
259
218
  */
260
- const char *getApplicationTypeString() {
219
+ const char *getApplicationTypeName() {
261
220
  if (!baseURIKnown) {
262
221
  getBaseURI();
263
222
  }
264
- switch (appType) {
265
- case CLASSIC_RAILS:
266
- return "classic-rails";
267
- case RACK:
268
- return "rack";
269
- case WSGI:
270
- return "wsgi";
271
- default:
272
- return NULL;
273
- };
223
+ return getAppTypeName(appType);
274
224
  }
275
225
  };
276
226
 
@@ -956,11 +956,12 @@ private:
956
956
  addHeader(output, "PASSENGER_APP_ROOT", appRoot);
957
957
  addHeader(output, "PASSENGER_APP_GROUP_NAME", config->getAppGroupName(appRoot));
958
958
  addHeader(output, "PASSENGER_RUBY", config->ruby);
959
+ addHeader(output, "PASSENGER_PYTHON", config->python);
959
960
  addHeader(output, "PASSENGER_ENV", config->getEnvironment());
960
961
  addHeader(output, "PASSENGER_SPAWN_METHOD", config->getSpawnMethodString());
961
962
  addHeader(output, "PASSENGER_USER", config->getUser());
962
963
  addHeader(output, "PASSENGER_GROUP", config->getGroup());
963
- addHeader(output, "PASSENGER_APP_TYPE", mapper.getApplicationTypeString());
964
+ addHeader(output, "PASSENGER_APP_TYPE", mapper.getApplicationTypeName());
964
965
  addHeader(output, "PASSENGER_MIN_INSTANCES",
965
966
  apr_psprintf(r->pool, "%ld", config->getMinInstances()));
966
967
  addHeader(output, "PASSENGER_MAX_PRELOADER_IDLE_TIME",
@@ -1273,7 +1274,6 @@ public:
1273
1274
  serverConfig.unionStationGatewayPort,
1274
1275
  serverConfig.unionStationGatewayCert,
1275
1276
  serverConfig.unionStationProxyAddress,
1276
- serverConfig.unionStationProxyType,
1277
1277
  serverConfig.prestartURLs);
1278
1278
 
1279
1279
  // Store some relevant information in the generation directory.
@@ -62,7 +62,6 @@ agents_starter_start(AgentsStarter *as,
62
62
  unsigned short unionStationGatewayPort,
63
63
  const char *unionStationGatewayCert,
64
64
  const char *unionStationProxyAddress,
65
- const char *unionStationProxyType,
66
65
  const char **prestartURLs, unsigned int prestartURLsCount,
67
66
  const AfterForkCallback afterFork,
68
67
  void *callbackArgument,
@@ -93,7 +92,6 @@ agents_starter_start(AgentsStarter *as,
93
92
  unionStationGatewayPort,
94
93
  unionStationGatewayCert,
95
94
  unionStationProxyAddress,
96
- unionStationProxyType,
97
95
  setOfprestartURLs,
98
96
  afterForkFunctionObject);
99
97
  return 1;