passenger 4.0.10 → 4.0.13

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 (224) hide show
  1. data.tar.gz.asc +7 -7
  2. data/.gitignore +66 -0
  3. data/.travis.yml +2 -5
  4. data/CONTRIBUTORS +2 -1
  5. data/NEWS +24 -0
  6. data/README.md +5 -10
  7. data/bin/passenger +1 -0
  8. data/bin/passenger-config +29 -3
  9. data/bin/passenger-install-nginx-module +1 -1
  10. data/build/basics.rb +8 -2
  11. data/build/debian.rb +22 -0
  12. data/build/integration_tests.rb +16 -2
  13. data/build/misc.rb +3 -0
  14. data/build/packaging.rb +77 -29
  15. data/build/preprocessor.rb +13 -10
  16. data/build/test_basics.rb +6 -0
  17. data/debian.template/locations.ini.template +13 -0
  18. data/debian.template/ruby-passenger-dev.install.template +3 -0
  19. data/debian.template/ruby-passenger-doc.install.template +2 -0
  20. data/debian.template/ruby-passenger.install.template +12 -0
  21. data/debian.template/rules.template +1 -0
  22. data/dev/run_travis.sh +46 -14
  23. data/doc/Architectural overview.html +25 -34
  24. data/doc/Packaging.html +31 -23
  25. data/doc/Packaging.txt.md +32 -23
  26. data/doc/Security of user switching support.html +16 -18
  27. data/doc/Users guide Apache.html +231 -239
  28. data/doc/Users guide Nginx.html +219 -227
  29. data/doc/Users guide Standalone.html +12 -15
  30. data/doc/users_guide_snippets/installation.txt +3 -2
  31. data/ext/common/ApplicationPool2/Implementation.cpp +6 -16
  32. data/ext/common/Constants.h +1 -1
  33. data/ext/common/ResourceLocator.h +6 -6
  34. data/ext/common/UnionStation.h +11 -15
  35. data/ext/common/Utils/ProcessMetricsCollector.h +7 -4
  36. data/ext/common/agents/HelperAgent/AgentOptions.h +6 -0
  37. data/ext/common/agents/HelperAgent/Main.cpp +5 -0
  38. data/ext/common/agents/HelperAgent/RequestHandler.h +9 -1
  39. data/ext/common/agents/LoggingAgent/Main.cpp +4 -0
  40. data/ext/common/agents/Watchdog/Main.cpp +7 -0
  41. data/ext/nginx/config +1 -1
  42. data/ext/oxt/Readme.txt +15 -0
  43. data/helper-scripts/download_binaries/extconf.rb +83 -0
  44. data/lib/phusion_passenger.rb +78 -80
  45. data/lib/phusion_passenger/abstract_installer.rb +22 -8
  46. data/lib/phusion_passenger/console_text_template.rb +1 -1
  47. data/lib/phusion_passenger/loader_shared_helpers.rb +2 -1
  48. data/lib/phusion_passenger/native_support.rb +22 -9
  49. data/lib/phusion_passenger/packaging.rb +7 -2
  50. data/lib/phusion_passenger/platform_info.rb +28 -1
  51. data/lib/phusion_passenger/platform_info/apache.rb +246 -26
  52. data/lib/phusion_passenger/platform_info/apache_detector.rb +232 -0
  53. data/lib/phusion_passenger/platform_info/depcheck_specs/ruby.rb +4 -0
  54. data/lib/phusion_passenger/platform_info/linux.rb +7 -0
  55. data/lib/phusion_passenger/public_api.rb +11 -2
  56. data/lib/phusion_passenger/standalone/command.rb +11 -14
  57. data/lib/phusion_passenger/standalone/runtime_installer.rb +313 -275
  58. data/lib/phusion_passenger/standalone/runtime_locator.rb +163 -0
  59. data/lib/phusion_passenger/standalone/start_command.rb +38 -46
  60. data/lib/phusion_passenger/utils/json.rb +329 -0
  61. data/lib/phusion_passenger/utils/tmpio.rb +1 -0
  62. data/passenger.gemspec +4 -0
  63. data/resources/mime.types +1 -0
  64. data/resources/oss-binaries.phusionpassenger.com.crt +84 -0
  65. data/resources/release.txt +0 -0
  66. data/resources/templates/standalone/download_tool_missing.txt.erb +18 -0
  67. data/rpm/README.rdoc +117 -0
  68. data/rpm/config/apache-passenger.conf.in +19 -0
  69. data/rpm/config/nginx-passenger.conf.in +10 -0
  70. data/rpm/config/rubygem-passenger.te +10 -0
  71. data/rpm/doc/README.nginx-alternatives +5 -0
  72. data/rpm/doc/example_yum_repository_htaccess +5 -0
  73. data/rpm/doc/footer.shtml +12 -0
  74. data/rpm/doc/header.shtml +156 -0
  75. data/rpm/nginx-alternatives.spec +97 -0
  76. data/rpm/passenger-release.spec +91 -0
  77. data/rpm/passenger.spec +667 -0
  78. data/rpm/patches/passenger-force-native.patch +63 -0
  79. data/rpm/release/RPM-GPG-KEY-stealthymonkeys +33 -0
  80. data/rpm/release/build-release.sh +35 -0
  81. data/rpm/release/build.rb +301 -0
  82. data/rpm/release/create-mirrors.sh +16 -0
  83. data/rpm/release/mirrors +1 -0
  84. data/rpm/release/mock-repo/comps.xml +21 -0
  85. data/rpm/release/mock-repo/rubygem-daemon_controller-0.2.5-1.noarch.rpm +0 -0
  86. data/rpm/release/mock-repo/rubygem-file-tail-1.0.5-1.noarch.rpm +0 -0
  87. data/rpm/release/mock-repo/rubygem-spruz-0.2.2-1.noarch.rpm +0 -0
  88. data/rpm/release/mocksetup-first.sh +102 -0
  89. data/rpm/release/mocksetup.sh +67 -0
  90. data/test/integration_tests/apache2_tests.rb +1 -1
  91. data/test/integration_tests/downloaded_binaries_tests.rb +76 -0
  92. data/test/integration_tests/native_packaging_spec.rb +38 -6
  93. data/test/integration_tests/source_packaging_test.rb +198 -0
  94. data/test/integration_tests/standalone_tests.rb +275 -0
  95. data/test/ruby/admin_tools_spec.rb +1 -1
  96. data/test/ruby/rails4.0/loader_spec.rb +28 -0
  97. data/test/ruby/rails4.0/preloader_spec.rb +34 -0
  98. data/test/ruby/spec_helper.rb +5 -1
  99. data/test/ruby/standalone/runtime_installer_spec.rb +399 -0
  100. data/test/ruby/standalone/runtime_locator_spec.rb +214 -0
  101. data/test/stub/apache2/httpd.conf.erb +18 -1
  102. data/test/stub/rack/tmp/.gitignore +0 -0
  103. data/test/stub/rails2.3/log/.gitignore +1 -0
  104. data/test/stub/rails2.3/public/.gitignore +1 -0
  105. data/test/stub/rails2.3/tmp/cache/.gitignore +1 -0
  106. data/test/stub/rails2.3/tmp/pids/.gitignore +1 -0
  107. data/test/stub/rails2.3/tmp/sessions/.gitignore +1 -0
  108. data/test/stub/rails2.3/tmp/sockets/.gitignore +1 -0
  109. data/test/stub/rails3.0/.gitignore +4 -0
  110. data/test/stub/rails3.0/Gemfile +1 -1
  111. data/test/stub/rails3.0/Gemfile.lock +1 -1
  112. data/test/stub/rails3.0/lib/tasks/.gitkeep +0 -0
  113. data/test/stub/rails3.0/log/.gitignore +0 -0
  114. data/test/stub/rails3.0/public/stylesheets/.gitkeep +0 -0
  115. data/test/stub/rails3.0/vendor/plugins/.gitkeep +0 -0
  116. data/test/stub/rails3.1/.gitignore +15 -0
  117. data/test/stub/rails3.1/Gemfile +1 -1
  118. data/test/stub/rails3.1/Gemfile.lock +1 -1
  119. data/test/stub/rails3.1/app/mailers/.gitkeep +0 -0
  120. data/test/stub/rails3.1/app/models/.gitkeep +0 -0
  121. data/test/stub/rails3.1/lib/assets/.gitkeep +0 -0
  122. data/test/stub/rails3.1/lib/tasks/.gitkeep +0 -0
  123. data/test/stub/rails3.1/log/.gitkeep +0 -0
  124. data/test/stub/rails3.1/test/fixtures/.gitkeep +0 -0
  125. data/test/stub/rails3.1/test/functional/.gitkeep +0 -0
  126. data/test/stub/rails3.1/test/integration/.gitkeep +0 -0
  127. data/test/stub/rails3.1/test/unit/.gitkeep +0 -0
  128. data/test/stub/rails3.1/vendor/assets/stylesheets/.gitkeep +0 -0
  129. data/test/stub/rails3.1/vendor/plugins/.gitkeep +0 -0
  130. data/test/stub/rails3.2/.gitignore +15 -0
  131. data/test/stub/rails3.2/app/mailers/.gitkeep +0 -0
  132. data/test/stub/rails3.2/app/models/.gitkeep +0 -0
  133. data/test/stub/rails3.2/lib/assets/.gitkeep +0 -0
  134. data/test/stub/rails3.2/lib/tasks/.gitkeep +0 -0
  135. data/test/stub/rails3.2/log/.gitkeep +0 -0
  136. data/test/stub/rails3.2/test/fixtures/.gitkeep +0 -0
  137. data/test/stub/rails3.2/test/functional/.gitkeep +0 -0
  138. data/test/stub/rails3.2/test/integration/.gitkeep +0 -0
  139. data/test/stub/rails3.2/test/unit/.gitkeep +0 -0
  140. data/test/stub/rails3.2/vendor/assets/stylesheets/.gitkeep +0 -0
  141. data/test/stub/rails3.2/vendor/plugins/.gitkeep +0 -0
  142. data/test/stub/rails4.0/.gitignore +16 -0
  143. data/test/stub/rails4.0/Gemfile +45 -0
  144. data/test/stub/rails4.0/Gemfile.lock +126 -0
  145. data/test/stub/rails4.0/README.rdoc +28 -0
  146. data/test/stub/rails4.0/Rakefile +6 -0
  147. data/test/stub/rails4.0/app/assets/images/.keep +0 -0
  148. data/test/stub/rails4.0/app/assets/javascripts/application.js +16 -0
  149. data/test/stub/rails4.0/app/assets/stylesheets/application.css +13 -0
  150. data/test/stub/rails4.0/app/controllers/application_controller.rb +5 -0
  151. data/test/stub/rails4.0/app/controllers/concerns/.keep +0 -0
  152. data/test/stub/rails4.0/app/helpers/application_helper.rb +2 -0
  153. data/test/stub/rails4.0/app/mailers/.keep +0 -0
  154. data/test/stub/rails4.0/app/models/.keep +0 -0
  155. data/test/stub/rails4.0/app/models/concerns/.keep +0 -0
  156. data/test/stub/rails4.0/app/views/layouts/application.html.erb +14 -0
  157. data/test/stub/rails4.0/bin/bundle +3 -0
  158. data/test/stub/rails4.0/bin/rails +4 -0
  159. data/test/stub/rails4.0/bin/rake +4 -0
  160. data/test/stub/rails4.0/config.ru +4 -0
  161. data/test/stub/rails4.0/config/application.rb +23 -0
  162. data/test/stub/rails4.0/config/boot.rb +4 -0
  163. data/test/stub/rails4.0/config/database.yml +25 -0
  164. data/test/stub/rails4.0/config/environment.rb +5 -0
  165. data/test/stub/rails4.0/config/environments/development.rb +29 -0
  166. data/test/stub/rails4.0/config/environments/production.rb +80 -0
  167. data/test/stub/rails4.0/config/environments/test.rb +36 -0
  168. data/test/stub/rails4.0/config/initializers/backtrace_silencers.rb +7 -0
  169. data/test/stub/rails4.0/config/initializers/filter_parameter_logging.rb +4 -0
  170. data/test/stub/rails4.0/config/initializers/inflections.rb +16 -0
  171. data/test/stub/rails4.0/config/initializers/mime_types.rb +5 -0
  172. data/test/stub/rails4.0/config/initializers/passenger.rb +1 -0
  173. data/test/stub/rails4.0/config/initializers/secret_token.rb +12 -0
  174. data/test/stub/rails4.0/config/initializers/session_store.rb +3 -0
  175. data/test/stub/rails4.0/config/initializers/wrap_parameters.rb +14 -0
  176. data/test/stub/rails4.0/config/locales/en.yml +23 -0
  177. data/test/stub/rails4.0/config/routes.rb +57 -0
  178. data/test/stub/rails4.0/db/seeds.rb +7 -0
  179. data/test/stub/rails4.0/lib/assets/.keep +0 -0
  180. data/test/stub/rails4.0/lib/tasks/.keep +0 -0
  181. data/test/stub/rails4.0/log/.keep +0 -0
  182. data/test/stub/rails4.0/public/404.html +58 -0
  183. data/test/stub/rails4.0/public/422.html +58 -0
  184. data/test/stub/rails4.0/public/500.html +57 -0
  185. data/test/stub/rails4.0/public/favicon.ico +0 -0
  186. data/test/stub/rails4.0/public/robots.txt +5 -0
  187. data/test/stub/rails4.0/test/controllers/.keep +0 -0
  188. data/test/stub/rails4.0/test/fixtures/.keep +0 -0
  189. data/test/stub/rails4.0/test/helpers/.keep +0 -0
  190. data/test/stub/rails4.0/test/integration/.keep +0 -0
  191. data/test/stub/rails4.0/test/mailers/.keep +0 -0
  192. data/test/stub/rails4.0/test/models/.keep +0 -0
  193. data/test/stub/rails4.0/test/test_helper.rb +15 -0
  194. data/test/stub/rails4.0/vendor/assets/javascripts/.keep +0 -0
  195. data/test/stub/rails4.0/vendor/assets/stylesheets/.keep +0 -0
  196. data/test/stub/rails_apps/1.2/empty/.gitignore +3 -0
  197. data/test/stub/rails_apps/1.2/empty/app/models/.gitignore +0 -0
  198. data/test/stub/rails_apps/1.2/empty/db/.gitignore +0 -0
  199. data/test/stub/rails_apps/1.2/empty/public/.htaccess +40 -0
  200. data/test/stub/rails_apps/1.2/empty/public/stylesheets/.gitignore +0 -0
  201. data/test/stub/rails_apps/2.0/empty/.gitignore +3 -0
  202. data/test/stub/rails_apps/2.0/empty/app/models/.gitignore +0 -0
  203. data/test/stub/rails_apps/2.0/empty/db/.gitignore +0 -0
  204. data/test/stub/rails_apps/2.0/empty/public/.htaccess +40 -0
  205. data/test/stub/rails_apps/2.0/empty/public/stylesheets/.gitignore +0 -0
  206. data/test/stub/rails_apps/2.2/empty/.gitignore +3 -0
  207. data/test/stub/rails_apps/2.2/empty/app/models/.gitignore +0 -0
  208. data/test/stub/rails_apps/2.2/empty/db/.gitignore +0 -0
  209. data/test/stub/rails_apps/2.2/empty/public/stylesheets/.gitignore +0 -0
  210. data/test/stub/rails_apps/2.3/empty/.gitignore +3 -0
  211. data/test/stub/rails_apps/2.3/empty/app/models/.gitignore +0 -0
  212. data/test/stub/rails_apps/2.3/empty/db/.gitignore +0 -0
  213. data/test/stub/rails_apps/2.3/empty/public/stylesheets/.gitignore +0 -0
  214. data/test/stub/rails_apps/2.3/mycook/public/.htaccess +42 -0
  215. data/test/stub/rails_apps/2.3/mycook/public/uploads/.gitignore +0 -0
  216. data/test/stub/wsgi/tmp/.gitignore +0 -0
  217. data/test/valgrind-osx.supp +7 -0
  218. metadata +162 -8
  219. metadata.gz.asc +7 -7
  220. data/debian.template/locations.ini +0 -12
  221. data/debian.template/ruby-passenger-dev.install +0 -3
  222. data/debian.template/ruby-passenger-doc.install +0 -2
  223. data/debian.template/ruby-passenger.install +0 -11
  224. data/resources/templates/installer_common/freebsd9_broken_cxx_runtime.txt.erb +0 -19
@@ -1,9 +1,9 @@
1
1
  <!DOCTYPE html>
2
- <html lang="en">
3
- <head>
4
- <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
5
- <meta name="generator" content="AsciiDoc 8.6.7">
6
- <title>Phusion Passenger Standalone users guide</title>
2
+ <html lang="en">
3
+ <head>
4
+ <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
5
+ <meta name="generator" content="AsciiDoc 8.6.7">
6
+ <title>Phusion Passenger Standalone users guide</title>
7
7
  <style type="text/css">
8
8
  /* Shared CSS for AsciiDoc xhtml11 and html5 backends */
9
9
 
@@ -603,7 +603,7 @@ div.exampleblock > div.content, div.sidebarblock > div.content, div.listingblock
603
603
  div.verseblock { border-left-width: 0; margin-left: 3em; }
604
604
  div.quoteblock { border-left-width: 3px; margin-left: 0; margin-right: 0;}
605
605
  div.admonitionblock td.content { border-left: 3px solid #E8E8E8; }
606
- </style>
606
+ </style>
607
607
  <script type="text/javascript">
608
608
  /*<![CDATA[*/
609
609
  var asciidoc = { // Namespace.
@@ -797,8 +797,7 @@ install: function(toclevels) {
797
797
  }
798
798
  asciidoc.install();
799
799
  /*]]>*/
800
- </script>
801
- <style type="text/css">
800
+ </script><style type="text/css">
802
801
  body {
803
802
  margin: 1em auto 1em auto;
804
803
  padding: 0 1em 0 1em;
@@ -1055,11 +1054,10 @@ pre {
1055
1054
  }
1056
1055
 
1057
1056
  </style>
1058
- </head>
1057
+ </head>
1059
1058
  <body class="article">
1060
1059
  <div id="topbar" style="display: none">
1061
1060
  <div class="title">
1062
- <!-- Don't put a space between the img and a. That will break the hover layout. -->
1063
1061
  <img src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAsAAAAKCAYAAAEV95QVAAAAAXNSR0IArs4c6QAAAAZiS0dEAP8A/wD/oL2nkwAAAAlwSFlzAAALEwAACxMBAJqcGAAAAAd0SU1FB9sGCRMSACDxkZwAAAAidEVYdENvbW1lbnQAQ3JlYXRlZCB3aXRoIEdJTVAgb24gYSBNYWOHqHdDAAAAZUlEQVQY032PSxbAIAjEIlfygL6ePF3UUvpzNjgSYWwqAMEhUQnANnsC7TQPeJpsVWzMuh2sog4vDTUbqP081zECrW4dtdaQGSIKlWluPyjK+VXxAz5XfcKufCzA130AfQHWB30HZxlPaP080xsAAAAASUVORK5CYII=" width="11" height="10" alt=""><a href="javascript:void(Mizuho.smoothlyScrollToToc())">Phusion Passenger Standalone users guide</a>
1064
1062
  </div>
1065
1063
  <a href="javascript:void(0)" id="current_section"></a>
@@ -1070,12 +1068,11 @@ pre {
1070
1068
  <div class="sectionbody">
1071
1069
  <div class="paragraph"><p><span class="image">
1072
1070
  <a class="image" href="http://www.phusion.nl/">
1073
- <img src="images/phusion_banner.png" alt="images/phusion_banner.png">
1074
- </a>
1071
+ <img src="images/phusion_banner.png" alt="images/phusion_banner.png"></a>
1075
1072
  </span></p></div>
1076
1073
  <div class="paragraph"><p>Phusion Passenger Standalone is a web server that allows one to run Ruby web applications.
1077
1074
  Here are some of the highlights:</p></div>
1078
- <div class="ulist"><ul>
1075
+ <div class="ulist"><ul>
1079
1076
  <li>
1080
1077
  <p>
1081
1078
  Unlike Phusion Passenger for Apache and Phusion Passenger for Nginx, Phusion Passenger
@@ -1135,7 +1132,7 @@ if it doesn’t work on your POSIX-compliant operating system.</p></div>
1135
1132
  </div>
1136
1133
  <div class="sect2">
1137
1134
  <a href="javascript:void(0)" class="comments empty" title="Add a comment"><span class="count"></span></a><span class="anchor_helper" id="_where_to_get_support"></span><h3 data-comment-topic="where-to-get-support-xkx7rx" data-anchor="_where_to_get_support">1.2. Where to get support</h3>
1138
- <div class="ulist"><ul>
1135
+ <div class="ulist"><ul>
1139
1136
  <li>
1140
1137
  <p>
1141
1138
  <a href="http://groups.google.com/group/phusion-passenger">Discussion forum</a> - post a
@@ -1880,5 +1877,5 @@ Mizuho.topicListReceived = $.proxy(function(result) {
1880
1877
  $(document).ready(Mizuho.initializeCommenting);
1881
1878
 
1882
1879
  </script>
1883
- </body>
1880
+ </body>
1884
1881
  </html>
@@ -82,7 +82,7 @@ gem install passenger-enterprise-server-x.x.x.gem
82
82
  [float]
83
83
  ==== Step 3: add the RubyGems bin directory to your $PATH
84
84
 
85
- If you all of the following are applicable to you:
85
+ If all of the following are applicable to you:
86
86
 
87
87
  - You are on Debian or Ubuntu,
88
88
  - and you installed RubyGems through APT,
@@ -420,7 +420,7 @@ sudo apt-get install nginx-full
420
420
  You'll then need to enable the Phusion Passenger module in Nginx by creating the following configuration file:
421
421
 
422
422
  -----------------------------------------------
423
- sudo sh -c 'echo "passenger_root /usr/lib/phusion-passenger;" > /etc/nginx/conf.d/passenger.conf'
423
+ sudo sh -c 'echo "passenger_root /usr/lib/ruby/vendor_ruby/phusion_passenger/locations.ini;" > /etc/nginx/conf.d/passenger.conf'
424
424
  -----------------------------------------------
425
425
 
426
426
  Then restart Nginx to apply the changes:
@@ -692,6 +692,7 @@ $ sudo bash
692
692
  `GMAKE`::
693
693
  The location of the GNU-compatible `make` tool.
694
694
 
695
+ TIP: If you do not know what environment variables are, or how to use them, then please read <<env_vars_and_sudo,Environment variables and sudo>>.
695
696
  NOTE: If you run the installer with `sudo` then environment variables may not be passed properly. Learn more at <<env_vars_and_sudo,Environment variables and sudo>>.
696
697
 
697
698
 
@@ -42,22 +42,11 @@ using namespace std;
42
42
  using namespace boost;
43
43
  using namespace oxt;
44
44
 
45
-
46
- template<typename T>
47
- static bool
48
- exceptionIsInstanceOf(const tracable_exception &e) {
49
- try {
50
- (void) dynamic_cast<T>(e);
51
- return true;
52
- } catch (const bad_cast &) {
53
- return false;
54
- }
55
- }
56
-
57
45
  #define TRY_COPY_EXCEPTION(klass) \
58
46
  do { \
59
- if (exceptionIsInstanceOf<const klass &>(e)) { \
60
- return make_shared<klass>( (const klass &) e ); \
47
+ const klass *ep = dynamic_cast<const klass *>(&e); \
48
+ if (ep != NULL) { \
49
+ return make_shared<klass>(*ep); \
61
50
  } \
62
51
  } while (false)
63
52
 
@@ -96,8 +85,9 @@ copyException(const tracable_exception &e) {
96
85
 
97
86
  #define TRY_RETHROW_EXCEPTION(klass) \
98
87
  do { \
99
- if (exceptionIsInstanceOf<const klass &>(*e)) { \
100
- throw klass((const klass &) *e); \
88
+ const klass *ep = dynamic_cast<const klass *>(&*e); \
89
+ if (ep != NULL) { \
90
+ throw klass(*ep); \
101
91
  } \
102
92
  } while (false)
103
93
 
@@ -70,7 +70,7 @@
70
70
 
71
71
  #define PROCESS_SHUTDOWN_TIMEOUT_DISPLAY "1 minute"
72
72
 
73
- #define PASSENGER_VERSION "4.0.10"
73
+ #define PASSENGER_VERSION "4.0.13"
74
74
 
75
75
  #define SERVER_INSTANCE_DIR_STRUCTURE_MAJOR_VERSION 1
76
76
 
@@ -67,12 +67,12 @@ public:
67
67
  if (getFileType(rootOrFile) == FT_REGULAR) {
68
68
  string file = rootOrFile;
69
69
  IniFileSectionPtr options = IniFile(file).section("locations");
70
- binDir = getOption(file, options, "bin");
71
- agentsDir = getOption(file, options, "agents");
72
- helperScriptsDir = getOption(file, options, "helper_scripts");
73
- resourcesDir = getOption(file, options, "resources");
74
- docDir = getOption(file, options, "doc");
75
- rubyLibDir = getOption(file, options, "rubylibdir");
70
+ binDir = getOption(file, options, "bin_dir");
71
+ agentsDir = getOption(file, options, "agents_dir");
72
+ helperScriptsDir = getOption(file, options, "helper_scripts_dir");
73
+ resourcesDir = getOption(file, options, "resources_dir");
74
+ docDir = getOption(file, options, "doc_dir");
75
+ rubyLibDir = getOption(file, options, "ruby_libdir");
76
76
  } else {
77
77
  string root = rootOrFile;
78
78
  binDir = root + "/bin";
@@ -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
  *
@@ -269,15 +269,16 @@ private:
269
269
  switch (exceptionHandlingMode) {
270
270
  case THROW:
271
271
  throw e;
272
- case PRINT:
273
- try {
274
- const tracable_exception &te =
275
- dynamic_cast<const tracable_exception &>(e);
276
- P_WARN(te.what() << "\n" << te.backtrace());
277
- } catch (const bad_cast &) {
278
- P_WARN(e.what());
272
+ case PRINT: {
273
+ const tracable_exception *te =
274
+ dynamic_cast<const tracable_exception *>(&e);
275
+ if (te != NULL) {
276
+ P_WARN(te->what() << "\n" << te->backtrace());
277
+ } else {
278
+ P_WARN(e.what());
279
+ }
280
+ break;
279
281
  }
280
- break;
281
282
  default:
282
283
  break;
283
284
  }
@@ -587,12 +588,7 @@ private:
587
588
 
588
589
  template<typename T>
589
590
  static bool instanceof(const std::exception &e) {
590
- try {
591
- (void) dynamic_cast<const T &>(e);
592
- return true;
593
- } catch (const bad_cast &) {
594
- return false;
595
- }
591
+ return dynamic_cast<const T *>(&e) != NULL;
596
592
  }
597
593
 
598
594
  ConnectionPtr createNewConnection() {
@@ -39,9 +39,10 @@
39
39
  #include <mach/mach_vm.h>
40
40
  #include <mach/mach_port.h>
41
41
  #endif
42
- #ifndef __NetBSD__
42
+ #if !defined(__NetBSD__) && !defined(__OpenBSD__)
43
43
  // NetBSD does not support -p with multiple PIDs.
44
44
  // https://code.google.com/p/phusion-passenger/issues/detail?id=736
45
+ // OpenBSD 5.2 doesn't support it either
45
46
  #define PS_SUPPORTS_MULTIPLE_PIDS
46
47
  #include <set>
47
48
  #endif
@@ -418,13 +419,15 @@ public:
418
419
  }
419
420
 
420
421
  ConstIterator it;
421
- string pidsArg;
422
+ // The list of PIDs must follow -p without a space.
423
+ // https://groups.google.com/forum/#!topic/phusion-passenger/WKXy61nJBMA
424
+ string pidsArg = "-p";
422
425
 
423
426
  for (it = pids.begin(); it != pids.end(); it++) {
424
427
  pidsArg.append(toString(*it));
425
428
  pidsArg.append(",");
426
429
  }
427
- if (!pidsArg.empty() && pidsArg[pidsArg.size() - 1] == ',') {
430
+ if (pidsArg[pidsArg.size() - 1] == ',') {
428
431
  pidsArg.resize(pidsArg.size() - 1);
429
432
  }
430
433
 
@@ -436,7 +439,7 @@ public:
436
439
  "pid,ppid,%cpu,rss,vsize,pgid,command",
437
440
  #endif
438
441
  #ifdef PS_SUPPORTS_MULTIPLE_PIDS
439
- "-p", pidsArg.c_str(),
442
+ pidsArg.c_str(),
440
443
  #endif
441
444
  NULL
442
445
  };
@@ -56,11 +56,17 @@ struct AgentOptions {
56
56
  string adminToolStatusPassword;
57
57
  vector<string> prestartUrls;
58
58
 
59
+ bool testBinary;
59
60
  string requestSocketLink;
60
61
 
61
62
  AgentOptions() { }
62
63
 
63
64
  AgentOptions(const VariantMap &options) {
65
+ testBinary = options.get("test_binary", false) == "1";
66
+ if (testBinary) {
67
+ return;
68
+ }
69
+
64
70
  // Required options for which a default is already set by the Watchdog.
65
71
  passengerRoot = options.get("passenger_root");
66
72
  tempDir = options.get("temp_dir");
@@ -587,6 +587,11 @@ int
587
587
  main(int argc, char *argv[]) {
588
588
  TRACE_POINT();
589
589
  AgentOptions options(initializeAgent(argc, argv, "PassengerHelperAgent"));
590
+ if (options.testBinary) {
591
+ printf("PASS\n");
592
+ exit(0);
593
+ }
594
+
590
595
  P_DEBUG("Starting PassengerHelperAgent...");
591
596
  MultiLibeio::init();
592
597
 
@@ -1023,7 +1023,7 @@ private:
1023
1023
  struct tm the_tm;
1024
1024
 
1025
1025
  pos = appendData(pos, end, "Date: ");
1026
- localtime_r(&the_time, &the_tm);
1026
+ gmtime_r(&the_time, &the_tm);
1027
1027
  pos += strftime(pos, end - pos, "%a, %d %b %G %H:%M:%S %Z", &the_tm);
1028
1028
  pos = appendData(pos, end, "\r\n");
1029
1029
  headerData.append(dateStr, pos - dateStr);
@@ -1600,6 +1600,13 @@ private:
1600
1600
  }
1601
1601
  }
1602
1602
 
1603
+ static void fillPoolOption(const ClientPtr &client, unsigned int &field, const StaticString &name) {
1604
+ ScgiRequestParser::const_iterator it = client->scgiParser.getHeaderIterator(name);
1605
+ if (it != client->scgiParser.end()) {
1606
+ field = stringToUint(it->second);
1607
+ }
1608
+ }
1609
+
1603
1610
  static void fillPoolOption(const ClientPtr &client, unsigned long &field, const StaticString &name) {
1604
1611
  ScgiRequestParser::const_iterator it = client->scgiParser.getHeaderIterator(name);
1605
1612
  if (it != client->scgiParser.end()) {
@@ -1663,6 +1670,7 @@ private:
1663
1670
  fillPoolOption(client, options.maxRequests, "PASSENGER_MAX_REQUESTS");
1664
1671
  fillPoolOption(client, options.spawnMethod, "PASSENGER_SPAWN_METHOD");
1665
1672
  fillPoolOption(client, options.startCommand, "PASSENGER_START_COMMAND");
1673
+ fillPoolOption(client, options.startTimeout, "PASSENGER_START_TIMEOUT");
1666
1674
  fillPoolOption(client, options.maxPreloaderIdleTime, "PASSENGER_MAX_PRELOADER_IDLE_TIME");
1667
1675
  fillPoolOption(client, options.statThrottleRate, "PASSENGER_STAT_THROTTLE_RATE");
1668
1676
  fillPoolOption(client, options.restartDir, "PASSENGER_RESTART_DIR");
@@ -126,6 +126,10 @@ static void
126
126
  initializeBareEssentials(int argc, char *argv[]) {
127
127
  agentsOptions = initializeAgent(argc, argv, "PassengerLoggingAgent");
128
128
  curl_global_init(CURL_GLOBAL_ALL);
129
+ if (agentsOptions.get("test_binary", false) == "1") {
130
+ printf("PASS\n");
131
+ exit(0);
132
+ }
129
133
  }
130
134
 
131
135
  static string
@@ -399,6 +399,7 @@ initializeBareEssentials(int argc, char *argv[]) {
399
399
  * forcefully redirect stdout to stderr so that everything ends up in the
400
400
  * same place.
401
401
  */
402
+ int oldStdout = dup(1);
402
403
  dup2(2, 1);
403
404
 
404
405
  /*
@@ -413,6 +414,12 @@ initializeBareEssentials(int argc, char *argv[]) {
413
414
  oldOomScore = setOomScoreNeverKill();
414
415
 
415
416
  agentsOptions = initializeAgent(argc, argv, "PassengerWatchdog");
417
+
418
+ if (agentsOptions.get("test_binary", false) == "1") {
419
+ write(oldStdout, "PASS\n", 5);
420
+ exit(0);
421
+ }
422
+ close(oldStdout);
416
423
  }
417
424
 
418
425
  static void
@@ -2,7 +2,7 @@ PATH="$ngx_addon_dir/../../bin:$PATH"
2
2
  export PATH
3
3
 
4
4
  if ! ruby -v >/dev/null 2>/dev/null; then
5
- echo '*** ERROR: Cannot find the "ruby" command in $PATH. Please fix your $PATH. You can learn more about $PATH at: http://www.modrails.com/documentation/Users%20guide%20Apache.html#_the_path_environment_variable'
5
+ echo '*** ERROR: Cannot find the "ruby" command in $PATH. Please fix your $PATH. You can learn more about $PATH at: http://www.modrails.com/documentation/Users%20guide%20Nginx.html#_the_path_environment_variable'
6
6
  fi
7
7
 
8
8
  if test "x$PASSENGER_LIBS" = "x" && ! passenger-config --compiled; then
@@ -0,0 +1,15 @@
1
+ == Introduction
2
+
3
+ OXT, OS eXtensions for boosT, is a utility library that provides important
4
+ functionality that's necessary for writing robust server software. It
5
+ provides essential things that should be part of C++, but unfortunately isn't,
6
+ such as:
7
+ - System call interruption support. This is important for multithreaded
8
+ software that can block on system calls.
9
+ - Support for backtraces.
10
+
11
+ == Compilation and usage
12
+
13
+ Compile all .cpp files and link them into your program. No special build tools
14
+ are required. OXT depends on a specially patched version of Boost.
15
+
@@ -0,0 +1,83 @@
1
+ #!/usr/bin/env ruby
2
+ # Phusion Passenger - https://www.phusionpassenger.com/
3
+ # Copyright (c) 2010-2013 Phusion
4
+ #
5
+ # "Phusion Passenger" is a trademark of Hongli Lai & Ninh Bui.
6
+ #
7
+ # Permission is hereby granted, free of charge, to any person obtaining a copy
8
+ # of this software and associated documentation files (the "Software"), to deal
9
+ # in the Software without restriction, including without limitation the rights
10
+ # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11
+ # copies of the Software, and to permit persons to whom the Software is
12
+ # furnished to do so, subject to the following conditions:
13
+ #
14
+ # The above copyright notice and this permission notice shall be included in
15
+ # all copies or substantial portions of the Software.
16
+ #
17
+ # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18
+ # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19
+ # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20
+ # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21
+ # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22
+ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
23
+ # THE SOFTWARE.
24
+
25
+ # This script is called during 'gem install'. Its role is to download
26
+ # Phusion Passenger binaries.
27
+ source_root = File.expand_path("../..", File.dirname(__FILE__))
28
+ $LOAD_PATH.unshift("#{source_root}/lib")
29
+ require 'phusion_passenger'
30
+ PhusionPassenger.locate_directories
31
+ require 'fileutils'
32
+
33
+ # Create a dummy Makefile to prevent 'gem install' from borking out.
34
+ File.open("Makefile", "w") do |f|
35
+ f.puts "all:"
36
+ f.puts " true"
37
+ f.puts "install:"
38
+ f.puts " true"
39
+ end
40
+
41
+ if PhusionPassenger.natively_packaged?
42
+ puts "Binary downloading is only available when originally packaged. Stopping."
43
+ exit 0
44
+ end
45
+ if !PhusionPassenger.installed_from_release_package?
46
+ puts "This Phusion Passenger is not installed from an official release package. Stopping."
47
+ exit 0
48
+ end
49
+
50
+ # Create download directory and do some preparation
51
+ require 'phusion_passenger/platform_info'
52
+ require 'phusion_passenger/platform_info/binary_compatibility'
53
+ cxx_compat_id = PhusionPassenger::PlatformInfo.cxx_binary_compatibility_id
54
+ ruby_compat_id = PhusionPassenger::PlatformInfo.ruby_extension_binary_compatibility_id
55
+
56
+ FileUtils.mkdir_p(PhusionPassenger.download_cache_dir)
57
+ Dir.chdir(PhusionPassenger.download_cache_dir)
58
+
59
+ # Initiate downloads
60
+ def download(name)
61
+ if !File.exist?(name)
62
+ url = "#{PhusionPassenger::BINARIES_URL_ROOT}/#{PhusionPassenger::VERSION_STRING}/#{name}"
63
+ cert = PhusionPassenger.binaries_ca_cert_path
64
+ puts "Attempting to download #{url} into #{Dir.pwd}"
65
+ File.unlink("#{name}.tmp") rescue nil
66
+ if PhusionPassenger::PlatformInfo.find_command("wget")
67
+ result = system("wget", "--tries=3", "-O", "#{name}.tmp", "--ca-certificate=#{cert}", url)
68
+ else
69
+ result = system("curl", url, "-f", "-L", "-o", "#{name}.tmp", "--cacert", cert)
70
+ end
71
+ if result
72
+ File.rename("#{name}.tmp", name)
73
+ else
74
+ File.unlink("#{name}.tmp") rescue nil
75
+ end
76
+ else
77
+ puts "#{Dir.pwd}/#{name} already exists"
78
+ end
79
+ end
80
+
81
+ download "support-#{cxx_compat_id}.tar.gz"
82
+ download "nginx-#{PhusionPassenger::PREFERRED_NGINX_VERSION}-#{cxx_compat_id}.tar.gz"
83
+ download "rubyext-#{ruby_compat_id}.tar.gz"