passenger 4.0.19 → 4.0.20

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 (65) hide show
  1. checksums.yaml +15 -0
  2. checksums.yaml.gz.asc +12 -0
  3. data.tar.gz.asc +7 -7
  4. data/NEWS +22 -0
  5. data/bin/passenger-install-apache2-module +2 -2
  6. data/bin/passenger-install-nginx-module +2 -2
  7. data/build/agents.rb +6 -0
  8. data/build/apache2.rb +1 -0
  9. data/build/basics.rb +2 -2
  10. data/build/cplusplus_support.rb +6 -1
  11. data/build/cxx_tests.rb +1 -0
  12. data/build/nginx.rb +1 -0
  13. data/build/packaging.rb +1 -1
  14. data/dev/copy_boost_headers.rb +1 -0
  15. data/doc/Users guide Apache.idmap.txt +56 -54
  16. data/doc/Users guide Apache.txt +22 -3
  17. data/doc/Users guide Nginx.idmap.txt +52 -50
  18. data/doc/Users guide Nginx.txt +22 -3
  19. data/ext/apache2/Configuration.hpp +4 -0
  20. data/ext/apache2/ConfigurationCommands.cpp +6 -0
  21. data/ext/apache2/ConfigurationFields.hpp +6 -4
  22. data/ext/apache2/ConfigurationSetters.cpp +11 -0
  23. data/ext/apache2/CreateDirConfig.cpp +1 -0
  24. data/ext/apache2/Hooks.cpp +2 -0
  25. data/ext/apache2/MergeDirConfig.cpp +7 -0
  26. data/ext/boost/type_traits/detail/common_type_imp.hpp +333 -0
  27. data/ext/boost/type_traits/detail/has_binary_operator.hpp +229 -0
  28. data/ext/boost/type_traits/detail/has_postfix_operator.hpp +202 -0
  29. data/ext/boost/type_traits/detail/has_prefix_operator.hpp +210 -0
  30. data/ext/boost/type_traits/detail/is_function_ptr_tester.hpp +654 -0
  31. data/ext/boost/type_traits/detail/is_mem_fun_pointer_tester.hpp +2759 -0
  32. data/ext/boost/type_traits/detail/wrap.hpp +18 -0
  33. data/ext/common/Constants.h +1 -1
  34. data/ext/common/Utils/StrIntUtils.cpp +1 -1
  35. data/ext/common/agents/HelperAgent/Main.cpp +18 -1
  36. data/ext/common/agents/HelperAgent/RequestHandler.h +3 -0
  37. data/ext/common/agents/SpawnPreparer.cpp +25 -0
  38. data/ext/common/agents/TempDirToucher.c +357 -0
  39. data/ext/common/agents/Watchdog/Main.cpp +38 -0
  40. data/ext/nginx/CacheLocationConfig.c +21 -1
  41. data/ext/nginx/CacheLocationConfig.c.erb +1 -1
  42. data/ext/nginx/ConfigurationCommands.c +10 -0
  43. data/ext/nginx/ConfigurationFields.h +18 -16
  44. data/ext/nginx/ConfigurationFields.h.erb +11 -6
  45. data/ext/nginx/CreateLocationConfig.c +4 -0
  46. data/ext/nginx/MergeLocationConfig.c +6 -0
  47. data/helper-scripts/node-loader.js +6 -2
  48. data/lib/phusion_passenger.rb +1 -1
  49. data/lib/phusion_passenger/{rails3_extensions → active_support3_extensions}/init.rb +10 -8
  50. data/lib/phusion_passenger/apache2/config_options.rb +5 -0
  51. data/lib/phusion_passenger/loader_shared_helpers.rb +61 -7
  52. data/lib/phusion_passenger/nginx/config_options.rb +4 -0
  53. data/lib/phusion_passenger/platform_info/apache.rb +6 -1
  54. data/lib/phusion_passenger/platform_info/compiler.rb +29 -2
  55. data/lib/phusion_passenger/platform_info/depcheck_specs/compiler_toolchain.rb +4 -4
  56. data/lib/phusion_passenger/platform_info/ruby.rb +7 -3
  57. data/lib/phusion_passenger/public_api.rb +4 -4
  58. data/lib/phusion_passenger/standalone/command.rb +10 -0
  59. data/lib/phusion_passenger/standalone/runtime_installer.rb +2 -2
  60. data/lib/phusion_passenger/standalone/start_command.rb +14 -8
  61. data/lib/phusion_passenger/utils/unseekable_socket.rb +52 -0
  62. data/resources/templates/standalone/config.erb +11 -0
  63. metadata +14 -15
  64. metadata.gz.asc +7 -7
  65. data/helper-scripts/touch-dir.sh +0 -48
@@ -596,6 +596,24 @@ This option may occur in the following places:
596
596
 
597
597
  In each place, it may be specified at most once. The default value is 'smart'.
598
598
 
599
+ [[PassengerLoadShellEnvvars]]
600
+ === passenger_load_shell_envvars <on|off> ===
601
+ :version: 4.0.20
602
+ include::users_guide_snippets/since_version.txt[]
603
+
604
+ Enables or disables the loading of shell environment variables before spawning the application.
605
+
606
+ If this option is turned on, and the user's shell is `bash`, then applications are loaded by running them with `bash -l -c`. Otherwise, they are loaded by running them directly from the `PassengerHelperAgent` process.
607
+
608
+ This option may occur in the following places:
609
+
610
+ * In the 'http' configuration block.
611
+ * In a 'server' configuration block.
612
+ * In a 'location' configuration block.
613
+ * In an 'if' configuration scope.
614
+
615
+ In each place, it may be specified at most once. The default value is 'on'.
616
+
599
617
  [[PassengerRollingRestarts]]
600
618
  === passenger_rolling_restarts <on|off> ===
601
619
  :version: 3.0.0
@@ -1655,13 +1673,14 @@ include::users_guide_snippets/alternative_for_flying_passenger.txt[]
1655
1673
  include::users_guide_snippets/enterprise_only.txt[]
1656
1674
 
1657
1675
  Turns support for application debugging on or off. In case of Ruby applications,
1658
- turning this option on will cause them to load the `ruby-debug` gem (when on Ruby 1.8)
1659
- or the `debugger` gem (when on Ruby 1.9). If you're using Bundler, you should add
1660
- this to your Gemfile:
1676
+ turning this option on will cause them to load the `ruby-debug` gem (when on Ruby 1.8),
1677
+ the `debugger` gem (when on Ruby 1.9) or the `byebug` gem (when on Ruby 2.0). If you're
1678
+ using Bundler, you should add this to your Gemfile:
1661
1679
 
1662
1680
  -------------------------------------------
1663
1681
  gem 'ruby-debug', :platforms => :ruby_18
1664
1682
  gem 'debugger', :platforms => :ruby_19
1683
+ gem 'byebug', :platforms => :ruby_20
1665
1684
  -------------------------------------------
1666
1685
 
1667
1686
  Once debugging is turned on, you can use the command `passenger-irb --debug <PID>` to attach an rdebug console to the application process with the given PID. Attaching will succeed once the application process executes a `debugger` command.
@@ -200,6 +200,10 @@ struct DirConfig {
200
200
  return "smart";
201
201
  }
202
202
  }
203
+
204
+ bool getLoadShellEnvvars() const {
205
+ return loadShellEnvvars != DISABLED;
206
+ }
203
207
 
204
208
  unsigned long getMinInstances() const {
205
209
  if (minInstances != UNSET_INT_VALUE) {
@@ -93,3 +93,9 @@
93
93
  OR_ALL,
94
94
  "The maximum number of queued requests."),
95
95
 
96
+ AP_INIT_FLAG("PassengerLoadShellEnvvars",
97
+ (FlagFunc) cmd_passenger_load_shell_envvars,
98
+ NULL,
99
+ OR_OPTIONS | ACCESS_CONF | RSRC_CONF,
100
+ "Whether to load environment variables from the shell before running the application."),
101
+
@@ -38,18 +38,20 @@
38
38
 
39
39
 
40
40
 
41
- /** Enable or disable Phusion Passenger. */
42
- Threeway enabled;
41
+ /** Whether to load environment variables from the shell before running the application. */
42
+ Threeway loadShellEnvvars;
43
43
  /** Enable or disable Passenger's high performance mode. */
44
44
  Threeway highPerformance;
45
+ /** Enable or disable Phusion Passenger. */
46
+ Threeway enabled;
45
47
  /** The maximum number of queued requests. */
46
48
  int maxRequestQueueSize;
49
+ /** The maximum number of requests that an application instance may process. */
50
+ int maxRequests;
47
51
  /** The minimum number of application instances to keep when cleaning idle instances. */
48
52
  int minInstances;
49
53
  /** A timeout for application startup. */
50
54
  int startTimeout;
51
- /** The maximum number of requests that an application instance may process. */
52
- int maxRequests;
53
55
  /** The group that Ruby applications must run as. */
54
56
  const char *group;
55
57
  /** The user that Ruby applications must run as. */
@@ -220,4 +220,15 @@
220
220
  }
221
221
  }
222
222
 
223
+
224
+ static const char *
225
+ cmd_passenger_load_shell_envvars(cmd_parms *cmd, void *pcfg, const char *arg) {
226
+ DirConfig *config = (DirConfig *) pcfg;
227
+ config->loadShellEnvvars =
228
+ arg ?
229
+ DirConfig::ENABLED :
230
+ DirConfig::DISABLED;
231
+ return NULL;
232
+ }
233
+
223
234
 
@@ -47,4 +47,5 @@
47
47
  config->highPerformance = DirConfig::UNSET;
48
48
  config->enabled = DirConfig::UNSET;
49
49
  config->maxRequestQueueSize = UNSET_INT_VALUE;
50
+ config->loadShellEnvvars = DirConfig::UNSET;
50
51
 
@@ -999,6 +999,8 @@ private:
999
999
  apr_psprintf(r->pool, "%ld", config->getMinInstances()));
1000
1000
  addHeader(output, "PASSENGER_MAX_PRELOADER_IDLE_TIME",
1001
1001
  apr_psprintf(r->pool, "%ld", config->maxPreloaderIdleTime));
1002
+ addHeader(output, "PASSENGER_LOAD_SHELL_ENVVARS",
1003
+ config->getLoadShellEnvvars() ? "true" : "false");
1002
1004
  addHeader(output, "PASSENGER_DEBUGGER", "false");
1003
1005
  addHeader(output, "PASSENGER_SHOW_VERSION_IN_HEADER", "true");
1004
1006
  addHeader(output, "PASSENGER_MAX_REQUESTS",
@@ -101,3 +101,10 @@
101
101
  base->maxRequestQueueSize :
102
102
  add->maxRequestQueueSize;
103
103
 
104
+
105
+
106
+ config->loadShellEnvvars =
107
+ (add->loadShellEnvvars == DirConfig::UNSET) ?
108
+ base->loadShellEnvvars :
109
+ add->loadShellEnvvars;
110
+
@@ -0,0 +1,333 @@
1
+ /*******************************************************************************
2
+ * boost/type_traits/detail/common_type_imp.hpp
3
+ *
4
+ * Copyright 2010, Jeffrey Hellrung.
5
+ * Distributed under the Boost Software License, Version 1.0. (See accompanying
6
+ * file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
7
+ *
8
+ * struct boost::common_type<T,U>
9
+ *
10
+ * common_type<T,U>::type is the type of the expression
11
+ * b() ? x() : y()
12
+ * where b() returns a bool, x() has return type T, and y() has return type U.
13
+ * See
14
+ * http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2008/n2661.htm#common_type
15
+ *
16
+ * Note that this evaluates to void if one or both of T and U is void.
17
+ ******************************************************************************/
18
+
19
+ #ifndef BOOST_TYPE_TRAITS_DETAIL_COMMON_TYPE_IMP_HPP
20
+ #define BOOST_TYPE_TRAITS_DETAIL_COMMON_TYPE_IMP_HPP
21
+
22
+ #include <cstddef>
23
+
24
+ #include <boost/mpl/assert.hpp>
25
+ #include <boost/mpl/at.hpp>
26
+ #include <boost/mpl/begin_end.hpp>
27
+ #include <boost/mpl/contains.hpp>
28
+ #include <boost/mpl/copy.hpp>
29
+ #include <boost/mpl/deref.hpp>
30
+ #include <boost/mpl/eval_if.hpp>
31
+ #include <boost/mpl/if.hpp>
32
+ #include <boost/mpl/inserter.hpp>
33
+ #include <boost/mpl/next.hpp>
34
+ #include <boost/mpl/or.hpp>
35
+ #include <boost/mpl/placeholders.hpp>
36
+ #include <boost/mpl/push_back.hpp>
37
+ #include <boost/mpl/size.hpp>
38
+ #include <boost/mpl/vector/vector0.hpp>
39
+ #include <boost/mpl/vector/vector10.hpp>
40
+ #include <boost/type_traits/integral_constant.hpp>
41
+ #include <boost/type_traits/is_enum.hpp>
42
+ #include <boost/type_traits/is_integral.hpp>
43
+ #include <boost/type_traits/make_signed.hpp>
44
+ #include <boost/type_traits/make_unsigned.hpp>
45
+ #include <boost/type_traits/remove_cv.hpp>
46
+ #include <boost/type_traits/remove_reference.hpp>
47
+ #include <boost/utility/declval.hpp>
48
+
49
+ namespace boost
50
+ {
51
+
52
+ namespace detail_type_traits_common_type
53
+ {
54
+
55
+ /*******************************************************************************
56
+ * struct propagate_cv< From, To >
57
+ *
58
+ * This metafunction propagates cv-qualifiers on type From to type To.
59
+ ******************************************************************************/
60
+
61
+ template< class From, class To >
62
+ struct propagate_cv
63
+ { typedef To type; };
64
+ template< class From, class To >
65
+ struct propagate_cv< const From, To >
66
+ { typedef To const type; };
67
+ template< class From, class To >
68
+ struct propagate_cv< volatile From, To >
69
+ { typedef To volatile type; };
70
+ template< class From, class To >
71
+ struct propagate_cv< const volatile From, To >
72
+ { typedef To const volatile type; };
73
+
74
+ /*******************************************************************************
75
+ * struct is_integral_or_enum<T>
76
+ *
77
+ * This metafunction determines if T is an integral type which can be made
78
+ * signed or unsigned.
79
+ ******************************************************************************/
80
+
81
+ template< class T >
82
+ struct is_integral_or_enum
83
+ : public mpl::or_< is_integral<T>, is_enum<T> >
84
+ { };
85
+ template<>
86
+ struct is_integral_or_enum< bool >
87
+ : public false_type
88
+ { };
89
+
90
+ /*******************************************************************************
91
+ * struct make_unsigned_soft<T>
92
+ * struct make_signed_soft<T>
93
+ *
94
+ * These metafunction are identical to make_unsigned and make_signed,
95
+ * respetively, except for special-casing bool.
96
+ ******************************************************************************/
97
+
98
+ template< class T >
99
+ struct make_unsigned_soft
100
+ : public make_unsigned<T>
101
+ { };
102
+ template<>
103
+ struct make_unsigned_soft< bool >
104
+ { typedef bool type; };
105
+
106
+ template< class T >
107
+ struct make_signed_soft
108
+ : public make_signed<T>
109
+ { };
110
+ template<>
111
+ struct make_signed_soft< bool >
112
+ { typedef bool type; };
113
+
114
+ /*******************************************************************************
115
+ * struct sizeof_t<N>
116
+ * typedef ... yes_type
117
+ * typedef ... no_type
118
+ *
119
+ * These types are integral players in the use of the "sizeof trick", i.e., we
120
+ * can distinguish overload selection by inspecting the size of the return type
121
+ * of the overload.
122
+ ******************************************************************************/
123
+
124
+ template< std::size_t N > struct sizeof_t { char _dummy[N]; };
125
+ typedef sizeof_t<1> yes_type;
126
+ typedef sizeof_t<2> no_type;
127
+ BOOST_MPL_ASSERT_RELATION( sizeof( yes_type ), ==, 1 );
128
+ BOOST_MPL_ASSERT_RELATION( sizeof( no_type ), ==, 2 );
129
+
130
+ /*******************************************************************************
131
+ * rvalue_test(T&) -> no_type
132
+ * rvalue_test(...) -> yes_type
133
+ *
134
+ * These overloads are used to determine the rvalue-ness of an expression.
135
+ ******************************************************************************/
136
+
137
+ template< class T > no_type rvalue_test(T&);
138
+ yes_type rvalue_test(...);
139
+
140
+ /*******************************************************************************
141
+ * struct conversion_test_overloads< Sequence >
142
+ *
143
+ * This struct has multiple overloads of the static member function apply, each
144
+ * one taking a single parameter of a type within the Boost.MPL sequence
145
+ * Sequence. Each such apply overload has a return type with sizeof equal to
146
+ * one plus the index of the parameter type within Sequence. Thus, we can
147
+ * deduce the type T of an expression as long as we can generate a finite set of
148
+ * candidate types containing T via these apply overloads and the "sizeof
149
+ * trick".
150
+ ******************************************************************************/
151
+
152
+ template< class First, class Last, std::size_t Index >
153
+ struct conversion_test_overloads_iterate
154
+ : public conversion_test_overloads_iterate<
155
+ typename mpl::next< First >::type, Last, Index + 1
156
+ >
157
+ {
158
+ using conversion_test_overloads_iterate<
159
+ typename mpl::next< First >::type, Last, Index + 1
160
+ >::apply;
161
+ static sizeof_t< Index + 1 >
162
+ apply(typename mpl::deref< First >::type);
163
+ };
164
+
165
+ template< class Last, std::size_t Index >
166
+ struct conversion_test_overloads_iterate< Last, Last, Index >
167
+ { static sizeof_t< Index + 1 > apply(...); };
168
+
169
+ template< class Sequence >
170
+ struct conversion_test_overloads
171
+ : public conversion_test_overloads_iterate<
172
+ typename mpl::begin< Sequence >::type,
173
+ typename mpl::end< Sequence >::type,
174
+ 0
175
+ >
176
+ { };
177
+
178
+ /*******************************************************************************
179
+ * struct select< Sequence, Index >
180
+ *
181
+ * select is synonymous with mpl::at_c unless Index equals the size of the
182
+ * Boost.MPL Sequence, in which case this evaluates to void.
183
+ ******************************************************************************/
184
+
185
+ template<
186
+ class Sequence, int Index,
187
+ int N = mpl::size< Sequence >::value
188
+ >
189
+ struct select
190
+ : public mpl::at_c< Sequence, Index >
191
+ { };
192
+ template< class Sequence, int N >
193
+ struct select< Sequence, N, N >
194
+ { typedef void type; };
195
+
196
+ /*******************************************************************************
197
+ * class deduce_common_type< T, U, NominalCandidates >
198
+ * struct nominal_candidates<T,U>
199
+ * struct common_type_dispatch_on_rvalueness<T,U>
200
+ * struct common_type_impl<T,U>
201
+ *
202
+ * These classes and structs implement the logic behind common_type, which goes
203
+ * roughly as follows. Let C be the type of the conditional expression
204
+ * declval< bool >() ? declval<T>() : declval<U>()
205
+ * if C is an rvalue, then:
206
+ * let T' and U' be T and U stripped of reference- and cv-qualifiers
207
+ * if T' and U' are pointer types, say, T' = V* and U' = W*, then:
208
+ * define the set of NominalCandidates to be
209
+ * { V*, W*, V'*, W'* }
210
+ * where V' is V with whatever cv-qualifiers are on W, and W' is W
211
+ * with whatever cv-qualifiers are on V
212
+ * else if T' and U' are both integral or enum types, then:
213
+ * define the set of NominalCandidates to be
214
+ * {
215
+ * unsigned_soft(T'),
216
+ * unsigned_soft(U'),
217
+ * signed_soft(T'),
218
+ * signed_soft(U'),
219
+ * T',
220
+ * U',
221
+ * unsigned int,
222
+ * int
223
+ * }
224
+ * where unsigned_soft(X) is make_unsigned_soft<X>::type and
225
+ * signed_soft(X) is make_signed_soft<X>::type (these are all
226
+ * generally necessary to cover the various integral promotion cases)
227
+ * else
228
+ * define the set of NominalCandidates to be
229
+ * { T', U' }
230
+ * else
231
+ * let V and W be T and U stripped of reference-qualifiers
232
+ * define the set of NominalCandidates to be
233
+ * { V&, W&, V'&, W'& }
234
+ * where V' is V with whatever cv-qualifiers are on W, and W' is W with
235
+ * whatever cv-qualifiers are on V
236
+ * define the set of Candidates to be equal to the set of NominalCandidates with
237
+ * duplicates removed, and use this set of Candidates to determine C using the
238
+ * conversion_test_overloads struct
239
+ ******************************************************************************/
240
+
241
+ template< class T, class U, class NominalCandidates >
242
+ class deduce_common_type
243
+ {
244
+ typedef typename mpl::copy<
245
+ NominalCandidates,
246
+ mpl::inserter<
247
+ mpl::vector0<>,
248
+ mpl::if_<
249
+ mpl::contains< mpl::_1, mpl::_2 >,
250
+ mpl::_1,
251
+ mpl::push_back< mpl::_1, mpl::_2 >
252
+ >
253
+ >
254
+ >::type candidate_types;
255
+ static const int best_candidate_index =
256
+ sizeof( conversion_test_overloads< candidate_types >::apply(
257
+ declval< bool >() ? declval<T>() : declval<U>()
258
+ ) ) - 1;
259
+ public:
260
+ typedef typename select< candidate_types, best_candidate_index >::type type;
261
+ };
262
+
263
+ template<
264
+ class T, class U,
265
+ class V = typename remove_cv< typename remove_reference<T>::type >::type,
266
+ class W = typename remove_cv< typename remove_reference<U>::type >::type,
267
+ bool = is_integral_or_enum<V>::value && is_integral_or_enum<W>::value
268
+ >
269
+ struct nominal_candidates
270
+ { typedef mpl::vector2<V,W> type; };
271
+
272
+ template< class T, class U, class V, class W >
273
+ struct nominal_candidates< T, U, V, W, true >
274
+ {
275
+ typedef boost::mpl::vector8<
276
+ typename make_unsigned_soft<V>::type,
277
+ typename make_unsigned_soft<W>::type,
278
+ typename make_signed_soft<V>::type,
279
+ typename make_signed_soft<W>::type,
280
+ V, W, unsigned int, int
281
+ > type;
282
+ };
283
+
284
+ template< class T, class U, class V, class W >
285
+ struct nominal_candidates< T, U, V*, W*, false >
286
+ {
287
+ typedef mpl::vector4<
288
+ V*, W*,
289
+ typename propagate_cv<W,V>::type *,
290
+ typename propagate_cv<V,W>::type *
291
+ > type;
292
+ };
293
+
294
+ template<class T, class U, bool b>
295
+ struct common_type_dispatch_on_rvalueness
296
+ : public deduce_common_type< T, U, typename nominal_candidates<T,U>::type >
297
+ { };
298
+
299
+ template< class T, class U >
300
+ struct common_type_dispatch_on_rvalueness< T, U, false >
301
+ {
302
+ private:
303
+ typedef typename remove_reference<T>::type unrefed_T_type;
304
+ typedef typename remove_reference<U>::type unrefed_U_type;
305
+ public:
306
+ typedef typename deduce_common_type<
307
+ T, U,
308
+ mpl::vector4<
309
+ unrefed_T_type &,
310
+ unrefed_U_type &,
311
+ typename propagate_cv< unrefed_U_type, unrefed_T_type >::type &,
312
+ typename propagate_cv< unrefed_T_type, unrefed_U_type >::type &
313
+ >
314
+ >::type type;
315
+ };
316
+
317
+ template< class T, class U >
318
+ struct common_type_impl
319
+ : public common_type_dispatch_on_rvalueness<T,U, sizeof( ::boost::detail_type_traits_common_type::rvalue_test(
320
+ declval< bool >() ? declval<T>() : declval<U>() ) ) == sizeof( yes_type ) >
321
+ { };
322
+
323
+ template< class T > struct common_type_impl< T, void > { typedef void type; };
324
+ template< class T > struct common_type_impl< void, T > { typedef void type; };
325
+ template<> struct common_type_impl< void, void > { typedef void type; };
326
+
327
+ } // namespace detail_type_traits_common_type
328
+
329
+
330
+ } // namespace boost
331
+
332
+ #endif // BOOST_TYPE_TRAITS_DETAIL_COMMON_TYPE_HPP
333
+