passenger-jmazzi 2.2.9
Sign up to get free protection for your applications and to get access to all the features.
- data/INSTALL +6 -0
- data/LICENSE +19 -0
- data/NEWS +270 -0
- data/README +45 -0
- data/Rakefile +918 -0
- data/benchmark/ApplicationPool.cpp +52 -0
- data/benchmark/accept_vs_socketpair_vs_named_pipes.rb +126 -0
- data/benchmark/dispatcher.rb +42 -0
- data/benchmark/overhead_of_password_checking.rb +81 -0
- data/benchmark/socket_connections_vs_persistent_pipe.rb +99 -0
- data/benchmark/unix_sockets_vs_pipes.rb +83 -0
- data/bin/passenger-config +46 -0
- data/bin/passenger-install-apache2-module +224 -0
- data/bin/passenger-install-nginx-module +474 -0
- data/bin/passenger-make-enterprisey +83 -0
- data/bin/passenger-memory-stats +301 -0
- data/bin/passenger-spawn-server +68 -0
- data/bin/passenger-status +125 -0
- data/bin/passenger-stress-test +344 -0
- data/debian/compat +1 -0
- data/debian/control +21 -0
- data/debian/postinst +24 -0
- data/debian/prerm +2 -0
- data/doc/ApplicationPool algorithm.txt +402 -0
- data/doc/Architectural overview.txt +334 -0
- data/doc/Doxyfile +241 -0
- data/doc/Security of user switching support.txt +197 -0
- data/doc/Users guide Apache.txt +1848 -0
- data/doc/Users guide Nginx.txt +769 -0
- data/doc/definitions.h +5 -0
- data/doc/images/by_sa.png +0 -0
- data/doc/images/conservative_spawning.png +0 -0
- data/doc/images/conservative_spawning.svg +248 -0
- data/doc/images/icons/README +5 -0
- data/doc/images/icons/callouts/1.png +0 -0
- data/doc/images/icons/callouts/10.png +0 -0
- data/doc/images/icons/callouts/11.png +0 -0
- data/doc/images/icons/callouts/12.png +0 -0
- data/doc/images/icons/callouts/13.png +0 -0
- data/doc/images/icons/callouts/14.png +0 -0
- data/doc/images/icons/callouts/15.png +0 -0
- data/doc/images/icons/callouts/2.png +0 -0
- data/doc/images/icons/callouts/3.png +0 -0
- data/doc/images/icons/callouts/4.png +0 -0
- data/doc/images/icons/callouts/5.png +0 -0
- data/doc/images/icons/callouts/6.png +0 -0
- data/doc/images/icons/callouts/7.png +0 -0
- data/doc/images/icons/callouts/8.png +0 -0
- data/doc/images/icons/callouts/9.png +0 -0
- data/doc/images/icons/caution.png +0 -0
- data/doc/images/icons/example.png +0 -0
- data/doc/images/icons/home.png +0 -0
- data/doc/images/icons/important.png +0 -0
- data/doc/images/icons/next.png +0 -0
- data/doc/images/icons/note.png +0 -0
- data/doc/images/icons/prev.png +0 -0
- data/doc/images/icons/tip.png +0 -0
- data/doc/images/icons/up.png +0 -0
- data/doc/images/icons/warning.png +0 -0
- data/doc/images/passenger_architecture.png +0 -0
- data/doc/images/passenger_architecture.svg +401 -0
- data/doc/images/phusion_banner.png +0 -0
- data/doc/images/smart-lv2.png +0 -0
- data/doc/images/smart-lv2.svg +320 -0
- data/doc/images/spawn_server_architecture.png +0 -0
- data/doc/images/spawn_server_architecture.svg +655 -0
- data/doc/images/typical_isolated_web_application.png +0 -0
- data/doc/images/typical_isolated_web_application.svg +213 -0
- data/doc/template/horo.rb +613 -0
- data/doc/users_guide_snippets/analysis_and_system_maintenance_tools.txt +144 -0
- data/doc/users_guide_snippets/appendix_a_about.txt +13 -0
- data/doc/users_guide_snippets/appendix_b_terminology.txt +63 -0
- data/doc/users_guide_snippets/appendix_c_spawning_methods.txt +304 -0
- data/doc/users_guide_snippets/global_queueing_explained.txt +78 -0
- data/doc/users_guide_snippets/rackup_specifications.txt +71 -0
- data/doc/users_guide_snippets/rails_spawn_method.txt +48 -0
- data/doc/users_guide_snippets/tips.txt +173 -0
- data/ext/apache2/Bucket.cpp +190 -0
- data/ext/apache2/Bucket.h +87 -0
- data/ext/apache2/Configuration.cpp +798 -0
- data/ext/apache2/Configuration.h +405 -0
- data/ext/apache2/DirectoryMapper.h +296 -0
- data/ext/apache2/Hooks.cpp +1617 -0
- data/ext/apache2/Hooks.h +45 -0
- data/ext/apache2/LICENSE-CNRI.TXT +79 -0
- data/ext/apache2/mod_passenger.c +38 -0
- data/ext/boost/LICENSE.TXT +23 -0
- data/ext/boost/VERSION.TXT +1 -0
- data/ext/boost/algorithm/string/case_conv.hpp +176 -0
- data/ext/boost/algorithm/string/compare.hpp +199 -0
- data/ext/boost/algorithm/string/concept.hpp +83 -0
- data/ext/boost/algorithm/string/config.hpp +28 -0
- data/ext/boost/algorithm/string/constants.hpp +36 -0
- data/ext/boost/algorithm/string/detail/case_conv.hpp +112 -0
- data/ext/boost/algorithm/string/detail/find_format.hpp +193 -0
- data/ext/boost/algorithm/string/detail/find_format_all.hpp +263 -0
- data/ext/boost/algorithm/string/detail/find_format_store.hpp +71 -0
- data/ext/boost/algorithm/string/detail/finder.hpp +646 -0
- data/ext/boost/algorithm/string/detail/formatter.hpp +94 -0
- data/ext/boost/algorithm/string/detail/replace_storage.hpp +159 -0
- data/ext/boost/algorithm/string/detail/sequence.hpp +200 -0
- data/ext/boost/algorithm/string/detail/util.hpp +106 -0
- data/ext/boost/algorithm/string/erase.hpp +844 -0
- data/ext/boost/algorithm/string/find_format.hpp +269 -0
- data/ext/boost/algorithm/string/finder.hpp +270 -0
- data/ext/boost/algorithm/string/formatter.hpp +103 -0
- data/ext/boost/algorithm/string/replace.hpp +928 -0
- data/ext/boost/algorithm/string/sequence_traits.hpp +193 -0
- data/ext/boost/algorithm/string/yes_no_type.hpp +33 -0
- data/ext/boost/assert.hpp +50 -0
- data/ext/boost/bind.hpp +1689 -0
- data/ext/boost/bind/arg.hpp +62 -0
- data/ext/boost/bind/bind_cc.hpp +117 -0
- data/ext/boost/bind/bind_mf_cc.hpp +227 -0
- data/ext/boost/bind/bind_template.hpp +345 -0
- data/ext/boost/bind/mem_fn_cc.hpp +103 -0
- data/ext/boost/bind/mem_fn_template.hpp +1020 -0
- data/ext/boost/bind/placeholders.hpp +68 -0
- data/ext/boost/bind/storage.hpp +475 -0
- data/ext/boost/call_traits.hpp +24 -0
- data/ext/boost/checked_delete.hpp +69 -0
- data/ext/boost/concept/assert.hpp +46 -0
- data/ext/boost/concept/detail/concept_def.hpp +51 -0
- data/ext/boost/concept/detail/concept_undef.hpp +5 -0
- data/ext/boost/concept/detail/general.hpp +66 -0
- data/ext/boost/concept/detail/has_constraints.hpp +48 -0
- data/ext/boost/concept/usage.hpp +43 -0
- data/ext/boost/concept_check.hpp +988 -0
- data/ext/boost/config.hpp +70 -0
- data/ext/boost/config/abi/borland_prefix.hpp +27 -0
- data/ext/boost/config/abi/borland_suffix.hpp +12 -0
- data/ext/boost/config/abi/msvc_prefix.hpp +8 -0
- data/ext/boost/config/abi/msvc_suffix.hpp +8 -0
- data/ext/boost/config/abi_prefix.hpp +25 -0
- data/ext/boost/config/abi_suffix.hpp +26 -0
- data/ext/boost/config/auto_link.hpp +368 -0
- data/ext/boost/config/compiler/borland.hpp +209 -0
- data/ext/boost/config/compiler/comeau.hpp +59 -0
- data/ext/boost/config/compiler/common_edg.hpp +62 -0
- data/ext/boost/config/compiler/compaq_cxx.hpp +19 -0
- data/ext/boost/config/compiler/digitalmars.hpp +67 -0
- data/ext/boost/config/compiler/gcc.hpp +149 -0
- data/ext/boost/config/compiler/gcc_xml.hpp +30 -0
- data/ext/boost/config/compiler/greenhills.hpp +28 -0
- data/ext/boost/config/compiler/hp_acc.hpp +95 -0
- data/ext/boost/config/compiler/intel.hpp +162 -0
- data/ext/boost/config/compiler/kai.hpp +35 -0
- data/ext/boost/config/compiler/metrowerks.hpp +111 -0
- data/ext/boost/config/compiler/mpw.hpp +51 -0
- data/ext/boost/config/compiler/pgi.hpp +25 -0
- data/ext/boost/config/compiler/sgi_mipspro.hpp +28 -0
- data/ext/boost/config/compiler/sunpro_cc.hpp +98 -0
- data/ext/boost/config/compiler/vacpp.hpp +60 -0
- data/ext/boost/config/compiler/visualc.hpp +191 -0
- data/ext/boost/config/no_tr1/complex.hpp +28 -0
- data/ext/boost/config/no_tr1/functional.hpp +28 -0
- data/ext/boost/config/no_tr1/memory.hpp +28 -0
- data/ext/boost/config/no_tr1/utility.hpp +28 -0
- data/ext/boost/config/platform/aix.hpp +33 -0
- data/ext/boost/config/platform/amigaos.hpp +15 -0
- data/ext/boost/config/platform/beos.hpp +26 -0
- data/ext/boost/config/platform/bsd.hpp +73 -0
- data/ext/boost/config/platform/cygwin.hpp +51 -0
- data/ext/boost/config/platform/hpux.hpp +84 -0
- data/ext/boost/config/platform/irix.hpp +31 -0
- data/ext/boost/config/platform/linux.hpp +98 -0
- data/ext/boost/config/platform/macos.hpp +78 -0
- data/ext/boost/config/platform/qnxnto.hpp +31 -0
- data/ext/boost/config/platform/solaris.hpp +21 -0
- data/ext/boost/config/platform/win32.hpp +58 -0
- data/ext/boost/config/posix_features.hpp +95 -0
- data/ext/boost/config/requires_threads.hpp +92 -0
- data/ext/boost/config/select_compiler_config.hpp +115 -0
- data/ext/boost/config/select_platform_config.hpp +90 -0
- data/ext/boost/config/select_stdlib_config.hpp +68 -0
- data/ext/boost/config/stdlib/dinkumware.hpp +106 -0
- data/ext/boost/config/stdlib/libcomo.hpp +46 -0
- data/ext/boost/config/stdlib/libstdcpp3.hpp +73 -0
- data/ext/boost/config/stdlib/modena.hpp +30 -0
- data/ext/boost/config/stdlib/msl.hpp +59 -0
- data/ext/boost/config/stdlib/roguewave.hpp +153 -0
- data/ext/boost/config/stdlib/sgi.hpp +111 -0
- data/ext/boost/config/stdlib/stlport.hpp +201 -0
- data/ext/boost/config/stdlib/vacpp.hpp +18 -0
- data/ext/boost/config/suffix.hpp +566 -0
- data/ext/boost/config/user.hpp +124 -0
- data/ext/boost/cstdint.hpp +449 -0
- data/ext/boost/current_function.hpp +67 -0
- data/ext/boost/date_time/adjust_functors.hpp +178 -0
- data/ext/boost/date_time/c_time.hpp +91 -0
- data/ext/boost/date_time/compiler_config.hpp +149 -0
- data/ext/boost/date_time/constrained_value.hpp +98 -0
- data/ext/boost/date_time/date.hpp +197 -0
- data/ext/boost/date_time/date_clock_device.hpp +77 -0
- data/ext/boost/date_time/date_defs.hpp +26 -0
- data/ext/boost/date_time/date_duration.hpp +147 -0
- data/ext/boost/date_time/date_duration_types.hpp +269 -0
- data/ext/boost/date_time/date_facet.hpp +775 -0
- data/ext/boost/date_time/date_format_simple.hpp +159 -0
- data/ext/boost/date_time/date_formatting.hpp +127 -0
- data/ext/boost/date_time/date_formatting_limited.hpp +121 -0
- data/ext/boost/date_time/date_formatting_locales.hpp +233 -0
- data/ext/boost/date_time/date_generator_formatter.hpp +263 -0
- data/ext/boost/date_time/date_generator_parser.hpp +329 -0
- data/ext/boost/date_time/date_generators.hpp +509 -0
- data/ext/boost/date_time/date_iterator.hpp +101 -0
- data/ext/boost/date_time/date_names_put.hpp +320 -0
- data/ext/boost/date_time/date_parsing.hpp +299 -0
- data/ext/boost/date_time/dst_rules.hpp +391 -0
- data/ext/boost/date_time/filetime_functions.hpp +78 -0
- data/ext/boost/date_time/format_date_parser.hpp +731 -0
- data/ext/boost/date_time/gregorian/conversion.hpp +73 -0
- data/ext/boost/date_time/gregorian/formatters.hpp +162 -0
- data/ext/boost/date_time/gregorian/formatters_limited.hpp +81 -0
- data/ext/boost/date_time/gregorian/greg_calendar.hpp +47 -0
- data/ext/boost/date_time/gregorian/greg_date.hpp +135 -0
- data/ext/boost/date_time/gregorian/greg_day.hpp +57 -0
- data/ext/boost/date_time/gregorian/greg_day_of_year.hpp +38 -0
- data/ext/boost/date_time/gregorian/greg_duration.hpp +38 -0
- data/ext/boost/date_time/gregorian/greg_duration_types.hpp +34 -0
- data/ext/boost/date_time/gregorian/greg_month.hpp +105 -0
- data/ext/boost/date_time/gregorian/greg_weekday.hpp +66 -0
- data/ext/boost/date_time/gregorian/greg_year.hpp +53 -0
- data/ext/boost/date_time/gregorian/greg_ymd.hpp +33 -0
- data/ext/boost/date_time/gregorian/gregorian.hpp +38 -0
- data/ext/boost/date_time/gregorian/gregorian_io.hpp +777 -0
- data/ext/boost/date_time/gregorian/gregorian_types.hpp +109 -0
- data/ext/boost/date_time/gregorian/parsers.hpp +91 -0
- data/ext/boost/date_time/gregorian_calendar.hpp +70 -0
- data/ext/boost/date_time/gregorian_calendar.ipp +219 -0
- data/ext/boost/date_time/int_adapter.hpp +507 -0
- data/ext/boost/date_time/iso_format.hpp +303 -0
- data/ext/boost/date_time/locale_config.hpp +31 -0
- data/ext/boost/date_time/microsec_time_clock.hpp +205 -0
- data/ext/boost/date_time/parse_format_base.hpp +29 -0
- data/ext/boost/date_time/period.hpp +377 -0
- data/ext/boost/date_time/period_formatter.hpp +196 -0
- data/ext/boost/date_time/period_parser.hpp +196 -0
- data/ext/boost/date_time/posix_time/conversion.hpp +93 -0
- data/ext/boost/date_time/posix_time/date_duration_operators.hpp +114 -0
- data/ext/boost/date_time/posix_time/posix_time.hpp +39 -0
- data/ext/boost/date_time/posix_time/posix_time_config.hpp +178 -0
- data/ext/boost/date_time/posix_time/posix_time_duration.hpp +82 -0
- data/ext/boost/date_time/posix_time/posix_time_io.hpp +246 -0
- data/ext/boost/date_time/posix_time/posix_time_system.hpp +68 -0
- data/ext/boost/date_time/posix_time/posix_time_types.hpp +55 -0
- data/ext/boost/date_time/posix_time/ptime.hpp +65 -0
- data/ext/boost/date_time/posix_time/time_formatters.hpp +289 -0
- data/ext/boost/date_time/posix_time/time_parsers.hpp +44 -0
- data/ext/boost/date_time/posix_time/time_period.hpp +29 -0
- data/ext/boost/date_time/special_defs.hpp +25 -0
- data/ext/boost/date_time/special_values_formatter.hpp +96 -0
- data/ext/boost/date_time/special_values_parser.hpp +159 -0
- data/ext/boost/date_time/string_convert.hpp +33 -0
- data/ext/boost/date_time/string_parse_tree.hpp +278 -0
- data/ext/boost/date_time/strings_from_facet.hpp +123 -0
- data/ext/boost/date_time/time.hpp +190 -0
- data/ext/boost/date_time/time_clock.hpp +83 -0
- data/ext/boost/date_time/time_defs.hpp +33 -0
- data/ext/boost/date_time/time_duration.hpp +281 -0
- data/ext/boost/date_time/time_facet.hpp +1263 -0
- data/ext/boost/date_time/time_formatting_streams.hpp +119 -0
- data/ext/boost/date_time/time_iterator.hpp +52 -0
- data/ext/boost/date_time/time_parsing.hpp +321 -0
- data/ext/boost/date_time/time_resolution_traits.hpp +140 -0
- data/ext/boost/date_time/time_system_counted.hpp +254 -0
- data/ext/boost/date_time/time_system_split.hpp +213 -0
- data/ext/boost/date_time/wrapping_int.hpp +163 -0
- data/ext/boost/date_time/year_month_day.hpp +45 -0
- data/ext/boost/detail/atomic_count.hpp +124 -0
- data/ext/boost/detail/atomic_count_gcc.hpp +68 -0
- data/ext/boost/detail/atomic_count_gcc_x86.hpp +84 -0
- data/ext/boost/detail/atomic_count_pthreads.hpp +96 -0
- data/ext/boost/detail/atomic_count_solaris.hpp +59 -0
- data/ext/boost/detail/atomic_count_sync.hpp +57 -0
- data/ext/boost/detail/atomic_count_win32.hpp +63 -0
- data/ext/boost/detail/bad_weak_ptr.hpp +59 -0
- data/ext/boost/detail/call_traits.hpp +164 -0
- data/ext/boost/detail/endian.hpp +73 -0
- data/ext/boost/detail/indirect_traits.hpp +487 -0
- data/ext/boost/detail/iterator.hpp +494 -0
- data/ext/boost/detail/lcast_precision.hpp +184 -0
- data/ext/boost/detail/limits.hpp +449 -0
- data/ext/boost/detail/reference_content.hpp +141 -0
- data/ext/boost/detail/shared_count.hpp +375 -0
- data/ext/boost/detail/sp_counted_base.hpp +81 -0
- data/ext/boost/detail/sp_counted_base_acc_ia64.hpp +150 -0
- data/ext/boost/detail/sp_counted_base_cw_ppc.hpp +170 -0
- data/ext/boost/detail/sp_counted_base_cw_x86.hpp +158 -0
- data/ext/boost/detail/sp_counted_base_gcc_ia64.hpp +157 -0
- data/ext/boost/detail/sp_counted_base_gcc_ppc.hpp +181 -0
- data/ext/boost/detail/sp_counted_base_gcc_sparc.hpp +166 -0
- data/ext/boost/detail/sp_counted_base_gcc_x86.hpp +173 -0
- data/ext/boost/detail/sp_counted_base_nt.hpp +107 -0
- data/ext/boost/detail/sp_counted_base_pt.hpp +135 -0
- data/ext/boost/detail/sp_counted_base_solaris.hpp +113 -0
- data/ext/boost/detail/sp_counted_base_sync.hpp +151 -0
- data/ext/boost/detail/sp_counted_base_w32.hpp +130 -0
- data/ext/boost/detail/sp_counted_impl.hpp +231 -0
- data/ext/boost/detail/sp_typeinfo.hpp +83 -0
- data/ext/boost/detail/workaround.hpp +202 -0
- data/ext/boost/enable_shared_from_this.hpp +73 -0
- data/ext/boost/function.hpp +66 -0
- data/ext/boost/function/detail/function_iterate.hpp +16 -0
- data/ext/boost/function/detail/maybe_include.hpp +267 -0
- data/ext/boost/function/detail/prologue.hpp +25 -0
- data/ext/boost/function/function_base.hpp +762 -0
- data/ext/boost/function/function_template.hpp +969 -0
- data/ext/boost/function_equal.hpp +28 -0
- data/ext/boost/get_pointer.hpp +29 -0
- data/ext/boost/implicit_cast.hpp +29 -0
- data/ext/boost/integer_traits.hpp +236 -0
- data/ext/boost/io/ios_state.hpp +431 -0
- data/ext/boost/io_fwd.hpp +67 -0
- data/ext/boost/is_placeholder.hpp +31 -0
- data/ext/boost/iterator.hpp +59 -0
- data/ext/boost/iterator/detail/config_def.hpp +135 -0
- data/ext/boost/iterator/detail/config_undef.hpp +25 -0
- data/ext/boost/iterator/detail/enable_if.hpp +86 -0
- data/ext/boost/iterator/detail/facade_iterator_category.hpp +200 -0
- data/ext/boost/iterator/detail/minimum_category.hpp +116 -0
- data/ext/boost/iterator/interoperable.hpp +50 -0
- data/ext/boost/iterator/iterator_adaptor.hpp +366 -0
- data/ext/boost/iterator/iterator_categories.hpp +188 -0
- data/ext/boost/iterator/iterator_facade.hpp +879 -0
- data/ext/boost/iterator/iterator_traits.hpp +92 -0
- data/ext/boost/iterator/reverse_iterator.hpp +69 -0
- data/ext/boost/iterator/transform_iterator.hpp +188 -0
- data/ext/boost/lexical_cast.hpp +1205 -0
- data/ext/boost/limits.hpp +146 -0
- data/ext/boost/mem_fn.hpp +389 -0
- data/ext/boost/mpl/always.hpp +39 -0
- data/ext/boost/mpl/and.hpp +60 -0
- data/ext/boost/mpl/apply.hpp +229 -0
- data/ext/boost/mpl/apply_fwd.hpp +107 -0
- data/ext/boost/mpl/apply_wrap.hpp +203 -0
- data/ext/boost/mpl/arg.hpp +131 -0
- data/ext/boost/mpl/arg_fwd.hpp +28 -0
- data/ext/boost/mpl/assert.hpp +370 -0
- data/ext/boost/mpl/aux_/adl_barrier.hpp +48 -0
- data/ext/boost/mpl/aux_/arg_typedef.hpp +31 -0
- data/ext/boost/mpl/aux_/arity.hpp +39 -0
- data/ext/boost/mpl/aux_/arity_spec.hpp +67 -0
- data/ext/boost/mpl/aux_/common_name_wknd.hpp +34 -0
- data/ext/boost/mpl/aux_/config/adl.hpp +40 -0
- data/ext/boost/mpl/aux_/config/arrays.hpp +30 -0
- data/ext/boost/mpl/aux_/config/bind.hpp +33 -0
- data/ext/boost/mpl/aux_/config/compiler.hpp +64 -0
- data/ext/boost/mpl/aux_/config/ctps.hpp +30 -0
- data/ext/boost/mpl/aux_/config/dtp.hpp +46 -0
- data/ext/boost/mpl/aux_/config/eti.hpp +47 -0
- data/ext/boost/mpl/aux_/config/gcc.hpp +23 -0
- data/ext/boost/mpl/aux_/config/has_apply.hpp +32 -0
- data/ext/boost/mpl/aux_/config/has_xxx.hpp +33 -0
- data/ext/boost/mpl/aux_/config/integral.hpp +38 -0
- data/ext/boost/mpl/aux_/config/intel.hpp +21 -0
- data/ext/boost/mpl/aux_/config/lambda.hpp +32 -0
- data/ext/boost/mpl/aux_/config/msvc.hpp +21 -0
- data/ext/boost/mpl/aux_/config/msvc_typename.hpp +26 -0
- data/ext/boost/mpl/aux_/config/nttp.hpp +41 -0
- data/ext/boost/mpl/aux_/config/overload_resolution.hpp +29 -0
- data/ext/boost/mpl/aux_/config/pp_counter.hpp +26 -0
- data/ext/boost/mpl/aux_/config/preprocessor.hpp +39 -0
- data/ext/boost/mpl/aux_/config/static_constant.hpp +25 -0
- data/ext/boost/mpl/aux_/config/ttp.hpp +41 -0
- data/ext/boost/mpl/aux_/config/use_preprocessed.hpp +19 -0
- data/ext/boost/mpl/aux_/config/workaround.hpp +19 -0
- data/ext/boost/mpl/aux_/full_lambda.hpp +354 -0
- data/ext/boost/mpl/aux_/has_apply.hpp +32 -0
- data/ext/boost/mpl/aux_/has_type.hpp +23 -0
- data/ext/boost/mpl/aux_/include_preprocessed.hpp +42 -0
- data/ext/boost/mpl/aux_/integral_wrapper.hpp +93 -0
- data/ext/boost/mpl/aux_/lambda_arity_param.hpp +25 -0
- data/ext/boost/mpl/aux_/lambda_support.hpp +169 -0
- data/ext/boost/mpl/aux_/msvc_never_true.hpp +34 -0
- data/ext/boost/mpl/aux_/na.hpp +95 -0
- data/ext/boost/mpl/aux_/na_assert.hpp +34 -0
- data/ext/boost/mpl/aux_/na_fwd.hpp +31 -0
- data/ext/boost/mpl/aux_/na_spec.hpp +175 -0
- data/ext/boost/mpl/aux_/nested_type_wknd.hpp +48 -0
- data/ext/boost/mpl/aux_/nttp_decl.hpp +35 -0
- data/ext/boost/mpl/aux_/preprocessed/gcc/and.hpp +69 -0
- data/ext/boost/mpl/aux_/preprocessed/gcc/apply.hpp +169 -0
- data/ext/boost/mpl/aux_/preprocessed/gcc/apply_fwd.hpp +52 -0
- data/ext/boost/mpl/aux_/preprocessed/gcc/apply_wrap.hpp +84 -0
- data/ext/boost/mpl/aux_/preprocessed/gcc/arg.hpp +123 -0
- data/ext/boost/mpl/aux_/preprocessed/gcc/bind.hpp +561 -0
- data/ext/boost/mpl/aux_/preprocessed/gcc/bind_fwd.hpp +52 -0
- data/ext/boost/mpl/aux_/preprocessed/gcc/full_lambda.hpp +558 -0
- data/ext/boost/mpl/aux_/preprocessed/gcc/or.hpp +69 -0
- data/ext/boost/mpl/aux_/preprocessed/gcc/placeholders.hpp +105 -0
- data/ext/boost/mpl/aux_/preprocessed/gcc/quote.hpp +123 -0
- data/ext/boost/mpl/aux_/preprocessed/gcc/template_arity.hpp +101 -0
- data/ext/boost/mpl/aux_/preprocessor/def_params_tail.hpp +105 -0
- data/ext/boost/mpl/aux_/preprocessor/enum.hpp +62 -0
- data/ext/boost/mpl/aux_/preprocessor/filter_params.hpp +28 -0
- data/ext/boost/mpl/aux_/preprocessor/params.hpp +65 -0
- data/ext/boost/mpl/aux_/preprocessor/sub.hpp +65 -0
- data/ext/boost/mpl/aux_/static_cast.hpp +27 -0
- data/ext/boost/mpl/aux_/template_arity.hpp +189 -0
- data/ext/boost/mpl/aux_/template_arity_fwd.hpp +23 -0
- data/ext/boost/mpl/aux_/type_wrapper.hpp +47 -0
- data/ext/boost/mpl/aux_/value_wknd.hpp +89 -0
- data/ext/boost/mpl/aux_/yes_no.hpp +58 -0
- data/ext/boost/mpl/bind.hpp +551 -0
- data/ext/boost/mpl/bind_fwd.hpp +99 -0
- data/ext/boost/mpl/bool.hpp +39 -0
- data/ext/boost/mpl/bool_fwd.hpp +33 -0
- data/ext/boost/mpl/eval_if.hpp +71 -0
- data/ext/boost/mpl/has_xxx.hpp +272 -0
- data/ext/boost/mpl/identity.hpp +45 -0
- data/ext/boost/mpl/if.hpp +135 -0
- data/ext/boost/mpl/int.hpp +22 -0
- data/ext/boost/mpl/int_fwd.hpp +27 -0
- data/ext/boost/mpl/integral_c.hpp +51 -0
- data/ext/boost/mpl/integral_c_fwd.hpp +32 -0
- data/ext/boost/mpl/integral_c_tag.hpp +26 -0
- data/ext/boost/mpl/lambda.hpp +29 -0
- data/ext/boost/mpl/lambda_fwd.hpp +57 -0
- data/ext/boost/mpl/limits/arity.hpp +21 -0
- data/ext/boost/mpl/logical.hpp +21 -0
- data/ext/boost/mpl/next.hpp +19 -0
- data/ext/boost/mpl/next_prior.hpp +49 -0
- data/ext/boost/mpl/not.hpp +51 -0
- data/ext/boost/mpl/or.hpp +61 -0
- data/ext/boost/mpl/placeholders.hpp +100 -0
- data/ext/boost/mpl/protect.hpp +55 -0
- data/ext/boost/mpl/quote.hpp +140 -0
- data/ext/boost/mpl/size_t.hpp +25 -0
- data/ext/boost/mpl/size_t_fwd.hpp +28 -0
- data/ext/boost/mpl/void.hpp +76 -0
- data/ext/boost/mpl/void_fwd.hpp +26 -0
- data/ext/boost/next_prior.hpp +51 -0
- data/ext/boost/non_type.hpp +27 -0
- data/ext/boost/noncopyable.hpp +36 -0
- data/ext/boost/none.hpp +28 -0
- data/ext/boost/none_t.hpp +24 -0
- data/ext/boost/operators.hpp +943 -0
- data/ext/boost/optional.hpp +18 -0
- data/ext/boost/optional/optional.hpp +922 -0
- data/ext/boost/optional/optional_fwd.hpp +22 -0
- data/ext/boost/preprocessor/arithmetic/add.hpp +51 -0
- data/ext/boost/preprocessor/arithmetic/dec.hpp +288 -0
- data/ext/boost/preprocessor/arithmetic/inc.hpp +288 -0
- data/ext/boost/preprocessor/arithmetic/sub.hpp +50 -0
- data/ext/boost/preprocessor/array/data.hpp +28 -0
- data/ext/boost/preprocessor/array/elem.hpp +29 -0
- data/ext/boost/preprocessor/array/size.hpp +28 -0
- data/ext/boost/preprocessor/cat.hpp +35 -0
- data/ext/boost/preprocessor/comma_if.hpp +17 -0
- data/ext/boost/preprocessor/config/config.hpp +70 -0
- data/ext/boost/preprocessor/control/detail/while.hpp +536 -0
- data/ext/boost/preprocessor/control/expr_iif.hpp +31 -0
- data/ext/boost/preprocessor/control/if.hpp +30 -0
- data/ext/boost/preprocessor/control/iif.hpp +34 -0
- data/ext/boost/preprocessor/control/while.hpp +312 -0
- data/ext/boost/preprocessor/debug/error.hpp +33 -0
- data/ext/boost/preprocessor/detail/auto_rec.hpp +293 -0
- data/ext/boost/preprocessor/detail/check.hpp +48 -0
- data/ext/boost/preprocessor/detail/is_binary.hpp +30 -0
- data/ext/boost/preprocessor/empty.hpp +17 -0
- data/ext/boost/preprocessor/enum.hpp +17 -0
- data/ext/boost/preprocessor/enum_params.hpp +17 -0
- data/ext/boost/preprocessor/facilities/empty.hpp +21 -0
- data/ext/boost/preprocessor/facilities/identity.hpp +23 -0
- data/ext/boost/preprocessor/identity.hpp +17 -0
- data/ext/boost/preprocessor/inc.hpp +17 -0
- data/ext/boost/preprocessor/iterate.hpp +17 -0
- data/ext/boost/preprocessor/iteration/detail/bounds/lower1.hpp +99 -0
- data/ext/boost/preprocessor/iteration/detail/bounds/upper1.hpp +99 -0
- data/ext/boost/preprocessor/iteration/detail/iter/forward1.hpp +1342 -0
- data/ext/boost/preprocessor/iteration/iterate.hpp +82 -0
- data/ext/boost/preprocessor/list/adt.hpp +73 -0
- data/ext/boost/preprocessor/list/append.hpp +40 -0
- data/ext/boost/preprocessor/list/detail/fold_left.hpp +279 -0
- data/ext/boost/preprocessor/list/detail/fold_right.hpp +277 -0
- data/ext/boost/preprocessor/list/fold_left.hpp +303 -0
- data/ext/boost/preprocessor/list/fold_right.hpp +40 -0
- data/ext/boost/preprocessor/list/for_each_i.hpp +65 -0
- data/ext/boost/preprocessor/list/reverse.hpp +40 -0
- data/ext/boost/preprocessor/list/transform.hpp +49 -0
- data/ext/boost/preprocessor/logical/and.hpp +30 -0
- data/ext/boost/preprocessor/logical/bitand.hpp +38 -0
- data/ext/boost/preprocessor/logical/bool.hpp +288 -0
- data/ext/boost/preprocessor/logical/compl.hpp +36 -0
- data/ext/boost/preprocessor/punctuation/comma.hpp +21 -0
- data/ext/boost/preprocessor/punctuation/comma_if.hpp +31 -0
- data/ext/boost/preprocessor/repeat.hpp +17 -0
- data/ext/boost/preprocessor/repetition/detail/for.hpp +536 -0
- data/ext/boost/preprocessor/repetition/enum.hpp +66 -0
- data/ext/boost/preprocessor/repetition/enum_binary_params.hpp +54 -0
- data/ext/boost/preprocessor/repetition/enum_params.hpp +41 -0
- data/ext/boost/preprocessor/repetition/for.hpp +306 -0
- data/ext/boost/preprocessor/repetition/repeat.hpp +825 -0
- data/ext/boost/preprocessor/repetition/repeat_from_to.hpp +87 -0
- data/ext/boost/preprocessor/seq/elem.hpp +304 -0
- data/ext/boost/preprocessor/seq/enum.hpp +288 -0
- data/ext/boost/preprocessor/seq/for_each_i.hpp +61 -0
- data/ext/boost/preprocessor/seq/seq.hpp +44 -0
- data/ext/boost/preprocessor/seq/size.hpp +548 -0
- data/ext/boost/preprocessor/slot/detail/def.hpp +49 -0
- data/ext/boost/preprocessor/slot/detail/shared.hpp +247 -0
- data/ext/boost/preprocessor/slot/slot.hpp +32 -0
- data/ext/boost/preprocessor/stringize.hpp +33 -0
- data/ext/boost/preprocessor/tuple/eat.hpp +57 -0
- data/ext/boost/preprocessor/tuple/elem.hpp +385 -0
- data/ext/boost/preprocessor/tuple/rem.hpp +72 -0
- data/ext/boost/preprocessor/tuple/to_list.hpp +62 -0
- data/ext/boost/range/as_literal.hpp +131 -0
- data/ext/boost/range/begin.hpp +132 -0
- data/ext/boost/range/config.hpp +54 -0
- data/ext/boost/range/const_iterator.hpp +64 -0
- data/ext/boost/range/detail/common.hpp +117 -0
- data/ext/boost/range/detail/implementation_help.hpp +99 -0
- data/ext/boost/range/detail/sfinae.hpp +77 -0
- data/ext/boost/range/detail/str_types.hpp +38 -0
- data/ext/boost/range/difference_type.hpp +29 -0
- data/ext/boost/range/distance.hpp +34 -0
- data/ext/boost/range/empty.hpp +34 -0
- data/ext/boost/range/end.hpp +131 -0
- data/ext/boost/range/functions.hpp +27 -0
- data/ext/boost/range/iterator.hpp +72 -0
- data/ext/boost/range/iterator_range.hpp +643 -0
- data/ext/boost/range/mutable_iterator.hpp +64 -0
- data/ext/boost/range/rbegin.hpp +65 -0
- data/ext/boost/range/rend.hpp +65 -0
- data/ext/boost/range/reverse_iterator.hpp +40 -0
- data/ext/boost/range/size.hpp +36 -0
- data/ext/boost/range/size_type.hpp +78 -0
- data/ext/boost/range/value_type.hpp +34 -0
- data/ext/boost/ref.hpp +178 -0
- data/ext/boost/shared_ptr.hpp +619 -0
- data/ext/boost/src/pthread/exceptions.cpp +146 -0
- data/ext/boost/src/pthread/once.cpp +51 -0
- data/ext/boost/src/pthread/thread.cpp +709 -0
- data/ext/boost/src/pthread/timeconv.inl +130 -0
- data/ext/boost/src/tss_null.cpp +34 -0
- data/ext/boost/src/win32/exceptions.cpp +124 -0
- data/ext/boost/src/win32/thread.cpp +629 -0
- data/ext/boost/src/win32/timeconv.inl +130 -0
- data/ext/boost/src/win32/tss_dll.cpp +72 -0
- data/ext/boost/src/win32/tss_pe.cpp +269 -0
- data/ext/boost/static_assert.hpp +122 -0
- data/ext/boost/thread.hpp +21 -0
- data/ext/boost/thread/condition.hpp +16 -0
- data/ext/boost/thread/condition_variable.hpp +21 -0
- data/ext/boost/thread/detail/config.hpp +94 -0
- data/ext/boost/thread/detail/move.hpp +33 -0
- data/ext/boost/thread/detail/platform.hpp +71 -0
- data/ext/boost/thread/exceptions.hpp +109 -0
- data/ext/boost/thread/locks.hpp +589 -0
- data/ext/boost/thread/mutex.hpp +21 -0
- data/ext/boost/thread/once.hpp +29 -0
- data/ext/boost/thread/pthread/condition_variable.hpp +184 -0
- data/ext/boost/thread/pthread/condition_variable_fwd.hpp +66 -0
- data/ext/boost/thread/pthread/mutex.hpp +211 -0
- data/ext/boost/thread/pthread/once.hpp +85 -0
- data/ext/boost/thread/pthread/pthread_mutex_scoped_lock.hpp +50 -0
- data/ext/boost/thread/pthread/recursive_mutex.hpp +249 -0
- data/ext/boost/thread/pthread/thread.hpp +339 -0
- data/ext/boost/thread/pthread/thread_data.hpp +102 -0
- data/ext/boost/thread/pthread/timespec.hpp +28 -0
- data/ext/boost/thread/pthread/tss.hpp +103 -0
- data/ext/boost/thread/recursive_mutex.hpp +21 -0
- data/ext/boost/thread/thread.hpp +22 -0
- data/ext/boost/thread/thread_time.hpp +46 -0
- data/ext/boost/thread/tss.hpp +18 -0
- data/ext/boost/thread/xtime.hpp +88 -0
- data/ext/boost/throw_exception.hpp +46 -0
- data/ext/boost/token_functions.hpp +621 -0
- data/ext/boost/token_iterator.hpp +128 -0
- data/ext/boost/tokenizer.hpp +98 -0
- data/ext/boost/type.hpp +18 -0
- data/ext/boost/type_traits/add_const.hpp +47 -0
- data/ext/boost/type_traits/add_pointer.hpp +72 -0
- data/ext/boost/type_traits/add_reference.hpp +89 -0
- data/ext/boost/type_traits/alignment_of.hpp +100 -0
- data/ext/boost/type_traits/broken_compiler_spec.hpp +117 -0
- data/ext/boost/type_traits/composite_traits.hpp +29 -0
- data/ext/boost/type_traits/config.hpp +76 -0
- data/ext/boost/type_traits/conversion_traits.hpp +17 -0
- data/ext/boost/type_traits/detail/bool_trait_def.hpp +173 -0
- data/ext/boost/type_traits/detail/bool_trait_undef.hpp +27 -0
- data/ext/boost/type_traits/detail/cv_traits_impl.hpp +97 -0
- data/ext/boost/type_traits/detail/false_result.hpp +28 -0
- data/ext/boost/type_traits/detail/ice_and.hpp +35 -0
- data/ext/boost/type_traits/detail/ice_eq.hpp +36 -0
- data/ext/boost/type_traits/detail/ice_not.hpp +31 -0
- data/ext/boost/type_traits/detail/ice_or.hpp +34 -0
- data/ext/boost/type_traits/detail/is_function_ptr_helper.hpp +220 -0
- data/ext/boost/type_traits/detail/is_mem_fun_pointer_impl.hpp +817 -0
- data/ext/boost/type_traits/detail/size_t_trait_def.hpp +58 -0
- data/ext/boost/type_traits/detail/size_t_trait_undef.hpp +16 -0
- data/ext/boost/type_traits/detail/template_arity_spec.hpp +31 -0
- data/ext/boost/type_traits/detail/type_trait_def.hpp +61 -0
- data/ext/boost/type_traits/detail/type_trait_undef.hpp +19 -0
- data/ext/boost/type_traits/detail/yes_no_type.hpp +26 -0
- data/ext/boost/type_traits/function_traits.hpp +236 -0
- data/ext/boost/type_traits/has_nothrow_copy.hpp +39 -0
- data/ext/boost/type_traits/has_trivial_copy.hpp +49 -0
- data/ext/boost/type_traits/ice.hpp +20 -0
- data/ext/boost/type_traits/integral_constant.hpp +53 -0
- data/ext/boost/type_traits/intrinsics.hpp +153 -0
- data/ext/boost/type_traits/is_abstract.hpp +144 -0
- data/ext/boost/type_traits/is_arithmetic.hpp +43 -0
- data/ext/boost/type_traits/is_array.hpp +90 -0
- data/ext/boost/type_traits/is_class.hpp +128 -0
- data/ext/boost/type_traits/is_const.hpp +142 -0
- data/ext/boost/type_traits/is_convertible.hpp +418 -0
- data/ext/boost/type_traits/is_enum.hpp +180 -0
- data/ext/boost/type_traits/is_float.hpp +27 -0
- data/ext/boost/type_traits/is_function.hpp +95 -0
- data/ext/boost/type_traits/is_integral.hpp +73 -0
- data/ext/boost/type_traits/is_member_function_pointer.hpp +134 -0
- data/ext/boost/type_traits/is_member_pointer.hpp +114 -0
- data/ext/boost/type_traits/is_pod.hpp +135 -0
- data/ext/boost/type_traits/is_pointer.hpp +160 -0
- data/ext/boost/type_traits/is_reference.hpp +116 -0
- data/ext/boost/type_traits/is_same.hpp +103 -0
- data/ext/boost/type_traits/is_scalar.hpp +55 -0
- data/ext/boost/type_traits/is_union.hpp +49 -0
- data/ext/boost/type_traits/is_void.hpp +33 -0
- data/ext/boost/type_traits/is_volatile.hpp +131 -0
- data/ext/boost/type_traits/remove_const.hpp +78 -0
- data/ext/boost/type_traits/remove_cv.hpp +61 -0
- data/ext/boost/type_traits/remove_pointer.hpp +43 -0
- data/ext/boost/type_traits/remove_reference.hpp +50 -0
- data/ext/boost/type_traits/type_with_alignment.hpp +288 -0
- data/ext/boost/utility.hpp +19 -0
- data/ext/boost/utility/addressof.hpp +58 -0
- data/ext/boost/utility/base_from_member.hpp +87 -0
- data/ext/boost/utility/compare_pointees.hpp +68 -0
- data/ext/boost/utility/enable_if.hpp +119 -0
- data/ext/boost/visit_each.hpp +29 -0
- data/ext/boost/weak_ptr.hpp +188 -0
- data/ext/common/Application.h +511 -0
- data/ext/common/ApplicationPool.h +205 -0
- data/ext/common/ApplicationPoolServer.h +794 -0
- data/ext/common/ApplicationPoolServerExecutable.cpp +743 -0
- data/ext/common/ApplicationPoolStatusReporter.h +336 -0
- data/ext/common/Base64.cpp +143 -0
- data/ext/common/Base64.h +57 -0
- data/ext/common/CachedFileStat.cpp +62 -0
- data/ext/common/CachedFileStat.h +51 -0
- data/ext/common/CachedFileStat.hpp +243 -0
- data/ext/common/DummySpawnManager.h +108 -0
- data/ext/common/Exceptions.h +258 -0
- data/ext/common/FileChangeChecker.h +209 -0
- data/ext/common/Logging.cpp +65 -0
- data/ext/common/Logging.h +123 -0
- data/ext/common/MessageChannel.h +615 -0
- data/ext/common/PoolOptions.h +355 -0
- data/ext/common/SpawnManager.h +561 -0
- data/ext/common/StandardApplicationPool.h +821 -0
- data/ext/common/StaticString.h +148 -0
- data/ext/common/StringListCreator.h +83 -0
- data/ext/common/SystemTime.cpp +33 -0
- data/ext/common/SystemTime.h +88 -0
- data/ext/common/Timer.h +90 -0
- data/ext/common/Utils.cpp +681 -0
- data/ext/common/Utils.h +497 -0
- data/ext/common/Version.h +31 -0
- data/ext/nginx/Configuration.c +1098 -0
- data/ext/nginx/Configuration.h +71 -0
- data/ext/nginx/ContentHandler.c +1225 -0
- data/ext/nginx/ContentHandler.h +64 -0
- data/ext/nginx/HelperServer.cpp +850 -0
- data/ext/nginx/HttpStatusExtractor.h +350 -0
- data/ext/nginx/ScgiRequestParser.h +317 -0
- data/ext/nginx/StaticContentHandler.c +257 -0
- data/ext/nginx/StaticContentHandler.h +37 -0
- data/ext/nginx/config +45 -0
- data/ext/nginx/ngx_http_passenger_module.c +653 -0
- data/ext/nginx/ngx_http_passenger_module.h +72 -0
- data/ext/oxt/backtrace.cpp +177 -0
- data/ext/oxt/backtrace.hpp +135 -0
- data/ext/oxt/detail/backtrace_disabled.hpp +39 -0
- data/ext/oxt/detail/backtrace_enabled.hpp +155 -0
- data/ext/oxt/detail/spin_lock_gcc_x86.hpp +82 -0
- data/ext/oxt/detail/spin_lock_portable.hpp +38 -0
- data/ext/oxt/detail/spin_lock_pthreads.hpp +97 -0
- data/ext/oxt/detail/tracable_exception_disabled.hpp +46 -0
- data/ext/oxt/detail/tracable_exception_enabled.hpp +48 -0
- data/ext/oxt/macros.hpp +58 -0
- data/ext/oxt/spin_lock.hpp +55 -0
- data/ext/oxt/system_calls.cpp +351 -0
- data/ext/oxt/system_calls.hpp +244 -0
- data/ext/oxt/thread.cpp +32 -0
- data/ext/oxt/thread.hpp +335 -0
- data/ext/oxt/tracable_exception.cpp +87 -0
- data/ext/oxt/tracable_exception.hpp +35 -0
- data/ext/phusion_passenger/extconf.rb +36 -0
- data/ext/phusion_passenger/native_support.c +308 -0
- data/lib/jeweler_spec.rb +86 -0
- data/lib/phusion_passenger/abstract_installer.rb +196 -0
- data/lib/phusion_passenger/abstract_request_handler.rb +475 -0
- data/lib/phusion_passenger/abstract_server.rb +369 -0
- data/lib/phusion_passenger/abstract_server_collection.rb +306 -0
- data/lib/phusion_passenger/admin_tools.rb +48 -0
- data/lib/phusion_passenger/admin_tools/control_process.rb +150 -0
- data/lib/phusion_passenger/application.rb +113 -0
- data/lib/phusion_passenger/console_text_template.rb +66 -0
- data/lib/phusion_passenger/constants.rb +31 -0
- data/lib/phusion_passenger/dependencies.rb +425 -0
- data/lib/phusion_passenger/events.rb +50 -0
- data/lib/phusion_passenger/exceptions.rb +103 -0
- data/lib/phusion_passenger/html_template.rb +109 -0
- data/lib/phusion_passenger/message_channel.rb +229 -0
- data/lib/phusion_passenger/packaging.rb +39 -0
- data/lib/phusion_passenger/platform_info.rb +550 -0
- data/lib/phusion_passenger/rack/application_spawner.rb +146 -0
- data/lib/phusion_passenger/rack/request_handler.rb +122 -0
- data/lib/phusion_passenger/railz/application_spawner.rb +412 -0
- data/lib/phusion_passenger/railz/cgi_fixed.rb +68 -0
- data/lib/phusion_passenger/railz/framework_spawner.rb +334 -0
- data/lib/phusion_passenger/railz/request_handler.rb +73 -0
- data/lib/phusion_passenger/simple_benchmarking.rb +52 -0
- data/lib/phusion_passenger/spawn_manager.rb +372 -0
- data/lib/phusion_passenger/templates/apache2/apache_must_be_compiled_with_compatible_mpm.txt.erb +9 -0
- data/lib/phusion_passenger/templates/apache2/config_snippets.txt.erb +13 -0
- data/lib/phusion_passenger/templates/apache2/deployment_example.txt.erb +23 -0
- data/lib/phusion_passenger/templates/apache2/no_write_permission_to_passenger_root.txt.erb +9 -0
- data/lib/phusion_passenger/templates/apache2/possible_solutions_for_compilation_and_installation_problems.txt.erb +11 -0
- data/lib/phusion_passenger/templates/apache2/run_installer_as_root.txt.erb +8 -0
- data/lib/phusion_passenger/templates/apache2/welcome.txt.erb +15 -0
- data/lib/phusion_passenger/templates/app_exited_during_initialization.html.erb +14 -0
- data/lib/phusion_passenger/templates/app_init_error.html.erb +46 -0
- data/lib/phusion_passenger/templates/database_error.html.erb +24 -0
- data/lib/phusion_passenger/templates/error_layout.css +97 -0
- data/lib/phusion_passenger/templates/error_layout.html.erb +39 -0
- data/lib/phusion_passenger/templates/framework_init_error.html.erb +10 -0
- data/lib/phusion_passenger/templates/general_error.html.erb +8 -0
- data/lib/phusion_passenger/templates/invalid_app_root.html.erb +9 -0
- data/lib/phusion_passenger/templates/load_error.html.erb +6 -0
- data/lib/phusion_passenger/templates/nginx/ask_for_extra_configure_flags.txt.erb +8 -0
- data/lib/phusion_passenger/templates/nginx/cannot_write_to_dir.txt.erb +11 -0
- data/lib/phusion_passenger/templates/nginx/config_snippets.txt.erb +17 -0
- data/lib/phusion_passenger/templates/nginx/config_snippets_inserted.txt.erb +20 -0
- data/lib/phusion_passenger/templates/nginx/confirm_extra_configure_flags.txt.erb +5 -0
- data/lib/phusion_passenger/templates/nginx/deployment_example.txt.erb +22 -0
- data/lib/phusion_passenger/templates/nginx/pcre_could_not_be_downloaded.txt.erb +11 -0
- data/lib/phusion_passenger/templates/nginx/pcre_could_not_be_extracted.txt.erb +11 -0
- data/lib/phusion_passenger/templates/nginx/possible_solutions_for_compilation_and_installation_problems.txt.erb +11 -0
- data/lib/phusion_passenger/templates/nginx/possible_solutions_for_download_and_extraction_problems.txt.erb +20 -0
- data/lib/phusion_passenger/templates/nginx/query_download_and_install.txt.erb +21 -0
- data/lib/phusion_passenger/templates/nginx/run_installer_as_root.txt.erb +8 -0
- data/lib/phusion_passenger/templates/nginx/welcome.txt.erb +15 -0
- data/lib/phusion_passenger/templates/version_not_found.html.erb +6 -0
- data/lib/phusion_passenger/utils.rb +611 -0
- data/lib/phusion_passenger/utils/rewindable_input.rb +116 -0
- data/lib/phusion_passenger/wsgi/application_spawner.rb +104 -0
- data/lib/phusion_passenger/wsgi/request_handler.py +199 -0
- data/man/passenger-config.1 +29 -0
- data/man/passenger-make-enterprisey.8 +23 -0
- data/man/passenger-memory-stats.8 +33 -0
- data/man/passenger-status.8 +43 -0
- data/man/passenger-stress-test.1 +43 -0
- data/misc/copy_boost_headers.rb +125 -0
- data/misc/find_owner_pipe_leaks.rb +128 -0
- data/misc/rake/cplusplus.rb +57 -0
- data/misc/rake/extensions.rb +182 -0
- data/misc/rake/gempackagetask.rb +99 -0
- data/misc/rake/packagetask.rb +186 -0
- data/misc/rake/rdoctask.rb +209 -0
- data/misc/render_error_pages.rb +116 -0
- data/test/ApplicationPoolServerTest.cpp +114 -0
- data/test/ApplicationPoolServer_ApplicationPoolTest.cpp +33 -0
- data/test/ApplicationPoolTest.cpp +599 -0
- data/test/Base64Test.cpp +48 -0
- data/test/CachedFileStatTest.cpp +402 -0
- data/test/CxxTestMain.cpp +143 -0
- data/test/FileChangeCheckerTest.cpp +331 -0
- data/test/HttpStatusExtractorTest.cpp +198 -0
- data/test/MessageChannelTest.cpp +312 -0
- data/test/PoolOptionsTest.cpp +117 -0
- data/test/ScgiRequestParserTest.cpp +337 -0
- data/test/SpawnManagerTest.cpp +64 -0
- data/test/StandardApplicationPoolTest.cpp +27 -0
- data/test/StaticStringTest.cpp +51 -0
- data/test/SystemTimeTest.cpp +37 -0
- data/test/UtilsTest.cpp +257 -0
- data/test/config.yml.example +30 -0
- data/test/integration_tests/apache2_tests.rb +595 -0
- data/test/integration_tests/hello_world_rack_spec.rb +36 -0
- data/test/integration_tests/hello_world_wsgi_spec.rb +41 -0
- data/test/integration_tests/mycook_spec.rb +192 -0
- data/test/integration_tests/nginx_tests.rb +151 -0
- data/test/oxt/backtrace_test.cpp +128 -0
- data/test/oxt/oxt_test_main.cpp +25 -0
- data/test/oxt/syscall_interruption_test.cpp +38 -0
- data/test/ruby/abstract_request_handler_spec.rb +85 -0
- data/test/ruby/abstract_server_collection_spec.rb +246 -0
- data/test/ruby/abstract_server_spec.rb +51 -0
- data/test/ruby/application_spec.rb +43 -0
- data/test/ruby/message_channel_spec.rb +170 -0
- data/test/ruby/rack/application_spawner_spec.rb +99 -0
- data/test/ruby/rails/application_spawner_spec.rb +159 -0
- data/test/ruby/rails/framework_spawner_spec.rb +133 -0
- data/test/ruby/rails/minimal_spawner_spec.rb +93 -0
- data/test/ruby/rails/spawner_error_handling_spec.rb +107 -0
- data/test/ruby/rails/spawner_privilege_lowering_spec.rb +97 -0
- data/test/ruby/spawn_manager_spec.rb +205 -0
- data/test/ruby/spawn_server_spec.rb +26 -0
- data/test/ruby/utils_spec.rb +335 -0
- data/test/ruby/wsgi/application_spawner_spec.rb +54 -0
- data/test/stub/apache2/httpd.conf.erb +81 -0
- data/test/stub/apache2/mime.types +748 -0
- data/test/stub/garbage1.dat +0 -0
- data/test/stub/garbage2.dat +0 -0
- data/test/stub/garbage3.dat +0 -0
- data/test/stub/http_request.yml +23 -0
- data/test/stub/message_channel.rb +9 -0
- data/test/stub/message_channel_2.rb +10 -0
- data/test/stub/message_channel_3.rb +17 -0
- data/test/stub/nginx/koi-utf +109 -0
- data/test/stub/nginx/koi-win +103 -0
- data/test/stub/nginx/mime.types +70 -0
- data/test/stub/nginx/nginx.conf.erb +57 -0
- data/test/stub/nginx/win-utf +126 -0
- data/test/stub/rack/config.ru +4 -0
- data/test/stub/rack/public/rack.jpg +0 -0
- data/test/stub/rails_apps/foobar/app/controllers/application.rb +12 -0
- data/test/stub/rails_apps/foobar/app/controllers/bar_controller_1.rb +5 -0
- data/test/stub/rails_apps/foobar/app/controllers/bar_controller_2.rb +5 -0
- data/test/stub/rails_apps/foobar/app/controllers/foo_controller.rb +21 -0
- data/test/stub/rails_apps/foobar/app/helpers/application_helper.rb +3 -0
- data/test/stub/rails_apps/foobar/config/boot.rb +108 -0
- data/test/stub/rails_apps/foobar/config/database.yml +19 -0
- data/test/stub/rails_apps/foobar/config/environment.rb +59 -0
- data/test/stub/rails_apps/foobar/config/environments/development.rb +17 -0
- data/test/stub/rails_apps/foobar/config/environments/production.rb +18 -0
- data/test/stub/rails_apps/foobar/config/initializers/inflections.rb +10 -0
- data/test/stub/rails_apps/foobar/config/initializers/mime_types.rb +5 -0
- data/test/stub/rails_apps/foobar/config/routes.rb +35 -0
- data/test/stub/rails_apps/mycook/app/controllers/application.rb +12 -0
- data/test/stub/rails_apps/mycook/app/controllers/recipes_controller.rb +5 -0
- data/test/stub/rails_apps/mycook/app/controllers/uploads_controller.rb +15 -0
- data/test/stub/rails_apps/mycook/app/controllers/welcome_controller.rb +71 -0
- data/test/stub/rails_apps/mycook/app/helpers/application_helper.rb +3 -0
- data/test/stub/rails_apps/mycook/app/views/layouts/default.rhtml +26 -0
- data/test/stub/rails_apps/mycook/app/views/recipes/create.rhtml +13 -0
- data/test/stub/rails_apps/mycook/app/views/recipes/index.rhtml +3 -0
- data/test/stub/rails_apps/mycook/app/views/recipes/new.rhtml +8 -0
- data/test/stub/rails_apps/mycook/app/views/uploads/index.rhtml +1 -0
- data/test/stub/rails_apps/mycook/app/views/uploads/new.html.erb +8 -0
- data/test/stub/rails_apps/mycook/app/views/welcome/cached.rhtml +1 -0
- data/test/stub/rails_apps/mycook/app/views/welcome/index.rhtml +20 -0
- data/test/stub/rails_apps/mycook/config/boot.rb +108 -0
- data/test/stub/rails_apps/mycook/config/database.yml +19 -0
- data/test/stub/rails_apps/mycook/config/environment.rb +61 -0
- data/test/stub/rails_apps/mycook/config/environments/development.rb +18 -0
- data/test/stub/rails_apps/mycook/config/environments/production.rb +19 -0
- data/test/stub/rails_apps/mycook/config/initializers/inflections.rb +10 -0
- data/test/stub/rails_apps/mycook/config/initializers/mime_types.rb +5 -0
- data/test/stub/rails_apps/mycook/config/routes.rb +38 -0
- data/test/stub/rails_apps/mycook/log/useless.txt +1 -0
- data/test/stub/rails_apps/mycook/public/404.html +30 -0
- data/test/stub/rails_apps/mycook/public/422.html +30 -0
- data/test/stub/rails_apps/mycook/public/500.html +30 -0
- data/test/stub/rails_apps/mycook/public/dispatch.cgi +10 -0
- data/test/stub/rails_apps/mycook/public/dispatch.fcgi +24 -0
- data/test/stub/rails_apps/mycook/public/dispatch.rb +10 -0
- data/test/stub/rails_apps/mycook/public/favicon.ico +0 -0
- data/test/stub/rails_apps/mycook/public/images/angrywizard.gif +0 -0
- data/test/stub/rails_apps/mycook/public/images/cookbook.gif +0 -0
- data/test/stub/rails_apps/mycook/public/images/header.png +0 -0
- data/test/stub/rails_apps/mycook/public/images/rails.png +0 -0
- data/test/stub/rails_apps/mycook/public/javascripts/application.js +2 -0
- data/test/stub/rails_apps/mycook/public/javascripts/controls.js +963 -0
- data/test/stub/rails_apps/mycook/public/javascripts/dragdrop.js +972 -0
- data/test/stub/rails_apps/mycook/public/javascripts/effects.js +1120 -0
- data/test/stub/rails_apps/mycook/public/javascripts/prototype.js +4225 -0
- data/test/stub/rails_apps/mycook/public/robots.txt +5 -0
- data/test/stub/rails_apps/mycook/public/uploads.html +26 -0
- data/test/stub/rails_apps/mycook/public/welcome/cached.html +26 -0
- data/test/stub/rails_apps/mycook/sites/some.site/public/uploads.html +26 -0
- data/test/stub/rails_apps/mycook/sites/some.site/public/welcome/cached.html +26 -0
- data/test/stub/rails_apps/mycook/tmp/cache/useless.txt +1 -0
- data/test/stub/rails_apps/mycook/tmp/pids/useless.txt +1 -0
- data/test/stub/rails_apps/mycook/tmp/sessions/useless.txt +1 -0
- data/test/stub/rails_apps/mycook/tmp/sockets/useless.txt +1 -0
- data/test/stub/spawn_server.rb +20 -0
- data/test/stub/upload_data.txt +494 -0
- data/test/stub/vendor_rails/minimal/README +1 -0
- data/test/stub/vendor_rails/minimal/actionmailer/lib/action_mailer.rb +0 -0
- data/test/stub/vendor_rails/minimal/actionpack/lib/action_controller.rb +19 -0
- data/test/stub/vendor_rails/minimal/actionpack/lib/action_pack.rb +0 -0
- data/test/stub/vendor_rails/minimal/actionpack/lib/action_view.rb +0 -0
- data/test/stub/vendor_rails/minimal/activerecord/lib/active_record.rb +7 -0
- data/test/stub/vendor_rails/minimal/activeresource/lib/active_resource.rb +0 -0
- data/test/stub/vendor_rails/minimal/activesupport/lib/active_support.rb +17 -0
- data/test/stub/vendor_rails/minimal/activesupport/lib/active_support/whiny_nil.rb +0 -0
- data/test/stub/vendor_rails/minimal/railties/lib/dispatcher.rb +0 -0
- data/test/stub/vendor_rails/minimal/railties/lib/initializer.rb +52 -0
- data/test/stub/vendor_rails/minimal/railties/lib/ruby_version_check.rb +1 -0
- data/test/stub/wsgi/passenger_wsgi.py +3 -0
- data/test/stub/wsgi/public/wsgi-snake.jpg +0 -0
- data/test/stub/zsfa/header.png +0 -0
- data/test/stub/zsfa/index.html +14 -0
- data/test/stub/zsfa/zsfa.png +0 -0
- data/test/support/Support.cpp +84 -0
- data/test/support/Support.h +118 -0
- data/test/support/apache2_controller.rb +250 -0
- data/test/support/config.rb +38 -0
- data/test/support/multipart.rb +62 -0
- data/test/support/nginx_controller.rb +98 -0
- data/test/support/run_rspec_tests.rb +10 -0
- data/test/support/test_helper.rb +207 -0
- data/test/support/tut.h +1234 -0
- data/test/support/tut_reporter.h +256 -0
- data/test/support/valgrind.h +2539 -0
- metadata +1078 -0
@@ -0,0 +1,257 @@
|
|
1
|
+
/*
|
2
|
+
* Copyright (C) Igor Sysoev
|
3
|
+
* Copyright (C) 2009 Phusion
|
4
|
+
*
|
5
|
+
* Redistribution and use in source and binary forms, with or without
|
6
|
+
* modification, are permitted provided that the following conditions
|
7
|
+
* are met:
|
8
|
+
* 1. Redistributions of source code must retain the above copyright
|
9
|
+
* notice, this list of conditions and the following disclaimer.
|
10
|
+
* 2. Redistributions in binary form must reproduce the above copyright
|
11
|
+
* notice, this list of conditions and the following disclaimer in the
|
12
|
+
* documentation and/or other materials provided with the distribution.
|
13
|
+
*
|
14
|
+
* THIS SOFTWARE IS PROVIDED BY AUTHOR AND CONTRIBUTORS ``AS IS'' AND
|
15
|
+
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
16
|
+
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
17
|
+
* ARE DISCLAIMED. IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE
|
18
|
+
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
19
|
+
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
20
|
+
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
21
|
+
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
22
|
+
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
23
|
+
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
24
|
+
* SUCH DAMAGE.
|
25
|
+
*/
|
26
|
+
|
27
|
+
#include "StaticContentHandler.h"
|
28
|
+
|
29
|
+
static void
|
30
|
+
set_request_extension(ngx_http_request_t *r, ngx_str_t *filename) {
|
31
|
+
u_char *tmp;
|
32
|
+
|
33
|
+
/* Scan filename from the right until we've found a slash or a dot. */
|
34
|
+
tmp = filename->data + filename->len - 1;
|
35
|
+
while (tmp >= filename->data && *tmp != '/' && *tmp != '.') {
|
36
|
+
tmp--;
|
37
|
+
}
|
38
|
+
if (tmp >= filename->data && *tmp == '.') {
|
39
|
+
/* We found a dot, and until now we haven't seen any slashes.
|
40
|
+
* So we know that this is the filename's extension.
|
41
|
+
*/
|
42
|
+
tmp++;
|
43
|
+
r->exten.data = tmp;
|
44
|
+
r->exten.len = filename->len - (tmp - filename->data);
|
45
|
+
}
|
46
|
+
}
|
47
|
+
|
48
|
+
ngx_int_t
|
49
|
+
passenger_static_content_handler(ngx_http_request_t *r, ngx_str_t *filename)
|
50
|
+
{
|
51
|
+
u_char *last, *location;
|
52
|
+
size_t len;
|
53
|
+
ngx_int_t rc;
|
54
|
+
ngx_uint_t level;
|
55
|
+
ngx_log_t *log;
|
56
|
+
ngx_buf_t *b;
|
57
|
+
ngx_chain_t out;
|
58
|
+
ngx_open_file_info_t of;
|
59
|
+
ngx_http_core_loc_conf_t *clcf;
|
60
|
+
|
61
|
+
if (!(r->method & (NGX_HTTP_GET|NGX_HTTP_HEAD|NGX_HTTP_POST))) {
|
62
|
+
return NGX_HTTP_NOT_ALLOWED;
|
63
|
+
}
|
64
|
+
|
65
|
+
if (r->uri.data[r->uri.len - 1] == '/') {
|
66
|
+
return NGX_DECLINED;
|
67
|
+
}
|
68
|
+
|
69
|
+
if (r->zero_in_uri) {
|
70
|
+
return NGX_DECLINED;
|
71
|
+
}
|
72
|
+
|
73
|
+
log = r->connection->log;
|
74
|
+
|
75
|
+
ngx_log_debug1(NGX_LOG_DEBUG_HTTP, log, 0,
|
76
|
+
"http filename: \"%s\"", filename->data);
|
77
|
+
|
78
|
+
clcf = ngx_http_get_module_loc_conf(r, ngx_http_core_module);
|
79
|
+
|
80
|
+
ngx_memzero(&of, sizeof(ngx_open_file_info_t));
|
81
|
+
#if NGINX_VERSION_NUM < 7000
|
82
|
+
of.test_dir = 0;
|
83
|
+
#else
|
84
|
+
of.directio = clcf->directio;
|
85
|
+
#endif
|
86
|
+
of.valid = clcf->open_file_cache_valid;
|
87
|
+
of.min_uses = clcf->open_file_cache_min_uses;
|
88
|
+
of.errors = clcf->open_file_cache_errors;
|
89
|
+
of.events = clcf->open_file_cache_events;
|
90
|
+
|
91
|
+
if (ngx_open_cached_file(clcf->open_file_cache, filename, &of, r->pool)
|
92
|
+
!= NGX_OK)
|
93
|
+
{
|
94
|
+
switch (of.err) {
|
95
|
+
|
96
|
+
case 0:
|
97
|
+
return NGX_HTTP_INTERNAL_SERVER_ERROR;
|
98
|
+
|
99
|
+
case NGX_ENOENT:
|
100
|
+
case NGX_ENOTDIR:
|
101
|
+
case NGX_ENAMETOOLONG:
|
102
|
+
|
103
|
+
level = NGX_LOG_ERR;
|
104
|
+
rc = NGX_HTTP_NOT_FOUND;
|
105
|
+
break;
|
106
|
+
|
107
|
+
case NGX_EACCES:
|
108
|
+
|
109
|
+
level = NGX_LOG_ERR;
|
110
|
+
rc = NGX_HTTP_FORBIDDEN;
|
111
|
+
break;
|
112
|
+
|
113
|
+
default:
|
114
|
+
|
115
|
+
level = NGX_LOG_CRIT;
|
116
|
+
rc = NGX_HTTP_INTERNAL_SERVER_ERROR;
|
117
|
+
break;
|
118
|
+
}
|
119
|
+
|
120
|
+
if (rc != NGX_HTTP_NOT_FOUND || clcf->log_not_found) {
|
121
|
+
ngx_log_error(level, log, of.err,
|
122
|
+
ngx_open_file_n " \"%s\" failed", filename->data);
|
123
|
+
}
|
124
|
+
|
125
|
+
return rc;
|
126
|
+
}
|
127
|
+
|
128
|
+
#if NGINX_VERSION_NUM >= 7000
|
129
|
+
r->root_tested = !r->error_page;
|
130
|
+
#endif
|
131
|
+
|
132
|
+
ngx_log_debug1(NGX_LOG_DEBUG_HTTP, log, 0, "http static fd: %d", of.fd);
|
133
|
+
|
134
|
+
if (of.is_dir) {
|
135
|
+
|
136
|
+
ngx_log_debug0(NGX_LOG_DEBUG_HTTP, log, 0, "http dir");
|
137
|
+
|
138
|
+
r->headers_out.location = ngx_palloc(r->pool, sizeof(ngx_table_elt_t));
|
139
|
+
if (r->headers_out.location == NULL) {
|
140
|
+
return NGX_HTTP_INTERNAL_SERVER_ERROR;
|
141
|
+
}
|
142
|
+
|
143
|
+
len = r->uri.len + 1;
|
144
|
+
|
145
|
+
if (!clcf->alias && clcf->root_lengths == NULL && r->args.len == 0) {
|
146
|
+
location = filename->data + clcf->root.len;
|
147
|
+
|
148
|
+
} else {
|
149
|
+
if (r->args.len) {
|
150
|
+
len += r->args.len + 1;
|
151
|
+
}
|
152
|
+
|
153
|
+
#if NGINX_VERSION_NUM < 7000
|
154
|
+
location = ngx_palloc(r->pool, len);
|
155
|
+
#else
|
156
|
+
location = ngx_pnalloc(r->pool, len);
|
157
|
+
#endif
|
158
|
+
if (location == NULL) {
|
159
|
+
return NGX_HTTP_INTERNAL_SERVER_ERROR;
|
160
|
+
}
|
161
|
+
|
162
|
+
last = ngx_copy(location, r->uri.data, r->uri.len);
|
163
|
+
|
164
|
+
*last = '/';
|
165
|
+
|
166
|
+
if (r->args.len) {
|
167
|
+
*++last = '?';
|
168
|
+
ngx_memcpy(++last, r->args.data, r->args.len);
|
169
|
+
}
|
170
|
+
}
|
171
|
+
|
172
|
+
/*
|
173
|
+
* we do not need to set the r->headers_out.location->hash and
|
174
|
+
* r->headers_out.location->key fields
|
175
|
+
*/
|
176
|
+
|
177
|
+
r->headers_out.location->value.len = len;
|
178
|
+
r->headers_out.location->value.data = location;
|
179
|
+
|
180
|
+
return NGX_HTTP_MOVED_PERMANENTLY;
|
181
|
+
}
|
182
|
+
|
183
|
+
#if !(NGX_WIN32) /* the not regular files are probably Unix specific */
|
184
|
+
|
185
|
+
if (!of.is_file) {
|
186
|
+
ngx_log_error(NGX_LOG_CRIT, log, ngx_errno,
|
187
|
+
"\"%s\" is not a regular file", filename->data);
|
188
|
+
|
189
|
+
return NGX_HTTP_NOT_FOUND;
|
190
|
+
}
|
191
|
+
|
192
|
+
#endif
|
193
|
+
|
194
|
+
if (r->method & NGX_HTTP_POST) {
|
195
|
+
return NGX_HTTP_NOT_ALLOWED;
|
196
|
+
}
|
197
|
+
|
198
|
+
rc = ngx_http_discard_request_body(r);
|
199
|
+
|
200
|
+
if (rc != NGX_OK) {
|
201
|
+
return rc;
|
202
|
+
}
|
203
|
+
|
204
|
+
log->action = "sending response to client";
|
205
|
+
|
206
|
+
r->headers_out.status = NGX_HTTP_OK;
|
207
|
+
r->headers_out.content_length_n = of.size;
|
208
|
+
r->headers_out.last_modified_time = of.mtime;
|
209
|
+
|
210
|
+
set_request_extension(r, filename);
|
211
|
+
if (ngx_http_set_content_type(r) != NGX_OK) {
|
212
|
+
return NGX_HTTP_INTERNAL_SERVER_ERROR;
|
213
|
+
}
|
214
|
+
|
215
|
+
if (r != r->main && of.size == 0) {
|
216
|
+
return ngx_http_send_header(r);
|
217
|
+
}
|
218
|
+
|
219
|
+
r->allow_ranges = 1;
|
220
|
+
|
221
|
+
/* we need to allocate all before the header would be sent */
|
222
|
+
|
223
|
+
b = ngx_pcalloc(r->pool, sizeof(ngx_buf_t));
|
224
|
+
if (b == NULL) {
|
225
|
+
return NGX_HTTP_INTERNAL_SERVER_ERROR;
|
226
|
+
}
|
227
|
+
|
228
|
+
b->file = ngx_pcalloc(r->pool, sizeof(ngx_file_t));
|
229
|
+
if (b->file == NULL) {
|
230
|
+
return NGX_HTTP_INTERNAL_SERVER_ERROR;
|
231
|
+
}
|
232
|
+
|
233
|
+
rc = ngx_http_send_header(r);
|
234
|
+
|
235
|
+
if (rc == NGX_ERROR || rc > NGX_OK || r->header_only) {
|
236
|
+
return rc;
|
237
|
+
}
|
238
|
+
|
239
|
+
b->file_pos = 0;
|
240
|
+
b->file_last = of.size;
|
241
|
+
|
242
|
+
b->in_file = b->file_last ? 1: 0;
|
243
|
+
b->last_buf = (r == r->main) ? 1: 0;
|
244
|
+
b->last_in_chain = 1;
|
245
|
+
|
246
|
+
b->file->fd = of.fd;
|
247
|
+
b->file->name = *filename;
|
248
|
+
b->file->log = log;
|
249
|
+
#if NGINX_VERSION_NUM >= 7000
|
250
|
+
b->file->directio = of.is_directio;
|
251
|
+
#endif
|
252
|
+
|
253
|
+
out.buf = b;
|
254
|
+
out.next = NULL;
|
255
|
+
|
256
|
+
return ngx_http_output_filter(r, &out);
|
257
|
+
}
|
@@ -0,0 +1,37 @@
|
|
1
|
+
/*
|
2
|
+
* Copyright (C) Igor Sysoev
|
3
|
+
* Copyright (C) 2007 Manlio Perillo (manlio.perillo@gmail.com)
|
4
|
+
* Copyright (C) 2008 Phusion
|
5
|
+
*
|
6
|
+
* Redistribution and use in source and binary forms, with or without
|
7
|
+
* modification, are permitted provided that the following conditions
|
8
|
+
* are met:
|
9
|
+
* 1. Redistributions of source code must retain the above copyright
|
10
|
+
* notice, this list of conditions and the following disclaimer.
|
11
|
+
* 2. Redistributions in binary form must reproduce the above copyright
|
12
|
+
* notice, this list of conditions and the following disclaimer in the
|
13
|
+
* documentation and/or other materials provided with the distribution.
|
14
|
+
*
|
15
|
+
* THIS SOFTWARE IS PROVIDED BY AUTHOR AND CONTRIBUTORS ``AS IS'' AND
|
16
|
+
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
17
|
+
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
18
|
+
* ARE DISCLAIMED. IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE
|
19
|
+
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
20
|
+
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
21
|
+
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
22
|
+
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
23
|
+
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
24
|
+
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
25
|
+
* SUCH DAMAGE.
|
26
|
+
*/
|
27
|
+
|
28
|
+
#ifndef _PASSENGER_NGINX_STATIC_CONTENT_HANDLER_H_
|
29
|
+
#define _PASSENGER_NGINX_STATIC_CONTENT_HANDLER_H_
|
30
|
+
|
31
|
+
#include <ngx_core.h>
|
32
|
+
#include <ngx_http.h>
|
33
|
+
|
34
|
+
ngx_int_t passenger_static_content_handler(ngx_http_request_t *r,
|
35
|
+
ngx_str_t *filename);
|
36
|
+
|
37
|
+
#endif /* _PASSENGER_NGINX_STATIC_CONTENT_HANDLER_H_ */
|
data/ext/nginx/config
ADDED
@@ -0,0 +1,45 @@
|
|
1
|
+
if ! test -f "$ngx_addon_dir/libpassenger_common.a" || \
|
2
|
+
! test -f "$ngx_addon_dir/libboost_oxt.a"; then
|
3
|
+
echo "*** The Phusion Passenger support files are not yet compiled. Compiling them for you... ***"
|
4
|
+
echo "*** Running 'rake nginx' in $ngx_addon_dir... ***"
|
5
|
+
if ! (cd $ngx_addon_dir; rake nginx); then
|
6
|
+
exit 1
|
7
|
+
else
|
8
|
+
echo "*** Phusion Passenger support files have been successfully compiled. ***"
|
9
|
+
fi
|
10
|
+
fi
|
11
|
+
|
12
|
+
ngx_addon_name=ngx_http_passenger_module
|
13
|
+
HTTP_MODULES="$HTTP_MODULES ngx_http_passenger_module"
|
14
|
+
NGX_ADDON_SRCS="$NGX_ADDON_SRCS \
|
15
|
+
${ngx_addon_dir}/ngx_http_passenger_module.c \
|
16
|
+
${ngx_addon_dir}/Configuration.c \
|
17
|
+
${ngx_addon_dir}/ContentHandler.c \
|
18
|
+
${ngx_addon_dir}/StaticContentHandler.c"
|
19
|
+
NGX_ADDON_DEPS="$NGX_ADDON_DEPS \
|
20
|
+
${ngx_addon_dir}/Configuration.h \
|
21
|
+
${ngx_addon_dir}/ContentHandler.h \
|
22
|
+
${ngx_addon_dir}/StaticContentHandler.h \
|
23
|
+
${ngx_addon_dir}/ngx_http_passenger_module.h \
|
24
|
+
${ngx_addon_dir}/../common/Version.h"
|
25
|
+
CORE_LIBS="$CORE_LIBS \
|
26
|
+
${ngx_addon_dir}/libpassenger_common.a \
|
27
|
+
${ngx_addon_dir}/libboost_oxt.a \
|
28
|
+
-lstdc++ -lpthread"
|
29
|
+
if test x`uname` = xOpenBSD; then
|
30
|
+
CORE_LIBS="$CORE_LIBS -lm"
|
31
|
+
fi
|
32
|
+
|
33
|
+
nginx_version=`grep 'NGINX_VERSION ' src/core/nginx.h | awk '{ print $3 }' | sed 's/"//g'`
|
34
|
+
|
35
|
+
nginx_major_version=`echo "$nginx_version" | cut -d . -f 1`
|
36
|
+
have=PASSENGER_NGINX_MAJOR_VERSION value="$nginx_major_version"
|
37
|
+
. auto/define
|
38
|
+
|
39
|
+
nginx_minor_version=`echo "$nginx_version" | cut -d . -f 2`
|
40
|
+
have=PASSENGER_NGINX_MINOR_VERSION value="$nginx_minor_version"
|
41
|
+
. auto/define
|
42
|
+
|
43
|
+
nginx_micro_version=`echo "$nginx_version" | cut -d . -f 3`
|
44
|
+
have=PASSENGER_NGINX_MICRO_VERSION value="$nginx_micro_version"
|
45
|
+
. auto/define
|
@@ -0,0 +1,653 @@
|
|
1
|
+
/*
|
2
|
+
* Copyright (C) Igor Sysoev
|
3
|
+
* Copyright (C) 2007 Manlio Perillo (manlio.perillo@gmail.com)
|
4
|
+
* Copyright (C) 2008 Phusion
|
5
|
+
*
|
6
|
+
* Redistribution and use in source and binary forms, with or without
|
7
|
+
* modification, are permitted provided that the following conditions
|
8
|
+
* are met:
|
9
|
+
* 1. Redistributions of source code must retain the above copyright
|
10
|
+
* notice, this list of conditions and the following disclaimer.
|
11
|
+
* 2. Redistributions in binary form must reproduce the above copyright
|
12
|
+
* notice, this list of conditions and the following disclaimer in the
|
13
|
+
* documentation and/or other materials provided with the distribution.
|
14
|
+
*
|
15
|
+
* THIS SOFTWARE IS PROVIDED BY AUTHOR AND CONTRIBUTORS ``AS IS'' AND
|
16
|
+
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
17
|
+
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
18
|
+
* ARE DISCLAIMED. IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE
|
19
|
+
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
20
|
+
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
21
|
+
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
22
|
+
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
23
|
+
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
24
|
+
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
25
|
+
* SUCH DAMAGE.
|
26
|
+
*/
|
27
|
+
|
28
|
+
#include <ngx_config.h>
|
29
|
+
#include <ngx_core.h>
|
30
|
+
#include <nginx.h>
|
31
|
+
|
32
|
+
#include <sys/types.h>
|
33
|
+
#include <sys/stat.h>
|
34
|
+
#include <sys/wait.h>
|
35
|
+
#include <unistd.h>
|
36
|
+
#include <stdio.h>
|
37
|
+
#include <stdlib.h>
|
38
|
+
#include <time.h>
|
39
|
+
#include <signal.h>
|
40
|
+
#include <string.h>
|
41
|
+
#include <errno.h>
|
42
|
+
|
43
|
+
#include "ngx_http_passenger_module.h"
|
44
|
+
#include "Configuration.h"
|
45
|
+
#include "ContentHandler.h"
|
46
|
+
|
47
|
+
|
48
|
+
#define HELPER_SERVER_MAX_SHUTDOWN_TIME 5
|
49
|
+
#define HELPER_SERVER_PASSWORD_SIZE 64
|
50
|
+
|
51
|
+
|
52
|
+
static int first_start = 1;
|
53
|
+
static ngx_str_t ngx_http_scgi_script_name = ngx_string("scgi_script_name");
|
54
|
+
static pid_t helper_server_pid = 0;
|
55
|
+
static int helper_server_admin_pipe;
|
56
|
+
static u_char helper_server_password_data[HELPER_SERVER_PASSWORD_SIZE];
|
57
|
+
/** perl_module destroys the original environment variables for some reason,
|
58
|
+
* so when we get a SIGHUP (for restarting Nginx) $TMPDIR might not have the
|
59
|
+
* same value as it had during Nginx startup. We need the original $TMPDIR
|
60
|
+
* value for calculating the Passenger temp dir location, so here we cache
|
61
|
+
* the original value instead of getenv()'ing it every time.
|
62
|
+
*/
|
63
|
+
const char *system_temp_dir = NULL;
|
64
|
+
const char passenger_temp_dir[NGX_MAX_PATH];
|
65
|
+
ngx_str_t passenger_schema_string;
|
66
|
+
ngx_str_t passenger_helper_server_password;
|
67
|
+
const char passenger_helper_server_socket[NGX_MAX_PATH];
|
68
|
+
CachedFileStat *passenger_stat_cache;
|
69
|
+
|
70
|
+
static void shutdown_helper_server(ngx_cycle_t *cycle);
|
71
|
+
|
72
|
+
|
73
|
+
/*
|
74
|
+
HISTORIC NOTE:
|
75
|
+
We used to register passenger_content_handler as a default content handler,
|
76
|
+
instead of setting ngx_http_core_loc_conf_t->handler. However, if
|
77
|
+
ngx_http_read_client_request_body (and thus passenger_content_handler)
|
78
|
+
returns NGX_AGAIN, then Nginx will pass the not-fully-receive file upload
|
79
|
+
data to the upstream handler even though it shouldn't. Is this an Nginx
|
80
|
+
bug? In any case, setting ngx_http_core_loc_conf_t->handler fixed the
|
81
|
+
problem.
|
82
|
+
|
83
|
+
static ngx_int_t
|
84
|
+
register_content_handler(ngx_conf_t *cf)
|
85
|
+
{
|
86
|
+
ngx_http_handler_pt *h;
|
87
|
+
ngx_http_core_main_conf_t *cmcf;
|
88
|
+
|
89
|
+
cmcf = ngx_http_conf_get_module_main_conf(cf, ngx_http_core_module);
|
90
|
+
|
91
|
+
h = ngx_array_push(&cmcf->phases[NGX_HTTP_CONTENT_PHASE].handlers);
|
92
|
+
if (h == NULL) {
|
93
|
+
return NGX_ERROR;
|
94
|
+
}
|
95
|
+
*h = passenger_content_handler;
|
96
|
+
|
97
|
+
return NGX_OK;
|
98
|
+
}
|
99
|
+
*/
|
100
|
+
|
101
|
+
static void
|
102
|
+
ignore_sigpipe()
|
103
|
+
{
|
104
|
+
struct sigaction action;
|
105
|
+
|
106
|
+
action.sa_handler = SIG_IGN;
|
107
|
+
action.sa_flags = 0;
|
108
|
+
sigemptyset(&action.sa_mask);
|
109
|
+
sigaction(SIGPIPE, &action, NULL);
|
110
|
+
}
|
111
|
+
|
112
|
+
static ngx_int_t
|
113
|
+
start_helper_server(ngx_cycle_t *cycle)
|
114
|
+
{
|
115
|
+
passenger_main_conf_t *main_conf = &passenger_main_conf;
|
116
|
+
ngx_core_conf_t *ccf;
|
117
|
+
u_char helper_server_filename[NGX_MAX_PATH];
|
118
|
+
u_char log_level_string[10];
|
119
|
+
u_char max_pool_size_string[10];
|
120
|
+
u_char max_instances_per_app_string[10];
|
121
|
+
u_char pool_idle_time_string[10];
|
122
|
+
u_char user_switching_string[2];
|
123
|
+
u_char worker_uid_string[15];
|
124
|
+
u_char worker_gid_string[15];
|
125
|
+
u_char filename[NGX_MAX_PATH];
|
126
|
+
u_char *last;
|
127
|
+
int admin_pipe[2], feedback_pipe[2], e;
|
128
|
+
pid_t pid;
|
129
|
+
long i;
|
130
|
+
ssize_t ret;
|
131
|
+
char buf;
|
132
|
+
ngx_str_t *log_filename;
|
133
|
+
FILE *f, *log_file;
|
134
|
+
|
135
|
+
shutdown_helper_server(cycle);
|
136
|
+
|
137
|
+
if (main_conf->root_dir.len == 0) {
|
138
|
+
ngx_log_error(NGX_LOG_ALERT, cycle->log, 0,
|
139
|
+
"Phusion Passenger is disabled because the "
|
140
|
+
"'passenger_root' option is not set. Please set "
|
141
|
+
"this option if you want to enable Phusion Passenger.");
|
142
|
+
return NGX_OK;
|
143
|
+
}
|
144
|
+
|
145
|
+
ccf = (ngx_core_conf_t *) ngx_get_conf(cycle->conf_ctx, ngx_core_module);
|
146
|
+
|
147
|
+
if (first_start) {
|
148
|
+
first_start = 0;
|
149
|
+
|
150
|
+
/* Ignore SIGPIPE now so that, if the helper server fails to start,
|
151
|
+
* nginx doesn't get killed by the default SIGPIPE handler upon
|
152
|
+
* writing the password to the helper server.
|
153
|
+
*/
|
154
|
+
ignore_sigpipe();
|
155
|
+
}
|
156
|
+
|
157
|
+
/* Build strings that we need later. */
|
158
|
+
|
159
|
+
ngx_memzero(helper_server_filename, sizeof(helper_server_filename));
|
160
|
+
ngx_snprintf(helper_server_filename, sizeof(helper_server_filename),
|
161
|
+
"%s/ext/nginx/HelperServer",
|
162
|
+
main_conf->root_dir.data);
|
163
|
+
|
164
|
+
ngx_memzero(log_level_string, sizeof(log_level_string));
|
165
|
+
ngx_snprintf(log_level_string, sizeof(log_level_string), "%d",
|
166
|
+
(int) main_conf->log_level);
|
167
|
+
|
168
|
+
ngx_memzero(max_pool_size_string, sizeof(max_pool_size_string));
|
169
|
+
ngx_snprintf(max_pool_size_string, sizeof(max_pool_size_string), "%d",
|
170
|
+
(int) main_conf->max_pool_size);
|
171
|
+
|
172
|
+
ngx_memzero(max_instances_per_app_string, sizeof(max_instances_per_app_string));
|
173
|
+
ngx_snprintf(max_instances_per_app_string, sizeof(max_instances_per_app_string), "%d",
|
174
|
+
(int) main_conf->max_instances_per_app);
|
175
|
+
|
176
|
+
ngx_memzero(pool_idle_time_string, sizeof(pool_idle_time_string));
|
177
|
+
ngx_snprintf(pool_idle_time_string, sizeof(pool_idle_time_string), "%d",
|
178
|
+
(int) main_conf->pool_idle_time);
|
179
|
+
|
180
|
+
ngx_memzero(user_switching_string, sizeof(user_switching_string));
|
181
|
+
ngx_snprintf(user_switching_string, 1, "%d",
|
182
|
+
(int) main_conf->user_switching);
|
183
|
+
|
184
|
+
ngx_memzero(worker_uid_string, sizeof(worker_uid_string));
|
185
|
+
ngx_snprintf(worker_uid_string, sizeof(worker_uid_string), "%L",
|
186
|
+
(long long) ccf->user);
|
187
|
+
|
188
|
+
ngx_memzero(worker_gid_string, sizeof(worker_gid_string));
|
189
|
+
ngx_snprintf(worker_gid_string, sizeof(worker_gid_string), "%L",
|
190
|
+
(long long) ccf->group);
|
191
|
+
|
192
|
+
/* Generate random password for the helper server. */
|
193
|
+
|
194
|
+
f = fopen("/dev/urandom", "r");
|
195
|
+
if (f == NULL) {
|
196
|
+
ngx_log_error(NGX_LOG_ALERT, cycle->log, ngx_errno,
|
197
|
+
"could not generate a random password for the "
|
198
|
+
"Passenger helper server: cannot open /dev/urandom");
|
199
|
+
return NGX_ERROR;
|
200
|
+
}
|
201
|
+
ngx_memzero(helper_server_password_data, HELPER_SERVER_PASSWORD_SIZE);
|
202
|
+
if (fread(helper_server_password_data, 1, HELPER_SERVER_PASSWORD_SIZE, f)
|
203
|
+
!= HELPER_SERVER_PASSWORD_SIZE) {
|
204
|
+
ngx_log_error(NGX_LOG_ALERT, cycle->log, ngx_errno,
|
205
|
+
"could not generate a random password for the "
|
206
|
+
"Passenger helper server: cannot read sufficient "
|
207
|
+
"data from /dev/urandom");
|
208
|
+
return NGX_ERROR;
|
209
|
+
}
|
210
|
+
fclose(f);
|
211
|
+
passenger_helper_server_password.data = helper_server_password_data;
|
212
|
+
passenger_helper_server_password.len = HELPER_SERVER_PASSWORD_SIZE;
|
213
|
+
|
214
|
+
|
215
|
+
/* Now spawn the helper server. */
|
216
|
+
if (pipe(admin_pipe) == -1) {
|
217
|
+
ngx_log_error(NGX_LOG_ALERT, cycle->log, ngx_errno,
|
218
|
+
"could not start the Passenger helper server: pipe() failed");
|
219
|
+
return NGX_ERROR;
|
220
|
+
}
|
221
|
+
if (pipe(feedback_pipe) == -1) {
|
222
|
+
close(admin_pipe[0]);
|
223
|
+
close(admin_pipe[1]);
|
224
|
+
ngx_log_error(NGX_LOG_ALERT, cycle->log, ngx_errno,
|
225
|
+
"could not start the Passenger helper server: pipe() failed");
|
226
|
+
return NGX_ERROR;
|
227
|
+
}
|
228
|
+
|
229
|
+
pid = fork();
|
230
|
+
switch (pid) {
|
231
|
+
case 0:
|
232
|
+
/* Child process. */
|
233
|
+
close(admin_pipe[1]);
|
234
|
+
close(feedback_pipe[0]);
|
235
|
+
|
236
|
+
/* At this point, stdout and stderr may still point to the console.
|
237
|
+
* Make sure that they're both redirected to the log file.
|
238
|
+
*/
|
239
|
+
log_file = NULL;
|
240
|
+
#if NGINX_VERSION_NUM < 7000
|
241
|
+
log_filename = &cycle->new_log->file->name;
|
242
|
+
#else
|
243
|
+
log_filename = &cycle->new_log.file->name;
|
244
|
+
#endif
|
245
|
+
if (log_filename->len > 0) {
|
246
|
+
log_file = fopen((const char *) log_filename->data, "a");
|
247
|
+
if (log_file == NULL) {
|
248
|
+
ngx_log_error(NGX_LOG_ALERT, cycle->log, ngx_errno,
|
249
|
+
"could not open the error log file for writing");
|
250
|
+
}
|
251
|
+
}
|
252
|
+
if (log_file == NULL) {
|
253
|
+
/* If the log file cannot be opened then we redirect stdout
|
254
|
+
* and stderr to /dev/null, because if the user disconnects
|
255
|
+
* from the console on which Nginx is started, then on Linux
|
256
|
+
* any writes to stdout or stderr will result in an EIO error.
|
257
|
+
*/
|
258
|
+
log_file = fopen("/dev/null", "w");
|
259
|
+
}
|
260
|
+
if (log_file != NULL) {
|
261
|
+
dup2(fileno(log_file), 1);
|
262
|
+
dup2(fileno(log_file), 2);
|
263
|
+
fclose(log_file);
|
264
|
+
}
|
265
|
+
|
266
|
+
/* Close all file descriptors except stdin, stdout, stderr and
|
267
|
+
* the reader part of the pipe we just created.
|
268
|
+
*/
|
269
|
+
if (dup2(admin_pipe[0], 3) == -1) {
|
270
|
+
ngx_log_error(NGX_LOG_ALERT, cycle->log, ngx_errno,
|
271
|
+
"could not start the Passenger helper server: "
|
272
|
+
"dup2() failed");
|
273
|
+
}
|
274
|
+
if (dup2(feedback_pipe[1], 4) == -1) {
|
275
|
+
ngx_log_error(NGX_LOG_ALERT, cycle->log, ngx_errno,
|
276
|
+
"could not start the Passenger helper server: "
|
277
|
+
"dup2() failed");
|
278
|
+
}
|
279
|
+
for (i = sysconf(_SC_OPEN_MAX) - 1; i > 4; i--) {
|
280
|
+
close(i);
|
281
|
+
}
|
282
|
+
|
283
|
+
setenv("SERVER_SOFTWARE", NGINX_VER, 1);
|
284
|
+
|
285
|
+
execlp((const char *) helper_server_filename,
|
286
|
+
"PassengerNginxHelperServer",
|
287
|
+
main_conf->root_dir.data,
|
288
|
+
main_conf->ruby.data,
|
289
|
+
"3", /* Admin pipe file descriptor number. */
|
290
|
+
"4", /* Feedback pipe file descriptor number. */
|
291
|
+
log_level_string,
|
292
|
+
max_pool_size_string,
|
293
|
+
max_instances_per_app_string,
|
294
|
+
pool_idle_time_string,
|
295
|
+
user_switching_string,
|
296
|
+
main_conf->default_user.data,
|
297
|
+
worker_uid_string,
|
298
|
+
worker_gid_string,
|
299
|
+
passenger_temp_dir,
|
300
|
+
(char *) 0);
|
301
|
+
e = errno;
|
302
|
+
fprintf(stderr, "*** Could not start the Passenger helper server (%s): "
|
303
|
+
"exec() failed: %s (%d)\n",
|
304
|
+
(const char *) helper_server_filename, strerror(e), e);
|
305
|
+
_exit(1);
|
306
|
+
|
307
|
+
case -1:
|
308
|
+
/* Error */
|
309
|
+
ngx_log_error(NGX_LOG_ALERT, cycle->log, ngx_errno,
|
310
|
+
"could not start the Passenger helper server: "
|
311
|
+
"fork() failed");
|
312
|
+
close(admin_pipe[0]);
|
313
|
+
close(admin_pipe[1]);
|
314
|
+
close(feedback_pipe[0]);
|
315
|
+
close(feedback_pipe[1]);
|
316
|
+
return NGX_ERROR;
|
317
|
+
|
318
|
+
default:
|
319
|
+
/* Parent process. */
|
320
|
+
close(admin_pipe[0]);
|
321
|
+
close(feedback_pipe[1]);
|
322
|
+
|
323
|
+
/* Pass our auto-generated password to the helper server. */
|
324
|
+
i = 0;
|
325
|
+
do {
|
326
|
+
ret = write(admin_pipe[1], helper_server_password_data,
|
327
|
+
HELPER_SERVER_PASSWORD_SIZE - i);
|
328
|
+
if (ret == -1) {
|
329
|
+
ngx_log_error(NGX_LOG_ALERT, cycle->log, ngx_errno,
|
330
|
+
"could not send password to the Passenger helper server: "
|
331
|
+
"write() failed");
|
332
|
+
close(admin_pipe[1]);
|
333
|
+
kill(pid, SIGTERM);
|
334
|
+
waitpid(pid, NULL, 0);
|
335
|
+
return NGX_ERROR;
|
336
|
+
} else {
|
337
|
+
i += ret;
|
338
|
+
}
|
339
|
+
} while (i < HELPER_SERVER_PASSWORD_SIZE);
|
340
|
+
|
341
|
+
/* Wait until the HelperServer has done initializing. */
|
342
|
+
do {
|
343
|
+
/* We must do something with read()'s return value
|
344
|
+
* because otherwise on some platform it might raise a
|
345
|
+
* compile warning.
|
346
|
+
*/
|
347
|
+
ret = read(feedback_pipe[0], &buf, 1);
|
348
|
+
} while (ret == -1 && errno == EINTR);
|
349
|
+
close(feedback_pipe[0]);
|
350
|
+
|
351
|
+
/* Create the file passenger_temp_dir + "/control_process.pid"
|
352
|
+
* and make it writable by the worker processes. This is because
|
353
|
+
* save_master_process_pid is run after Nginx has lowered privileges.
|
354
|
+
*/
|
355
|
+
last = ngx_snprintf(filename, sizeof(filename) - 1,
|
356
|
+
"%s/control_process.pid", passenger_temp_dir);
|
357
|
+
*last = (u_char) '\0';
|
358
|
+
f = fopen((const char *) filename, "w");
|
359
|
+
if (f != NULL) {
|
360
|
+
/* We must do something with these return values because
|
361
|
+
* otherwise on some platforms it will cause a compiler
|
362
|
+
* warning.
|
363
|
+
*/
|
364
|
+
do {
|
365
|
+
ret = fchmod(fileno(f), S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH);
|
366
|
+
} while (ret == -1 && errno == EINTR);
|
367
|
+
do {
|
368
|
+
ret = fchown(fileno(f), ccf->user, ccf->group);
|
369
|
+
} while (ret == -1 && errno == EINTR);
|
370
|
+
fclose(f);
|
371
|
+
} else {
|
372
|
+
ngx_log_error(NGX_LOG_ALERT, cycle->log, ngx_errno,
|
373
|
+
"could not create %s", filename);
|
374
|
+
}
|
375
|
+
|
376
|
+
helper_server_pid = pid;
|
377
|
+
helper_server_admin_pipe = admin_pipe[1];
|
378
|
+
break;
|
379
|
+
}
|
380
|
+
|
381
|
+
return NGX_OK;
|
382
|
+
}
|
383
|
+
|
384
|
+
/**
|
385
|
+
* Save the Nginx master process's PID into a file under the Phusion Passenger
|
386
|
+
* temp directory.
|
387
|
+
*
|
388
|
+
* A bug/limitation in Nginx doesn't allow us to initialize the temp dir *after*
|
389
|
+
* Nginx has daemonized, so the temp dir's filename contains Nginx's PID before
|
390
|
+
* daemonization. Normally PhusionPassenger::AdminTools::ControlProcess (used
|
391
|
+
* by e.g. passenger-status) will think that the temp dir is stale because the
|
392
|
+
* PID in the filename doesn't exist. This PID file tells AdminTools::ControlProcess
|
393
|
+
* what the actual PID is.
|
394
|
+
*/
|
395
|
+
static ngx_int_t
|
396
|
+
save_master_process_pid(ngx_cycle_t *cycle) {
|
397
|
+
u_char filename[NGX_MAX_PATH];
|
398
|
+
u_char *last;
|
399
|
+
FILE *f;
|
400
|
+
|
401
|
+
if (passenger_main_conf.root_dir.len == 0) {
|
402
|
+
return NGX_OK;
|
403
|
+
}
|
404
|
+
|
405
|
+
last = ngx_snprintf(filename, sizeof(filename) - 1,
|
406
|
+
"%s/control_process.pid", passenger_temp_dir);
|
407
|
+
*last = (u_char) '\0';
|
408
|
+
|
409
|
+
f = fopen((const char *) filename, "w");
|
410
|
+
if (f != NULL) {
|
411
|
+
fprintf(f, "%ld", (long) getppid());
|
412
|
+
fclose(f);
|
413
|
+
} else {
|
414
|
+
ngx_log_error(NGX_LOG_ALERT, cycle->log, ngx_errno,
|
415
|
+
"could not create %s", filename);
|
416
|
+
}
|
417
|
+
|
418
|
+
return NGX_OK;
|
419
|
+
}
|
420
|
+
|
421
|
+
static void
|
422
|
+
shutdown_helper_server(ngx_cycle_t *cycle)
|
423
|
+
{
|
424
|
+
time_t begin_time;
|
425
|
+
int helper_server_exited, ret;
|
426
|
+
u_char command[NGX_MAX_PATH + 10];
|
427
|
+
|
428
|
+
if (helper_server_pid == 0) {
|
429
|
+
return;
|
430
|
+
}
|
431
|
+
|
432
|
+
/* We write one byte to the admin pipe, doesn't matter what the byte is.
|
433
|
+
* The helper server will detect this as an exit command.
|
434
|
+
*/
|
435
|
+
do {
|
436
|
+
ret = write(helper_server_admin_pipe, "x", 1);
|
437
|
+
} while ((ret == -1 && errno == EINTR) || ret == 0);
|
438
|
+
close(helper_server_admin_pipe);
|
439
|
+
|
440
|
+
/* Wait at most HELPER_SERVER_MAX_SHUTDOWN_TIME seconds for the helper
|
441
|
+
* server to exit.
|
442
|
+
*/
|
443
|
+
begin_time = time(NULL);
|
444
|
+
helper_server_exited = 0;
|
445
|
+
ngx_log_debug1(NGX_LOG_DEBUG_HTTP, cycle->log, 0,
|
446
|
+
"Waiting for Passenger helper server (PID %l) to exit...",
|
447
|
+
(long) helper_server_pid);
|
448
|
+
while (!helper_server_exited && time(NULL) - begin_time < HELPER_SERVER_MAX_SHUTDOWN_TIME) {
|
449
|
+
pid_t ret;
|
450
|
+
|
451
|
+
ret = waitpid(helper_server_pid, NULL, WNOHANG);
|
452
|
+
if (ret > 0 || (ret == -1 && errno == ECHILD)) {
|
453
|
+
helper_server_exited = 1;
|
454
|
+
} else {
|
455
|
+
usleep(100000);
|
456
|
+
}
|
457
|
+
}
|
458
|
+
|
459
|
+
/* Kill helper server if it did not exit in time. */
|
460
|
+
if (!helper_server_exited) {
|
461
|
+
ngx_log_debug0(NGX_LOG_DEBUG_HTTP, cycle->log, 0,
|
462
|
+
"Passenger helper server did not exit in time. "
|
463
|
+
"Killing it...");
|
464
|
+
kill(helper_server_pid, SIGKILL);
|
465
|
+
waitpid(helper_server_pid, NULL, 0);
|
466
|
+
}
|
467
|
+
|
468
|
+
ngx_log_debug0(NGX_LOG_DEBUG_HTTP, cycle->log, 0,
|
469
|
+
"Passenger helper server exited.");
|
470
|
+
|
471
|
+
|
472
|
+
/* Remove Passenger temp dir. */
|
473
|
+
ngx_memzero(command, sizeof(command));
|
474
|
+
if (ngx_snprintf(command, sizeof(command), "chmod -R u=rwx \"%s\"",
|
475
|
+
passenger_temp_dir) != NULL) {
|
476
|
+
do {
|
477
|
+
ret = system((const char *) command);
|
478
|
+
} while (ret == -1 && errno == EINTR);
|
479
|
+
}
|
480
|
+
|
481
|
+
ngx_memzero(command, sizeof(command));
|
482
|
+
if (ngx_snprintf(command, sizeof(command), "rm -rf \"%s\"",
|
483
|
+
passenger_temp_dir) != NULL) {
|
484
|
+
ngx_log_debug1(NGX_LOG_DEBUG_HTTP, cycle->log, 0,
|
485
|
+
"Removing Passenger temp folder with command: %s",
|
486
|
+
command);
|
487
|
+
errno = 0;
|
488
|
+
if (system((const char *) command) != 0) {
|
489
|
+
ngx_log_error(NGX_LOG_ALERT, cycle->log, ngx_errno,
|
490
|
+
"Could not remove Passenger temp folder '%s'",
|
491
|
+
passenger_temp_dir);
|
492
|
+
}
|
493
|
+
}
|
494
|
+
helper_server_pid = 0;
|
495
|
+
}
|
496
|
+
|
497
|
+
static ngx_int_t
|
498
|
+
ngx_http_scgi_script_name_variable(ngx_http_request_t *r,
|
499
|
+
ngx_http_variable_value_t *v, uintptr_t data)
|
500
|
+
{
|
501
|
+
u_char *p;
|
502
|
+
passenger_loc_conf_t *slcf;
|
503
|
+
|
504
|
+
if (r->uri.len) {
|
505
|
+
v->valid = 1;
|
506
|
+
v->no_cacheable = 0;
|
507
|
+
v->not_found = 0;
|
508
|
+
|
509
|
+
slcf = ngx_http_get_module_loc_conf(r, ngx_http_passenger_module);
|
510
|
+
|
511
|
+
if (r->uri.data[r->uri.len - 1] != '/') {
|
512
|
+
v->len = r->uri.len;
|
513
|
+
v->data = r->uri.data;
|
514
|
+
return NGX_OK;
|
515
|
+
}
|
516
|
+
|
517
|
+
v->len = r->uri.len + slcf->index.len;
|
518
|
+
|
519
|
+
v->data = ngx_palloc(r->pool, v->len);
|
520
|
+
if (v->data == NULL) {
|
521
|
+
return NGX_ERROR;
|
522
|
+
}
|
523
|
+
|
524
|
+
p = ngx_copy(v->data, r->uri.data, r->uri.len);
|
525
|
+
ngx_memcpy(p, slcf->index.data, slcf->index.len);
|
526
|
+
|
527
|
+
} else {
|
528
|
+
v->len = 0;
|
529
|
+
v->valid = 1;
|
530
|
+
v->no_cacheable = 0;
|
531
|
+
v->not_found = 0;
|
532
|
+
v->data = NULL;
|
533
|
+
|
534
|
+
return NGX_OK;
|
535
|
+
}
|
536
|
+
|
537
|
+
return NGX_OK;
|
538
|
+
}
|
539
|
+
|
540
|
+
static ngx_int_t
|
541
|
+
add_variables(ngx_conf_t *cf)
|
542
|
+
{
|
543
|
+
ngx_http_variable_t *var;
|
544
|
+
|
545
|
+
var = ngx_http_add_variable(cf, &ngx_http_scgi_script_name,
|
546
|
+
NGX_HTTP_VAR_NOHASH|NGX_HTTP_VAR_NOCACHEABLE);
|
547
|
+
if (var == NULL) {
|
548
|
+
return NGX_ERROR;
|
549
|
+
}
|
550
|
+
|
551
|
+
var->get_handler = ngx_http_scgi_script_name_variable;
|
552
|
+
|
553
|
+
return NGX_OK;
|
554
|
+
}
|
555
|
+
|
556
|
+
static ngx_int_t
|
557
|
+
pre_config_init(ngx_conf_t *cf)
|
558
|
+
{
|
559
|
+
ngx_int_t ret;
|
560
|
+
u_char command[NGX_MAX_PATH + 30];
|
561
|
+
u_char *last;
|
562
|
+
|
563
|
+
ngx_memzero(&passenger_main_conf, sizeof(passenger_main_conf_t));
|
564
|
+
|
565
|
+
passenger_schema_string.data = (u_char *) "passenger://";
|
566
|
+
passenger_schema_string.len = sizeof("passenger://") - 1;
|
567
|
+
|
568
|
+
passenger_stat_cache = cached_file_stat_new(1024);
|
569
|
+
|
570
|
+
ret = add_variables(cf);
|
571
|
+
if (ret != NGX_OK) {
|
572
|
+
return ret;
|
573
|
+
}
|
574
|
+
|
575
|
+
/* Setup Passenger temp folder. */
|
576
|
+
|
577
|
+
if (system_temp_dir == NULL) {
|
578
|
+
const char *tmp = getenv("TMPDIR");
|
579
|
+
if (tmp == NULL || *tmp == '\0') {
|
580
|
+
system_temp_dir = "/tmp";
|
581
|
+
} else {
|
582
|
+
system_temp_dir = strdup(tmp);
|
583
|
+
}
|
584
|
+
}
|
585
|
+
|
586
|
+
ngx_memzero(&passenger_temp_dir, sizeof(passenger_temp_dir));
|
587
|
+
if (ngx_snprintf((u_char *) passenger_temp_dir, sizeof(passenger_temp_dir),
|
588
|
+
"%s/passenger.%d", system_temp_dir, getpid()) == NULL) {
|
589
|
+
ngx_log_error(NGX_LOG_ALERT, cf->log, ngx_errno,
|
590
|
+
"could not create Passenger temp dir string");
|
591
|
+
return NGX_ERROR;
|
592
|
+
}
|
593
|
+
|
594
|
+
/* Temporarily create this temp directory. It must exist before the configuration is loaded,
|
595
|
+
* because during Configuration loading Nginx's upstream module will attempt to create
|
596
|
+
* the directory passenger_temp_dir + "/webserver_private".
|
597
|
+
*
|
598
|
+
* passenger_temp_dir will be removed and recreated by the HelperServer, with the right
|
599
|
+
* permissions. So right now we don't have to pay any attention to the permissions.
|
600
|
+
*/
|
601
|
+
ngx_memzero(command, sizeof(command));
|
602
|
+
ngx_snprintf(command, sizeof(command), "mkdir -p \"%s\"", passenger_temp_dir);
|
603
|
+
do {
|
604
|
+
ret = system((const char *) command);
|
605
|
+
} while (ret == -1 && errno == EINTR);
|
606
|
+
|
607
|
+
/* Build helper server socket filename string. */
|
608
|
+
|
609
|
+
last = ngx_snprintf((u_char *) passenger_helper_server_socket, NGX_MAX_PATH,
|
610
|
+
"unix:%s/master/helper_server.sock",
|
611
|
+
passenger_temp_dir);
|
612
|
+
if (last == NULL) {
|
613
|
+
ngx_log_error(NGX_LOG_ALERT, cf->log, ngx_errno,
|
614
|
+
"could not create Passenger helper server "
|
615
|
+
"socket filename string");
|
616
|
+
return NGX_ERROR;
|
617
|
+
} else {
|
618
|
+
*last = (u_char) '\0';
|
619
|
+
}
|
620
|
+
|
621
|
+
return NGX_OK;
|
622
|
+
}
|
623
|
+
|
624
|
+
|
625
|
+
static ngx_http_module_t passenger_module_ctx = {
|
626
|
+
pre_config_init, /* preconfiguration */
|
627
|
+
/* register_content_handler */ NULL, /* postconfiguration */
|
628
|
+
|
629
|
+
passenger_create_main_conf, /* create main configuration */
|
630
|
+
passenger_init_main_conf, /* init main configuration */
|
631
|
+
|
632
|
+
NULL, /* create server configuration */
|
633
|
+
NULL, /* merge server configuration */
|
634
|
+
|
635
|
+
passenger_create_loc_conf, /* create location configuration */
|
636
|
+
passenger_merge_loc_conf /* merge location configuration */
|
637
|
+
};
|
638
|
+
|
639
|
+
|
640
|
+
ngx_module_t ngx_http_passenger_module = {
|
641
|
+
NGX_MODULE_V1,
|
642
|
+
&passenger_module_ctx, /* module context */
|
643
|
+
(ngx_command_t *) passenger_commands, /* module directives */
|
644
|
+
NGX_HTTP_MODULE, /* module type */
|
645
|
+
NULL, /* init master */
|
646
|
+
start_helper_server, /* init module */
|
647
|
+
save_master_process_pid, /* init process */
|
648
|
+
NULL, /* init thread */
|
649
|
+
NULL, /* exit thread */
|
650
|
+
NULL, /* exit process */
|
651
|
+
shutdown_helper_server, /* exit master */
|
652
|
+
NGX_MODULE_V1_PADDING
|
653
|
+
};
|