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,1617 @@
|
|
1
|
+
/*
|
2
|
+
* Phusion Passenger - http://www.modrails.com/
|
3
|
+
* Copyright (c) 2008, 2009 Phusion
|
4
|
+
*
|
5
|
+
* "Phusion Passenger" is a trademark of Hongli Lai & Ninh Bui.
|
6
|
+
*
|
7
|
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
8
|
+
* of this software and associated documentation files (the "Software"), to deal
|
9
|
+
* in the Software without restriction, including without limitation the rights
|
10
|
+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
11
|
+
* copies of the Software, and to permit persons to whom the Software is
|
12
|
+
* furnished to do so, subject to the following conditions:
|
13
|
+
*
|
14
|
+
* The above copyright notice and this permission notice shall be included in
|
15
|
+
* all copies or substantial portions of the Software.
|
16
|
+
*
|
17
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
18
|
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
19
|
+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
20
|
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
21
|
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
22
|
+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
23
|
+
* THE SOFTWARE.
|
24
|
+
*/
|
25
|
+
#include <boost/thread.hpp>
|
26
|
+
|
27
|
+
#include <sys/time.h>
|
28
|
+
#include <sys/resource.h>
|
29
|
+
#include <exception>
|
30
|
+
#include <cstdio>
|
31
|
+
#include <unistd.h>
|
32
|
+
|
33
|
+
#include <oxt/macros.hpp>
|
34
|
+
#include "Hooks.h"
|
35
|
+
#include "Bucket.h"
|
36
|
+
#include "Configuration.h"
|
37
|
+
#include "Utils.h"
|
38
|
+
#include "Logging.h"
|
39
|
+
#include "ApplicationPoolServer.h"
|
40
|
+
#include "MessageChannel.h"
|
41
|
+
#include "DirectoryMapper.h"
|
42
|
+
#include "Timer.h"
|
43
|
+
#include "Version.h"
|
44
|
+
|
45
|
+
/* The Apache/APR headers *must* come after the Boost headers, otherwise
|
46
|
+
* compilation will fail on OpenBSD.
|
47
|
+
*
|
48
|
+
* apr_want.h *must* come after MessageChannel.h, otherwise compilation will
|
49
|
+
* fail on platforms on which apr_want.h tries to redefine 'struct iovec'.
|
50
|
+
* http://tinyurl.com/b6aatw
|
51
|
+
*/
|
52
|
+
#include <ap_config.h>
|
53
|
+
#include <httpd.h>
|
54
|
+
#include <http_config.h>
|
55
|
+
#include <http_core.h>
|
56
|
+
#include <http_request.h>
|
57
|
+
#include <http_protocol.h>
|
58
|
+
#include <http_log.h>
|
59
|
+
#include <util_script.h>
|
60
|
+
#include <apr_pools.h>
|
61
|
+
#include <apr_strings.h>
|
62
|
+
#include <apr_lib.h>
|
63
|
+
#include <unixd.h>
|
64
|
+
|
65
|
+
using namespace std;
|
66
|
+
using namespace Passenger;
|
67
|
+
|
68
|
+
extern "C" module AP_MODULE_DECLARE_DATA passenger_module;
|
69
|
+
|
70
|
+
|
71
|
+
/*
|
72
|
+
* This is the main source file which interfaces directly with Apache by
|
73
|
+
* installing hooks. The code here can look a bit convoluted, but it'll make
|
74
|
+
* more sense if you read:
|
75
|
+
* http://httpd.apache.org/docs/2.2/developer/request.html
|
76
|
+
*
|
77
|
+
* Scroll all the way down to passenger_register_hooks to get an idea of
|
78
|
+
* what we're hooking into and what we do in those hooks.
|
79
|
+
*/
|
80
|
+
|
81
|
+
|
82
|
+
/**
|
83
|
+
* If the HTTP client sends POST data larger than this value (in bytes),
|
84
|
+
* then the POST data will be fully buffered into a temporary file, before
|
85
|
+
* allocating a Ruby web application session.
|
86
|
+
* File uploads smaller than this are buffered into memory instead.
|
87
|
+
*/
|
88
|
+
#define LARGE_UPLOAD_THRESHOLD 1024 * 8
|
89
|
+
|
90
|
+
|
91
|
+
/**
|
92
|
+
* Apache hook functions, wrapped in a class.
|
93
|
+
*
|
94
|
+
* @ingroup Core
|
95
|
+
*/
|
96
|
+
class Hooks {
|
97
|
+
private:
|
98
|
+
struct AprDestructable {
|
99
|
+
virtual ~AprDestructable() { }
|
100
|
+
|
101
|
+
static apr_status_t cleanup(void *p) {
|
102
|
+
delete (AprDestructable *) p;
|
103
|
+
return APR_SUCCESS;
|
104
|
+
}
|
105
|
+
};
|
106
|
+
|
107
|
+
struct RequestNote: public AprDestructable {
|
108
|
+
DirectoryMapper mapper;
|
109
|
+
DirConfig *config;
|
110
|
+
bool forwardToBackend;
|
111
|
+
const char *handlerBeforeModRewrite;
|
112
|
+
char *filenameBeforeModRewrite;
|
113
|
+
apr_filetype_e oldFileType;
|
114
|
+
const char *handlerBeforeModAutoIndex;
|
115
|
+
|
116
|
+
RequestNote(const DirectoryMapper &m)
|
117
|
+
: mapper(m) {
|
118
|
+
forwardToBackend = false;
|
119
|
+
filenameBeforeModRewrite = NULL;
|
120
|
+
}
|
121
|
+
};
|
122
|
+
|
123
|
+
struct ErrorReport: public AprDestructable {
|
124
|
+
virtual int report(request_rec *r) = 0;
|
125
|
+
};
|
126
|
+
|
127
|
+
struct ReportFileSystemError: public ErrorReport {
|
128
|
+
FileSystemException e;
|
129
|
+
|
130
|
+
ReportFileSystemError(const FileSystemException &ex): e(ex) { }
|
131
|
+
|
132
|
+
int report(request_rec *r) {
|
133
|
+
r->status = 500;
|
134
|
+
ap_set_content_type(r, "text/html; charset=UTF-8");
|
135
|
+
ap_rputs("<h1>Passenger error #2</h1>\n", r);
|
136
|
+
ap_rputs("An error occurred while trying to access '", r);
|
137
|
+
ap_rputs(ap_escape_html(r->pool, e.filename().c_str()), r);
|
138
|
+
ap_rputs("': ", r);
|
139
|
+
ap_rputs(ap_escape_html(r->pool, e.what()), r);
|
140
|
+
if (e.code() == EACCES || e.code() == EPERM) {
|
141
|
+
ap_rputs("<p>", r);
|
142
|
+
ap_rputs("Apache doesn't have read permissions to that file. ", r);
|
143
|
+
ap_rputs("Please fix the relevant file permissions.", r);
|
144
|
+
ap_rputs("</p>", r);
|
145
|
+
}
|
146
|
+
P_ERROR("A filesystem exception occured.\n" <<
|
147
|
+
" Message: " << e.what() << "\n" <<
|
148
|
+
" Backtrace:\n" << e.backtrace());
|
149
|
+
return OK;
|
150
|
+
}
|
151
|
+
};
|
152
|
+
|
153
|
+
/**
|
154
|
+
* A StringListCreator which returns a list of environment variable
|
155
|
+
* names and values, as found in r->subprocess_env.
|
156
|
+
*/
|
157
|
+
class EnvironmentVariablesStringListCreator: public StringListCreator {
|
158
|
+
private:
|
159
|
+
request_rec *r;
|
160
|
+
public:
|
161
|
+
EnvironmentVariablesStringListCreator(request_rec *r) {
|
162
|
+
this->r = r;
|
163
|
+
}
|
164
|
+
|
165
|
+
virtual const StringListPtr getItems() const {
|
166
|
+
const apr_array_header_t *env_arr;
|
167
|
+
apr_table_entry_t *env_entries;
|
168
|
+
StringListPtr result = ptr(new StringList());
|
169
|
+
|
170
|
+
// Some standard CGI headers.
|
171
|
+
result->push_back("SERVER_SOFTWARE");
|
172
|
+
result->push_back(ap_get_server_version());
|
173
|
+
|
174
|
+
// Subprocess environment variables.
|
175
|
+
env_arr = apr_table_elts(r->subprocess_env);
|
176
|
+
env_entries = (apr_table_entry_t *) env_arr->elts;
|
177
|
+
for (int i = 0; i < env_arr->nelts; ++i) {
|
178
|
+
if (env_entries[i].key != NULL && env_entries[i].val != NULL) {
|
179
|
+
result->push_back(env_entries[i].key);
|
180
|
+
result->push_back(env_entries[i].val);
|
181
|
+
}
|
182
|
+
}
|
183
|
+
return result;
|
184
|
+
}
|
185
|
+
};
|
186
|
+
|
187
|
+
enum Threeway { YES, NO, UNKNOWN };
|
188
|
+
|
189
|
+
ApplicationPoolServerPtr applicationPoolServer;
|
190
|
+
thread_specific_ptr<ApplicationPoolPtr> threadSpecificApplicationPool;
|
191
|
+
Threeway m_hasModRewrite, m_hasModDir, m_hasModAutoIndex;
|
192
|
+
CachedFileStat cstat;
|
193
|
+
|
194
|
+
inline DirConfig *getDirConfig(request_rec *r) {
|
195
|
+
return (DirConfig *) ap_get_module_config(r->per_dir_config, &passenger_module);
|
196
|
+
}
|
197
|
+
|
198
|
+
inline ServerConfig *getServerConfig(server_rec *s) {
|
199
|
+
return (ServerConfig *) ap_get_module_config(s->module_config, &passenger_module);
|
200
|
+
}
|
201
|
+
|
202
|
+
inline RequestNote *getRequestNote(request_rec *r) {
|
203
|
+
// The union is needed in order to be compliant with
|
204
|
+
// C99/C++'s strict aliasing rules. http://tinyurl.com/g5hgh
|
205
|
+
union {
|
206
|
+
RequestNote *note;
|
207
|
+
void *pointer;
|
208
|
+
} u;
|
209
|
+
u.note = 0;
|
210
|
+
apr_pool_userdata_get(&u.pointer, "Phusion Passenger", r->pool);
|
211
|
+
return u.note;
|
212
|
+
}
|
213
|
+
|
214
|
+
/**
|
215
|
+
* Returns a usable ApplicationPool object.
|
216
|
+
*
|
217
|
+
* When using the worker MPM and global queuing, deadlocks can occur, for
|
218
|
+
* the same reason described in ApplicationPoolServer::connect(). This
|
219
|
+
* method allows us to avoid this deadlock by making sure that each
|
220
|
+
* thread gets its own connection to the application pool server.
|
221
|
+
*
|
222
|
+
* It also checks whether the currently cached ApplicationPool object
|
223
|
+
* is disconnected (which can happen if an error previously occured).
|
224
|
+
* If so, it will reconnect to the ApplicationPool server.
|
225
|
+
*/
|
226
|
+
ApplicationPoolPtr getApplicationPool() {
|
227
|
+
ApplicationPoolPtr *pool_ptr = threadSpecificApplicationPool.get();
|
228
|
+
if (pool_ptr == NULL) {
|
229
|
+
pool_ptr = new ApplicationPoolPtr(applicationPoolServer->connect());
|
230
|
+
threadSpecificApplicationPool.reset(pool_ptr);
|
231
|
+
} else if (!(*pool_ptr)->connected()) {
|
232
|
+
P_DEBUG("Reconnecting to ApplicationPool server");
|
233
|
+
*pool_ptr = applicationPoolServer->connect();
|
234
|
+
}
|
235
|
+
return *pool_ptr;
|
236
|
+
}
|
237
|
+
|
238
|
+
bool hasModRewrite() {
|
239
|
+
if (m_hasModRewrite == UNKNOWN) {
|
240
|
+
if (ap_find_linked_module("mod_rewrite.c")) {
|
241
|
+
m_hasModRewrite = YES;
|
242
|
+
} else {
|
243
|
+
m_hasModRewrite = NO;
|
244
|
+
}
|
245
|
+
}
|
246
|
+
return m_hasModRewrite == YES;
|
247
|
+
}
|
248
|
+
|
249
|
+
bool hasModDir() {
|
250
|
+
if (m_hasModDir == UNKNOWN) {
|
251
|
+
if (ap_find_linked_module("mod_dir.c")) {
|
252
|
+
m_hasModDir = YES;
|
253
|
+
} else {
|
254
|
+
m_hasModDir = NO;
|
255
|
+
}
|
256
|
+
}
|
257
|
+
return m_hasModDir == YES;
|
258
|
+
}
|
259
|
+
|
260
|
+
bool hasModAutoIndex() {
|
261
|
+
if (m_hasModAutoIndex == UNKNOWN) {
|
262
|
+
if (ap_find_linked_module("mod_autoindex.c")) {
|
263
|
+
m_hasModAutoIndex = YES;
|
264
|
+
} else {
|
265
|
+
m_hasModAutoIndex = NO;
|
266
|
+
}
|
267
|
+
}
|
268
|
+
return m_hasModAutoIndex == YES;
|
269
|
+
}
|
270
|
+
|
271
|
+
int reportDocumentRootDeterminationError(request_rec *r) {
|
272
|
+
ap_set_content_type(r, "text/html; charset=UTF-8");
|
273
|
+
ap_rputs("<h1>Passenger error #1</h1>\n", r);
|
274
|
+
ap_rputs("Cannot determine the document root for the current request.", r);
|
275
|
+
return OK;
|
276
|
+
}
|
277
|
+
|
278
|
+
int reportBusyException(request_rec *r) {
|
279
|
+
ap_custom_response(r, HTTP_SERVICE_UNAVAILABLE,
|
280
|
+
"This website is too busy right now. Please try again later.");
|
281
|
+
return HTTP_SERVICE_UNAVAILABLE;
|
282
|
+
}
|
283
|
+
|
284
|
+
/**
|
285
|
+
* Gather some information about the request and do some preparations. In this method,
|
286
|
+
* it will be determined whether the request URI should be served statically by Apache
|
287
|
+
* (in case of static assets or in case there's a page cache file available) or
|
288
|
+
* whether it should be forwarded to the backend application.
|
289
|
+
*
|
290
|
+
* The strategy is as follows:
|
291
|
+
*
|
292
|
+
* We check whether Phusion Passenger is enabled for this URI (A).
|
293
|
+
* If so, then we check whether the following situations are true:
|
294
|
+
* (B) There is a backend application defined for this URI.
|
295
|
+
* (C) r->filename already exists.
|
296
|
+
* (D) There is a page cache file for the URI.
|
297
|
+
*
|
298
|
+
* - If A is not true, or if B is not true, or if C is true, then don't do anything.
|
299
|
+
* Passenger will be disabled during the rest of this request.
|
300
|
+
* - If D is true, then we first transform r->filename to the page cache file's
|
301
|
+
* filename, and then we let Apache serve it statically.
|
302
|
+
* - If D is not true, then we forward the request to the backend application.
|
303
|
+
*
|
304
|
+
* @pre The (A) condition must be true.
|
305
|
+
* @param coreModuleWillBeRun Whether the core.c map_to_storage hook might be called after this.
|
306
|
+
* @return Whether the Passenger handler hook method should be run.
|
307
|
+
*/
|
308
|
+
bool prepareRequest(request_rec *r, DirConfig *config, const char *filename, bool coreModuleWillBeRun = false) {
|
309
|
+
TRACE_POINT();
|
310
|
+
DirectoryMapper mapper(r, config, &cstat, config->getStatThrottleRate());
|
311
|
+
try {
|
312
|
+
if (mapper.getBaseURI() == NULL) {
|
313
|
+
// (B) is not true.
|
314
|
+
return false;
|
315
|
+
}
|
316
|
+
} catch (const FileSystemException &e) {
|
317
|
+
/* DirectoryMapper tried to examine the filesystem in order
|
318
|
+
* to autodetect the application type (e.g. by checking whether
|
319
|
+
* environment.rb exists. But something went wrong, probably
|
320
|
+
* because of a permission problem. This usually
|
321
|
+
* means that the user is trying to deploy an application, but
|
322
|
+
* set the wrong permissions on the relevant folders.
|
323
|
+
* Later, in the handler hook, we inform the user about this
|
324
|
+
* problem so that he can either disable Phusion Passenger's
|
325
|
+
* autodetection routines, or fix the permissions.
|
326
|
+
*
|
327
|
+
* If it's not a permission problem then we'll disable
|
328
|
+
* Phusion Passenger for the rest of the request.
|
329
|
+
*/
|
330
|
+
if (e.code() == EACCES || e.code() == EPERM) {
|
331
|
+
// TODO: filesystem error is not always reported. need
|
332
|
+
// to figure out why. test case:
|
333
|
+
// - mkdir /foo
|
334
|
+
// - mkdir /foo/public
|
335
|
+
// - mkdir /foo/config
|
336
|
+
// - chmod 000 /foo/config
|
337
|
+
// - add vhost 'foo' with document root /foo/public
|
338
|
+
// - curl http://foo/
|
339
|
+
apr_pool_userdata_set(new ReportFileSystemError(e),
|
340
|
+
"Phusion Passenger: error report",
|
341
|
+
ReportFileSystemError::cleanup,
|
342
|
+
r->pool);
|
343
|
+
return true;
|
344
|
+
} else {
|
345
|
+
return false;
|
346
|
+
}
|
347
|
+
}
|
348
|
+
|
349
|
+
/* Save some information for the hook methods that are called later.
|
350
|
+
* The existance of this note indicates that the URI belongs to a Phusion
|
351
|
+
* Passenger-served application.
|
352
|
+
*/
|
353
|
+
RequestNote *note = new RequestNote(mapper);
|
354
|
+
note->config = config;
|
355
|
+
apr_pool_userdata_set(note, "Phusion Passenger", RequestNote::cleanup, r->pool);
|
356
|
+
|
357
|
+
try {
|
358
|
+
// (B) is true.
|
359
|
+
FileType fileType = getFileType(filename);
|
360
|
+
if (fileType == FT_REGULAR) {
|
361
|
+
// (C) is true.
|
362
|
+
return false;
|
363
|
+
}
|
364
|
+
|
365
|
+
// (C) is not true. Check whether (D) is true.
|
366
|
+
char *pageCacheFile;
|
367
|
+
/* Only GET requests may hit the page cache. This is
|
368
|
+
* important because of REST conventions, e.g.
|
369
|
+
* 'POST /foo' maps to 'FooController#create',
|
370
|
+
* while 'GET /foo' maps to 'FooController#index'.
|
371
|
+
* We wouldn't want our page caching support to interfere
|
372
|
+
* with that.
|
373
|
+
*/
|
374
|
+
if (r->method_number == M_GET) {
|
375
|
+
if (fileType == FT_DIRECTORY) {
|
376
|
+
size_t len;
|
377
|
+
|
378
|
+
len = strlen(filename);
|
379
|
+
if (len > 0 && filename[len - 1] == '/') {
|
380
|
+
pageCacheFile = apr_pstrcat(r->pool, filename,
|
381
|
+
"index.html", NULL);
|
382
|
+
} else {
|
383
|
+
pageCacheFile = apr_pstrcat(r->pool, filename,
|
384
|
+
".html", NULL);
|
385
|
+
}
|
386
|
+
} else {
|
387
|
+
pageCacheFile = apr_pstrcat(r->pool, filename,
|
388
|
+
".html", NULL);
|
389
|
+
}
|
390
|
+
if (!fileExists(pageCacheFile)) {
|
391
|
+
pageCacheFile = NULL;
|
392
|
+
}
|
393
|
+
} else {
|
394
|
+
pageCacheFile = NULL;
|
395
|
+
}
|
396
|
+
if (pageCacheFile != NULL) {
|
397
|
+
// (D) is true.
|
398
|
+
r->filename = pageCacheFile;
|
399
|
+
r->canonical_filename = pageCacheFile;
|
400
|
+
if (!coreModuleWillBeRun) {
|
401
|
+
r->finfo.filetype = APR_NOFILE;
|
402
|
+
ap_set_content_type(r, "text/html");
|
403
|
+
ap_directory_walk(r);
|
404
|
+
ap_file_walk(r);
|
405
|
+
}
|
406
|
+
return false;
|
407
|
+
} else {
|
408
|
+
// (D) is not true.
|
409
|
+
note->forwardToBackend = true;
|
410
|
+
return true;
|
411
|
+
}
|
412
|
+
} catch (const FileSystemException &e) {
|
413
|
+
/* Something went wrong while accessing the directory in which
|
414
|
+
* r->filename lives. We already know that this URI belongs to
|
415
|
+
* a backend application, so this error probably means that the
|
416
|
+
* user set the wrong permissions for his 'public' folder. We
|
417
|
+
* don't let the handler hook run so that Apache can decide how
|
418
|
+
* to display the error.
|
419
|
+
*/
|
420
|
+
return false;
|
421
|
+
}
|
422
|
+
}
|
423
|
+
|
424
|
+
/**
|
425
|
+
* Most of the high-level logic for forwarding a request to a backend application
|
426
|
+
* is contained in this method.
|
427
|
+
*/
|
428
|
+
int handleRequest(request_rec *r) {
|
429
|
+
/********** Step 1: preparation work **********/
|
430
|
+
|
431
|
+
/* Check whether an error occured in prepareRequest() that should be reported
|
432
|
+
* to the browser.
|
433
|
+
*/
|
434
|
+
|
435
|
+
// The union is needed in order to be compliant with
|
436
|
+
// C99/C++'s strict aliasing rules. http://tinyurl.com/g5hgh
|
437
|
+
union {
|
438
|
+
ErrorReport *errorReport;
|
439
|
+
void *pointer;
|
440
|
+
} u;
|
441
|
+
|
442
|
+
/* Did an error occur in any of the previous hook methods during
|
443
|
+
* this request? If so, show the error and stop here.
|
444
|
+
*/
|
445
|
+
u.errorReport = 0;
|
446
|
+
apr_pool_userdata_get(&u.pointer, "Phusion Passenger: error report", r->pool);
|
447
|
+
if (u.errorReport != 0) {
|
448
|
+
return u.errorReport->report(r);
|
449
|
+
}
|
450
|
+
|
451
|
+
RequestNote *note = getRequestNote(r);
|
452
|
+
if (note == 0 || !note->forwardToBackend) {
|
453
|
+
return DECLINED;
|
454
|
+
} else if (r->handler != NULL && strcmp(r->handler, "redirect-handler") == 0) {
|
455
|
+
// mod_rewrite is at work.
|
456
|
+
return DECLINED;
|
457
|
+
}
|
458
|
+
|
459
|
+
TRACE_POINT();
|
460
|
+
DirConfig *config = note->config;
|
461
|
+
DirectoryMapper &mapper(note->mapper);
|
462
|
+
|
463
|
+
if (mapper.getPublicDirectory().empty()) {
|
464
|
+
return reportDocumentRootDeterminationError(r);
|
465
|
+
}
|
466
|
+
|
467
|
+
|
468
|
+
/********** Step 2: handle HTTP upload data, if any **********/
|
469
|
+
|
470
|
+
int httpStatus = ap_setup_client_block(r, REQUEST_CHUNKED_DECHUNK);
|
471
|
+
if (httpStatus != OK) {
|
472
|
+
return httpStatus;
|
473
|
+
}
|
474
|
+
|
475
|
+
try {
|
476
|
+
this_thread::disable_interruption di;
|
477
|
+
this_thread::disable_syscall_interruption dsi;
|
478
|
+
Application::SessionPtr session;
|
479
|
+
bool expectingUploadData;
|
480
|
+
string uploadDataMemory;
|
481
|
+
shared_ptr<BufferedUpload> uploadDataFile;
|
482
|
+
const char *contentLength;
|
483
|
+
|
484
|
+
expectingUploadData = ap_should_client_block(r);
|
485
|
+
contentLength = lookupHeader(r, "Content-Length");
|
486
|
+
|
487
|
+
/* If the HTTP upload data is larger than a threshold, or if the HTTP
|
488
|
+
* client sent HTTP upload data using the "chunked" transfer encoding
|
489
|
+
* (which implies Content-Length == NULL), then buffer the upload
|
490
|
+
* data into a tempfile. Otherwise, buffer it into memory.
|
491
|
+
*
|
492
|
+
* We never forward the data directly to the backend process because
|
493
|
+
* the HTTP client might block indefinitely until it's done uploading.
|
494
|
+
* This would quickly exhaust the application pool.
|
495
|
+
*/
|
496
|
+
if (expectingUploadData) {
|
497
|
+
if (contentLength == NULL || atol(contentLength) > LARGE_UPLOAD_THRESHOLD) {
|
498
|
+
uploadDataFile = receiveRequestBody(r, contentLength);
|
499
|
+
} else {
|
500
|
+
receiveRequestBody(r, contentLength, uploadDataMemory);
|
501
|
+
}
|
502
|
+
}
|
503
|
+
|
504
|
+
if (expectingUploadData && contentLength == NULL) {
|
505
|
+
/* In case of "chunked" transfer encoding, we'll set the
|
506
|
+
* Content-Length header to the length of the received upload
|
507
|
+
* data. Rails requires this header for its HTTP upload data
|
508
|
+
* multipart parsing process.
|
509
|
+
*/
|
510
|
+
if (uploadDataFile != NULL) {
|
511
|
+
apr_table_set(r->headers_in, "Content-Length",
|
512
|
+
toString(ftell(uploadDataFile->handle)).c_str());
|
513
|
+
} else {
|
514
|
+
apr_table_set(r->headers_in, "Content-Length",
|
515
|
+
toString(uploadDataMemory.size()).c_str());
|
516
|
+
}
|
517
|
+
}
|
518
|
+
|
519
|
+
|
520
|
+
/********** Step 3: forwarding the request to a backend
|
521
|
+
process from the application pool **********/
|
522
|
+
|
523
|
+
UPDATE_TRACE_POINT();
|
524
|
+
try {
|
525
|
+
ServerConfig *sconfig = getServerConfig(r->server);
|
526
|
+
string publicDirectory(mapper.getPublicDirectory());
|
527
|
+
PoolOptions options(
|
528
|
+
config->getAppRoot(publicDirectory.c_str()),
|
529
|
+
true,
|
530
|
+
sconfig->getDefaultUser(),
|
531
|
+
mapper.getEnvironment(),
|
532
|
+
config->getSpawnMethodString(),
|
533
|
+
mapper.getApplicationTypeString(),
|
534
|
+
config->frameworkSpawnerTimeout,
|
535
|
+
config->appSpawnerTimeout,
|
536
|
+
config->getMaxRequests(),
|
537
|
+
config->getMemoryLimit(),
|
538
|
+
config->usingGlobalQueue(),
|
539
|
+
config->getStatThrottleRate(),
|
540
|
+
config->getRestartDir(),
|
541
|
+
mapper.getBaseURI()
|
542
|
+
);
|
543
|
+
options.environmentVariables = ptr(new EnvironmentVariablesStringListCreator(r));
|
544
|
+
|
545
|
+
session = getApplicationPool()->get(options);
|
546
|
+
P_TRACE(3, "Forwarding " << r->uri << " to PID " << session->getPid());
|
547
|
+
} catch (const SpawnException &e) {
|
548
|
+
r->status = 500;
|
549
|
+
if (e.hasErrorPage()) {
|
550
|
+
ap_set_content_type(r, "text/html; charset=utf-8");
|
551
|
+
ap_rputs(e.getErrorPage().c_str(), r);
|
552
|
+
return OK;
|
553
|
+
} else {
|
554
|
+
throw;
|
555
|
+
}
|
556
|
+
} catch (const FileSystemException &e) {
|
557
|
+
/* The application root cannot be determined. This could
|
558
|
+
* happen if, for example, the user specified 'RailsBaseURI /foo'
|
559
|
+
* while there is no filesystem entry called "foo" in the virtual
|
560
|
+
* host's document root.
|
561
|
+
*/
|
562
|
+
return ReportFileSystemError(e).report(r);
|
563
|
+
} catch (const BusyException &e) {
|
564
|
+
return reportBusyException(r);
|
565
|
+
}
|
566
|
+
|
567
|
+
UPDATE_TRACE_POINT();
|
568
|
+
sendHeaders(r, config, session, mapper.getBaseURI());
|
569
|
+
if (expectingUploadData) {
|
570
|
+
if (uploadDataFile != NULL) {
|
571
|
+
sendRequestBody(r, session, uploadDataFile);
|
572
|
+
uploadDataFile.reset();
|
573
|
+
} else {
|
574
|
+
sendRequestBody(r, session, uploadDataMemory);
|
575
|
+
}
|
576
|
+
}
|
577
|
+
try {
|
578
|
+
session->shutdownWriter();
|
579
|
+
} catch (const SystemException &e) {
|
580
|
+
// Ignore ENOTCONN. This error occurs for some people
|
581
|
+
// for unknown reasons, but it's harmless.
|
582
|
+
if (e.code() != ENOTCONN) {
|
583
|
+
throw;
|
584
|
+
}
|
585
|
+
}
|
586
|
+
|
587
|
+
|
588
|
+
/********** Step 4: forwarding the response from the backend
|
589
|
+
process back to the HTTP client **********/
|
590
|
+
|
591
|
+
UPDATE_TRACE_POINT();
|
592
|
+
apr_bucket_brigade *bb;
|
593
|
+
apr_bucket *b;
|
594
|
+
PassengerBucketStatePtr bucketState;
|
595
|
+
pid_t backendPid;
|
596
|
+
|
597
|
+
/* Setup the bucket brigade. */
|
598
|
+
bucketState = ptr(new PassengerBucketState());
|
599
|
+
bb = apr_brigade_create(r->connection->pool, r->connection->bucket_alloc);
|
600
|
+
b = passenger_bucket_create(session, bucketState, r->connection->bucket_alloc);
|
601
|
+
|
602
|
+
/* The bucket (b) still has a reference to the session, so the reset()
|
603
|
+
* call here is guaranteed not to throw any exceptions.
|
604
|
+
*/
|
605
|
+
backendPid = session->getPid();
|
606
|
+
session.reset();
|
607
|
+
|
608
|
+
APR_BRIGADE_INSERT_TAIL(bb, b);
|
609
|
+
|
610
|
+
b = apr_bucket_eos_create(r->connection->bucket_alloc);
|
611
|
+
APR_BRIGADE_INSERT_TAIL(bb, b);
|
612
|
+
|
613
|
+
/* Now read the HTTP response header, parse it and fill relevant
|
614
|
+
* information in our request_rec structure.
|
615
|
+
*/
|
616
|
+
|
617
|
+
/* I know the required size for backendData because I read
|
618
|
+
* util_script.c's source. :-(
|
619
|
+
*/
|
620
|
+
char backendData[MAX_STRING_LEN];
|
621
|
+
Timer timer;
|
622
|
+
int result = ap_scan_script_header_err_brigade(r, bb, backendData);
|
623
|
+
|
624
|
+
if (result == OK) {
|
625
|
+
// The API documentation for ap_scan_script_err_brigade() says it
|
626
|
+
// returns HTTP_OK on success, but it actually returns OK.
|
627
|
+
|
628
|
+
/* We were able to parse the HTTP response header sent by the
|
629
|
+
* backend process! Proceed with passing the bucket brigade,
|
630
|
+
* for forwarding the response body to the HTTP client.
|
631
|
+
*/
|
632
|
+
|
633
|
+
/* Manually set the Status header because
|
634
|
+
* ap_scan_script_header_err_brigade() filters it
|
635
|
+
* out. Some broken HTTP clients depend on the
|
636
|
+
* Status header for retrieving the HTTP status.
|
637
|
+
*/
|
638
|
+
if (!r->status_line || *r->status_line == '\0') {
|
639
|
+
r->status_line = apr_psprintf(r->pool,
|
640
|
+
"%d Unknown Status",
|
641
|
+
r->status);
|
642
|
+
}
|
643
|
+
apr_table_setn(r->headers_out, "Status", r->status_line);
|
644
|
+
|
645
|
+
UPDATE_TRACE_POINT();
|
646
|
+
ap_pass_brigade(r->output_filters, bb);
|
647
|
+
|
648
|
+
if (r->connection->aborted) {
|
649
|
+
P_WARN("Either the vistor clicked on the 'Stop' button in the "
|
650
|
+
"web browser, or the visitor's connection has stalled "
|
651
|
+
"and couldn't receive the data that Apache is sending "
|
652
|
+
"to it. As a result, you will probably see a 'Broken Pipe' "
|
653
|
+
"error in this log file. Please ignore it, "
|
654
|
+
"this is normal. You might also want to increase Apache's "
|
655
|
+
"TimeOut configuration option if you experience this "
|
656
|
+
"problem often.");
|
657
|
+
} else if (!bucketState->completed) {
|
658
|
+
P_WARN("Apache stopped forwarding the backend's response, "
|
659
|
+
"even though the HTTP client did not close the "
|
660
|
+
"connection. Is this an Apache bug?");
|
661
|
+
}
|
662
|
+
|
663
|
+
return OK;
|
664
|
+
} else if (backendData[0] == '\0') {
|
665
|
+
if ((long long) timer.elapsed() >= r->server->timeout / 1000) {
|
666
|
+
// Looks like an I/O timeout.
|
667
|
+
P_ERROR("No data received from " <<
|
668
|
+
"the backend application (process " <<
|
669
|
+
backendPid << ") within " <<
|
670
|
+
(r->server->timeout / 1000) << " msec. Either " <<
|
671
|
+
"the backend application is frozen, or " <<
|
672
|
+
"your TimeOut value of " <<
|
673
|
+
(r->server->timeout / 1000000) <<
|
674
|
+
" seconds is too low. Please check " <<
|
675
|
+
"whether your application is frozen, or " <<
|
676
|
+
"increase the value of the TimeOut " <<
|
677
|
+
"configuration directive.");
|
678
|
+
} else {
|
679
|
+
P_ERROR("The backend application (process " <<
|
680
|
+
backendPid << ") did not send a valid " <<
|
681
|
+
"HTTP response; instead, it sent nothing " <<
|
682
|
+
"at all. It is possible that it has crashed; " <<
|
683
|
+
"please check whether there are crashing " <<
|
684
|
+
"bugs in this application.");
|
685
|
+
}
|
686
|
+
apr_table_setn(r->err_headers_out, "Status", "500 Internal Server Error");
|
687
|
+
return HTTP_INTERNAL_SERVER_ERROR;
|
688
|
+
} else {
|
689
|
+
if ((long long) timer.elapsed() >= r->server->timeout / 1000) {
|
690
|
+
// Looks like an I/O timeout.
|
691
|
+
P_ERROR("The backend application (process " <<
|
692
|
+
backendPid << ") hasn't sent a valid " <<
|
693
|
+
"HTTP response within " <<
|
694
|
+
(r->server->timeout / 1000) << " msec. Either " <<
|
695
|
+
"the backend application froze while " <<
|
696
|
+
"sending a response, or " <<
|
697
|
+
"your TimeOut value of " <<
|
698
|
+
(r->server->timeout / 1000000) <<
|
699
|
+
" seconds is too low. Please check " <<
|
700
|
+
"whether the application is frozen, or " <<
|
701
|
+
"increase the value of the TimeOut " <<
|
702
|
+
"configuration directive. The application " <<
|
703
|
+
"has sent this data so far: [" <<
|
704
|
+
backendData << "]");
|
705
|
+
} else {
|
706
|
+
P_ERROR("The backend application (process " <<
|
707
|
+
backendPid << ") didn't send a valid " <<
|
708
|
+
"HTTP response. It might have crashed " <<
|
709
|
+
"during the middle of sending an HTTP " <<
|
710
|
+
"response, so please check whether there " <<
|
711
|
+
"are crashing problems in your application. " <<
|
712
|
+
"This is the data that it sent: [" <<
|
713
|
+
backendData << "]");
|
714
|
+
}
|
715
|
+
apr_table_setn(r->err_headers_out, "Status", "500 Internal Server Error");
|
716
|
+
return HTTP_INTERNAL_SERVER_ERROR;
|
717
|
+
}
|
718
|
+
|
719
|
+
} catch (const thread_interrupted &e) {
|
720
|
+
P_TRACE(3, "A system call was interrupted during an HTTP request. Apache "
|
721
|
+
"is probably restarting or shutting down. Backtrace:\n" <<
|
722
|
+
e.backtrace());
|
723
|
+
return HTTP_INTERNAL_SERVER_ERROR;
|
724
|
+
|
725
|
+
} catch (const tracable_exception &e) {
|
726
|
+
P_ERROR("Unexpected error in mod_passenger: " <<
|
727
|
+
e.what() << "\n" << " Backtrace:\n" << e.backtrace());
|
728
|
+
return HTTP_INTERNAL_SERVER_ERROR;
|
729
|
+
|
730
|
+
} catch (const exception &e) {
|
731
|
+
P_ERROR("Unexpected error in mod_passenger: " <<
|
732
|
+
e.what() << "\n" << " Backtrace: not available");
|
733
|
+
return HTTP_INTERNAL_SERVER_ERROR;
|
734
|
+
|
735
|
+
} catch (...) {
|
736
|
+
P_ERROR("An unexpected, unknown error occured in mod_passenger.");
|
737
|
+
throw;
|
738
|
+
}
|
739
|
+
}
|
740
|
+
|
741
|
+
/**
|
742
|
+
* Convert an HTTP header name to a CGI environment name.
|
743
|
+
*/
|
744
|
+
char *http2env(apr_pool_t *p, const char *name) {
|
745
|
+
char *env_name = apr_pstrcat(p, "HTTP_", name, NULL);
|
746
|
+
char *cp;
|
747
|
+
|
748
|
+
for (cp = env_name + 5; *cp != 0; cp++) {
|
749
|
+
if (*cp == '-') {
|
750
|
+
*cp = '_';
|
751
|
+
} else {
|
752
|
+
*cp = apr_toupper(*cp);
|
753
|
+
}
|
754
|
+
}
|
755
|
+
|
756
|
+
return env_name;
|
757
|
+
}
|
758
|
+
|
759
|
+
char *lookupName(apr_table_t *t, const char *name) {
|
760
|
+
const apr_array_header_t *hdrs_arr = apr_table_elts(t);
|
761
|
+
apr_table_entry_t *hdrs = (apr_table_entry_t *) hdrs_arr->elts;
|
762
|
+
int i;
|
763
|
+
|
764
|
+
for (i = 0; i < hdrs_arr->nelts; ++i) {
|
765
|
+
if (hdrs[i].key == NULL) {
|
766
|
+
continue;
|
767
|
+
}
|
768
|
+
if (strcasecmp(hdrs[i].key, name) == 0) {
|
769
|
+
return hdrs[i].val;
|
770
|
+
}
|
771
|
+
}
|
772
|
+
return NULL;
|
773
|
+
}
|
774
|
+
|
775
|
+
char *lookupHeader(request_rec *r, const char *name) {
|
776
|
+
return lookupName(r->headers_in, name);
|
777
|
+
}
|
778
|
+
|
779
|
+
char *lookupEnv(request_rec *r, const char *name) {
|
780
|
+
return lookupName(r->subprocess_env, name);
|
781
|
+
}
|
782
|
+
|
783
|
+
void inline addHeader(apr_table_t *table, const char *name, const char *value) {
|
784
|
+
if (name != NULL && value != NULL) {
|
785
|
+
apr_table_addn(table, name, value);
|
786
|
+
}
|
787
|
+
}
|
788
|
+
|
789
|
+
apr_status_t sendHeaders(request_rec *r, DirConfig *config, Application::SessionPtr &session, const char *baseURI) {
|
790
|
+
apr_table_t *headers;
|
791
|
+
headers = apr_table_make(r->pool, 40);
|
792
|
+
if (headers == NULL) {
|
793
|
+
return APR_ENOMEM;
|
794
|
+
}
|
795
|
+
|
796
|
+
|
797
|
+
// Set standard CGI variables.
|
798
|
+
addHeader(headers, "SERVER_SOFTWARE", ap_get_server_version());
|
799
|
+
addHeader(headers, "SERVER_PROTOCOL", r->protocol);
|
800
|
+
addHeader(headers, "SERVER_NAME", ap_get_server_name(r));
|
801
|
+
addHeader(headers, "SERVER_ADMIN", r->server->server_admin);
|
802
|
+
addHeader(headers, "SERVER_ADDR", r->connection->local_ip);
|
803
|
+
addHeader(headers, "SERVER_PORT", apr_psprintf(r->pool, "%u", ap_get_server_port(r)));
|
804
|
+
addHeader(headers, "REMOTE_ADDR", r->connection->remote_ip);
|
805
|
+
addHeader(headers, "REMOTE_PORT", apr_psprintf(r->pool, "%d", r->connection->remote_addr->port));
|
806
|
+
addHeader(headers, "REMOTE_USER", r->user);
|
807
|
+
addHeader(headers, "REQUEST_METHOD", r->method);
|
808
|
+
addHeader(headers, "QUERY_STRING", r->args ? r->args : "");
|
809
|
+
addHeader(headers, "HTTPS", lookupEnv(r, "HTTPS"));
|
810
|
+
addHeader(headers, "CONTENT_TYPE", lookupHeader(r, "Content-type"));
|
811
|
+
addHeader(headers, "DOCUMENT_ROOT", ap_document_root(r));
|
812
|
+
|
813
|
+
if (config->allowsEncodedSlashes()) {
|
814
|
+
/*
|
815
|
+
* Apache decodes encoded slashes in r->uri, so we must use r->unparsed_uri
|
816
|
+
* if we are to support encoded slashes. However mod_rewrite doesn't change
|
817
|
+
* r->unparsed_uri, so the user must make a choice between mod_rewrite
|
818
|
+
* support or encoded slashes support. Sucks. :-(
|
819
|
+
*
|
820
|
+
* http://code.google.com/p/phusion-passenger/issues/detail?id=113
|
821
|
+
* http://code.google.com/p/phusion-passenger/issues/detail?id=230
|
822
|
+
*/
|
823
|
+
addHeader(headers, "REQUEST_URI", r->unparsed_uri);
|
824
|
+
} else {
|
825
|
+
const char *request_uri;
|
826
|
+
if (r->args != NULL) {
|
827
|
+
request_uri = apr_pstrcat(r->pool, r->uri, "?", r->args, NULL);
|
828
|
+
} else {
|
829
|
+
request_uri = r->uri;
|
830
|
+
}
|
831
|
+
addHeader(headers, "REQUEST_URI", request_uri);
|
832
|
+
}
|
833
|
+
|
834
|
+
if (strcmp(baseURI, "/") == 0) {
|
835
|
+
addHeader(headers, "SCRIPT_NAME", "");
|
836
|
+
addHeader(headers, "PATH_INFO", r->uri);
|
837
|
+
} else {
|
838
|
+
addHeader(headers, "SCRIPT_NAME", baseURI);
|
839
|
+
addHeader(headers, "PATH_INFO", r->uri + strlen(baseURI));
|
840
|
+
}
|
841
|
+
|
842
|
+
// Set HTTP headers.
|
843
|
+
const apr_array_header_t *hdrs_arr;
|
844
|
+
apr_table_entry_t *hdrs;
|
845
|
+
int i;
|
846
|
+
|
847
|
+
hdrs_arr = apr_table_elts(r->headers_in);
|
848
|
+
hdrs = (apr_table_entry_t *) hdrs_arr->elts;
|
849
|
+
for (i = 0; i < hdrs_arr->nelts; ++i) {
|
850
|
+
if (hdrs[i].key) {
|
851
|
+
addHeader(headers, http2env(r->pool, hdrs[i].key), hdrs[i].val);
|
852
|
+
}
|
853
|
+
}
|
854
|
+
|
855
|
+
// Add other environment variables.
|
856
|
+
const apr_array_header_t *env_arr;
|
857
|
+
apr_table_entry_t *env;
|
858
|
+
|
859
|
+
env_arr = apr_table_elts(r->subprocess_env);
|
860
|
+
env = (apr_table_entry_t*) env_arr->elts;
|
861
|
+
for (i = 0; i < env_arr->nelts; ++i) {
|
862
|
+
addHeader(headers, env[i].key, env[i].val);
|
863
|
+
}
|
864
|
+
|
865
|
+
// Now send the headers.
|
866
|
+
string buffer;
|
867
|
+
|
868
|
+
hdrs_arr = apr_table_elts(headers);
|
869
|
+
hdrs = (apr_table_entry_t*) hdrs_arr->elts;
|
870
|
+
buffer.reserve(1024 * 4);
|
871
|
+
for (i = 0; i < hdrs_arr->nelts; ++i) {
|
872
|
+
buffer.append(hdrs[i].key);
|
873
|
+
buffer.append(1, '\0');
|
874
|
+
buffer.append(hdrs[i].val);
|
875
|
+
buffer.append(1, '\0');
|
876
|
+
}
|
877
|
+
|
878
|
+
/*
|
879
|
+
* If the last header value is an empty string, then the buffer
|
880
|
+
* will end with "\0\0". For example, if 'SSLOptions +ExportCertData'
|
881
|
+
* is set, and there's no client certificate, and 'SSL_CLIENT_CERT'
|
882
|
+
* is the last header, then the buffer will end with:
|
883
|
+
*
|
884
|
+
* "SSL_CLIENT_CERT\0\0"
|
885
|
+
*
|
886
|
+
* The data in the buffer will be processed by the AbstractRequestHandler class,
|
887
|
+
* which is implemented in Ruby. But it uses Hash[*data.split("\0")] to
|
888
|
+
* unserialize the data. Unfortunately String#split will not transform
|
889
|
+
* the trailing "\0\0" into an empty string:
|
890
|
+
*
|
891
|
+
* "SSL_CLIENT_CERT\0\0".split("\0")
|
892
|
+
* # => desired result: ["SSL_CLIENT_CERT", ""]
|
893
|
+
* # => actual result: ["SSL_CLIENT_CERT"]
|
894
|
+
*
|
895
|
+
* When that happens, Hash[..] will raise an ArgumentError because
|
896
|
+
* data.split("\0") does not return an array with a length that is a
|
897
|
+
* multiple of 2.
|
898
|
+
*
|
899
|
+
* So here, we add a dummy header to prevent situations like that from
|
900
|
+
* happening.
|
901
|
+
*/
|
902
|
+
buffer.append("_\0_\0", 4);
|
903
|
+
|
904
|
+
session->sendHeaders(buffer);
|
905
|
+
return APR_SUCCESS;
|
906
|
+
}
|
907
|
+
|
908
|
+
void throwUploadBufferingException(request_rec *r, int code) {
|
909
|
+
DirConfig *config = getDirConfig(r);
|
910
|
+
string message("An error occured while "
|
911
|
+
"buffering HTTP upload data to "
|
912
|
+
"a temporary file in ");
|
913
|
+
message.append(config->getUploadBufferDir());
|
914
|
+
|
915
|
+
switch (code) {
|
916
|
+
case ENOSPC:
|
917
|
+
message.append(". Disk directory doesn't have enough disk space, "
|
918
|
+
"so please make sure that it has "
|
919
|
+
"enough disk space for buffering file uploads, "
|
920
|
+
"or set the 'PassengerUploadBufferDir' directive "
|
921
|
+
"to a directory that has enough disk space.");
|
922
|
+
throw RuntimeException(message);
|
923
|
+
break;
|
924
|
+
case EDQUOT:
|
925
|
+
message.append(". The current Apache worker process (which is "
|
926
|
+
"running as ");
|
927
|
+
message.append(getProcessUsername());
|
928
|
+
message.append(") cannot write to this directory because of "
|
929
|
+
"disk quota limits. Please make sure that the volume "
|
930
|
+
"that this directory resides on has enough disk space "
|
931
|
+
"quota for the Apache worker process, or set the "
|
932
|
+
"'PassengerUploadBufferDir' directive to a different "
|
933
|
+
"directory that has enough disk space quota.");
|
934
|
+
throw RuntimeException(message);
|
935
|
+
break;
|
936
|
+
case ENOENT:
|
937
|
+
message.append(". This directory doesn't exist, so please make "
|
938
|
+
"sure that this directory exists, or set the "
|
939
|
+
"'PassengerUploadBufferDir' directive to a "
|
940
|
+
"directory that exists and can be written to.");
|
941
|
+
throw RuntimeException(message);
|
942
|
+
break;
|
943
|
+
case EACCES:
|
944
|
+
message.append(". The current Apache worker process (which is "
|
945
|
+
"running as ");
|
946
|
+
message.append(getProcessUsername());
|
947
|
+
message.append(") doesn't have permissions to write to this "
|
948
|
+
"directory. Please change the permissions for this "
|
949
|
+
"directory (as well as all parent directories) so that "
|
950
|
+
"it is writable by the Apache worker process, or set "
|
951
|
+
"the 'PassengerUploadBufferDir' directive to a directory "
|
952
|
+
"that Apache can write to.");
|
953
|
+
throw RuntimeException(message);
|
954
|
+
break;
|
955
|
+
default:
|
956
|
+
throw SystemException(message, code);
|
957
|
+
break;
|
958
|
+
}
|
959
|
+
}
|
960
|
+
|
961
|
+
/**
|
962
|
+
* Reads the next chunk of the request body and put it into a buffer.
|
963
|
+
*
|
964
|
+
* This is like ap_get_client_block(), but can actually report errors
|
965
|
+
* in a sane way. ap_get_client_block() tells you that something went
|
966
|
+
* wrong, but not *what* went wrong.
|
967
|
+
*
|
968
|
+
* @param r The current request.
|
969
|
+
* @param buffer A buffer to put the read data into.
|
970
|
+
* @param bufsiz The size of the buffer.
|
971
|
+
* @return The number of bytes read, or 0 on EOF.
|
972
|
+
* @throws RuntimeException Something non-I/O related went wrong, e.g.
|
973
|
+
* failure to allocate memory and stuff.
|
974
|
+
* @throws IOException An I/O error occurred while trying to read the
|
975
|
+
* request body data.
|
976
|
+
*/
|
977
|
+
unsigned long readRequestBodyFromApache(request_rec *r, char *buffer, apr_size_t bufsiz) {
|
978
|
+
apr_status_t rv;
|
979
|
+
apr_bucket_brigade *bb;
|
980
|
+
|
981
|
+
if (r->remaining < 0 || (!r->read_chunked && r->remaining == 0)) {
|
982
|
+
return 0;
|
983
|
+
}
|
984
|
+
|
985
|
+
bb = apr_brigade_create(r->pool, r->connection->bucket_alloc);
|
986
|
+
if (bb == NULL) {
|
987
|
+
r->connection->keepalive = AP_CONN_CLOSE;
|
988
|
+
throw RuntimeException("An error occurred while receiving HTTP upload data: "
|
989
|
+
"unable to create a bucket brigade. Maybe the system doesn't have "
|
990
|
+
"enough free memory.");
|
991
|
+
}
|
992
|
+
|
993
|
+
rv = ap_get_brigade(r->input_filters, bb, AP_MODE_READBYTES,
|
994
|
+
APR_BLOCK_READ, bufsiz);
|
995
|
+
|
996
|
+
/* We lose the failure code here. This is why ap_get_client_block should
|
997
|
+
* not be used.
|
998
|
+
*/
|
999
|
+
if (rv != APR_SUCCESS) {
|
1000
|
+
/* if we actually fail here, we want to just return and
|
1001
|
+
* stop trying to read data from the client.
|
1002
|
+
*/
|
1003
|
+
r->connection->keepalive = AP_CONN_CLOSE;
|
1004
|
+
apr_brigade_destroy(bb);
|
1005
|
+
|
1006
|
+
char buf[150], *errorString, message[1024];
|
1007
|
+
errorString = apr_strerror(rv, buf, sizeof(buf));
|
1008
|
+
if (errorString != NULL) {
|
1009
|
+
snprintf(message, sizeof(message),
|
1010
|
+
"An error occurred while receiving HTTP upload data: %s (%d)",
|
1011
|
+
errorString, rv);
|
1012
|
+
} else {
|
1013
|
+
snprintf(message, sizeof(message),
|
1014
|
+
"An error occurred while receiving HTTP upload data: unknown error %d",
|
1015
|
+
rv);
|
1016
|
+
}
|
1017
|
+
message[sizeof(message) - 1] = '\0';
|
1018
|
+
throw RuntimeException(message);
|
1019
|
+
}
|
1020
|
+
|
1021
|
+
/* If this fails, it means that a filter is written incorrectly and that
|
1022
|
+
* it needs to learn how to properly handle APR_BLOCK_READ requests by
|
1023
|
+
* returning data when requested.
|
1024
|
+
*/
|
1025
|
+
if (APR_BRIGADE_EMPTY(bb)) {
|
1026
|
+
throw RuntimeException("An error occurred while receiving HTTP upload data: "
|
1027
|
+
"the next filter in the input filter chain has "
|
1028
|
+
"a bug. Please contact the author who wrote this filter about "
|
1029
|
+
"this. This problem is not caused by Phusion Passenger.");
|
1030
|
+
}
|
1031
|
+
|
1032
|
+
/* Check to see if EOS in the brigade.
|
1033
|
+
*
|
1034
|
+
* If so, we have to leave a nugget for the *next* readRequestBodyFromApache()
|
1035
|
+
* call to return 0.
|
1036
|
+
*/
|
1037
|
+
if (APR_BUCKET_IS_EOS(APR_BRIGADE_LAST(bb))) {
|
1038
|
+
if (r->read_chunked) {
|
1039
|
+
r->remaining = -1;
|
1040
|
+
} else {
|
1041
|
+
r->remaining = 0;
|
1042
|
+
}
|
1043
|
+
}
|
1044
|
+
|
1045
|
+
rv = apr_brigade_flatten(bb, buffer, &bufsiz);
|
1046
|
+
if (rv != APR_SUCCESS) {
|
1047
|
+
apr_brigade_destroy(bb);
|
1048
|
+
|
1049
|
+
char buf[150], *errorString, message[1024];
|
1050
|
+
errorString = apr_strerror(rv, buf, sizeof(buf));
|
1051
|
+
if (errorString != NULL) {
|
1052
|
+
snprintf(message, sizeof(message),
|
1053
|
+
"An error occurred while receiving HTTP upload data: %s (%d)",
|
1054
|
+
errorString, rv);
|
1055
|
+
} else {
|
1056
|
+
snprintf(message, sizeof(message),
|
1057
|
+
"An error occurred while receiving HTTP upload data: unknown error %d",
|
1058
|
+
rv);
|
1059
|
+
}
|
1060
|
+
message[sizeof(message) - 1] = '\0';
|
1061
|
+
throw IOException(message);
|
1062
|
+
}
|
1063
|
+
|
1064
|
+
/* XXX yank me? */
|
1065
|
+
r->read_length += bufsiz;
|
1066
|
+
|
1067
|
+
apr_brigade_destroy(bb);
|
1068
|
+
return bufsiz;
|
1069
|
+
}
|
1070
|
+
|
1071
|
+
/**
|
1072
|
+
* Receive the HTTP upload data and buffer it into a BufferedUpload temp file.
|
1073
|
+
*
|
1074
|
+
* @param r The request.
|
1075
|
+
* @param contentLength The value of the HTTP Content-Length header. This is used
|
1076
|
+
* to check whether the HTTP client has sent complete upload
|
1077
|
+
* data. NULL indicates that there is no Content-Length header,
|
1078
|
+
* i.e. that the HTTP client used chunked transfer encoding.
|
1079
|
+
* @throws RuntimeException
|
1080
|
+
* @throws SystemException
|
1081
|
+
* @throws IOException
|
1082
|
+
*/
|
1083
|
+
shared_ptr<BufferedUpload> receiveRequestBody(request_rec *r, const char *contentLength) {
|
1084
|
+
TRACE_POINT();
|
1085
|
+
DirConfig *config = getDirConfig(r);
|
1086
|
+
shared_ptr<BufferedUpload> tempFile;
|
1087
|
+
try {
|
1088
|
+
tempFile.reset(new BufferedUpload(config->getUploadBufferDir()));
|
1089
|
+
} catch (const SystemException &e) {
|
1090
|
+
throwUploadBufferingException(r, e.code());
|
1091
|
+
}
|
1092
|
+
|
1093
|
+
char buf[1024 * 32];
|
1094
|
+
apr_off_t len;
|
1095
|
+
size_t total_written = 0;
|
1096
|
+
|
1097
|
+
while ((len = readRequestBodyFromApache(r, buf, sizeof(buf))) > 0) {
|
1098
|
+
size_t written = 0;
|
1099
|
+
do {
|
1100
|
+
size_t ret = fwrite(buf, 1, len - written, tempFile->handle);
|
1101
|
+
if (ret <= 0 || fflush(tempFile->handle) == EOF) {
|
1102
|
+
throwUploadBufferingException(r, errno);
|
1103
|
+
}
|
1104
|
+
written += ret;
|
1105
|
+
} while (written < (size_t) len);
|
1106
|
+
total_written += written;
|
1107
|
+
}
|
1108
|
+
|
1109
|
+
if (contentLength != NULL && ftell(tempFile->handle) != atol(contentLength)) {
|
1110
|
+
string message = "It looks like the browser did not finish the file upload: "
|
1111
|
+
"it said it will upload ";
|
1112
|
+
message.append(contentLength);
|
1113
|
+
message.append(" bytes, but it closed the connection after sending ");
|
1114
|
+
message.append(toString(ftell(tempFile->handle)));
|
1115
|
+
message.append(" bytes. The user probably clicked Stop in the browser "
|
1116
|
+
"or his Internet connection stalled.");
|
1117
|
+
throw IOException(message);
|
1118
|
+
}
|
1119
|
+
return tempFile;
|
1120
|
+
}
|
1121
|
+
|
1122
|
+
/**
|
1123
|
+
* Receive the HTTP upload data and buffer it into a string.
|
1124
|
+
*
|
1125
|
+
* @param r The request.
|
1126
|
+
* @param contentLength The value of the HTTP Content-Length header. This is used
|
1127
|
+
* to check whether the HTTP client has sent complete upload
|
1128
|
+
* data. NULL indicates that there is no Content-Length header,
|
1129
|
+
* i.e. that the HTTP client used chunked transfer encoding.
|
1130
|
+
* @param string The string to buffer into.
|
1131
|
+
* @throws RuntimeException
|
1132
|
+
* @throws IOException
|
1133
|
+
*/
|
1134
|
+
void receiveRequestBody(request_rec *r, const char *contentLength, string &buffer) {
|
1135
|
+
TRACE_POINT();
|
1136
|
+
unsigned long l_contentLength = 0;
|
1137
|
+
char buf[1024 * 32];
|
1138
|
+
apr_off_t len;
|
1139
|
+
|
1140
|
+
buffer.clear();
|
1141
|
+
if (contentLength != NULL) {
|
1142
|
+
l_contentLength = atol(contentLength);
|
1143
|
+
buffer.reserve(l_contentLength);
|
1144
|
+
}
|
1145
|
+
|
1146
|
+
while ((len = readRequestBodyFromApache(r, buf, sizeof(buf))) > 0) {
|
1147
|
+
buffer.append(buf, len);
|
1148
|
+
}
|
1149
|
+
|
1150
|
+
if (contentLength != NULL && buffer.size() != l_contentLength) {
|
1151
|
+
string message = "It looks like the browser did not finish the file upload: "
|
1152
|
+
"it said it will upload ";
|
1153
|
+
message.append(contentLength);
|
1154
|
+
message.append(" bytes, but it closed the connection after sending ");
|
1155
|
+
message.append(toString(buffer.size()));
|
1156
|
+
message.append(" bytes. The user probably clicked Stop in the browser "
|
1157
|
+
"or his Internet connection stalled.");
|
1158
|
+
throw IOException(message);
|
1159
|
+
}
|
1160
|
+
}
|
1161
|
+
|
1162
|
+
void sendRequestBody(request_rec *r, Application::SessionPtr &session, shared_ptr<BufferedUpload> &uploadData) {
|
1163
|
+
TRACE_POINT();
|
1164
|
+
rewind(uploadData->handle);
|
1165
|
+
while (!feof(uploadData->handle)) {
|
1166
|
+
char buf[1024 * 32];
|
1167
|
+
size_t size;
|
1168
|
+
|
1169
|
+
size = fread(buf, 1, sizeof(buf), uploadData->handle);
|
1170
|
+
|
1171
|
+
session->sendBodyBlock(buf, size);
|
1172
|
+
}
|
1173
|
+
}
|
1174
|
+
|
1175
|
+
void sendRequestBody(request_rec *r, Application::SessionPtr &session, const string &buffer) {
|
1176
|
+
session->sendBodyBlock(buffer.c_str(), buffer.size());
|
1177
|
+
}
|
1178
|
+
|
1179
|
+
public:
|
1180
|
+
Hooks(apr_pool_t *pconf, apr_pool_t *plog, apr_pool_t *ptemp, server_rec *s)
|
1181
|
+
: cstat(1024) {
|
1182
|
+
passenger_config_merge_all_servers(pconf, s);
|
1183
|
+
ServerConfig *config = getServerConfig(s);
|
1184
|
+
Passenger::setLogLevel(config->logLevel);
|
1185
|
+
m_hasModRewrite = UNKNOWN;
|
1186
|
+
m_hasModDir = UNKNOWN;
|
1187
|
+
m_hasModAutoIndex = UNKNOWN;
|
1188
|
+
|
1189
|
+
P_DEBUG("Initializing Phusion Passenger...");
|
1190
|
+
ap_add_version_component(pconf, "Phusion_Passenger/" PASSENGER_VERSION);
|
1191
|
+
|
1192
|
+
const char *user;
|
1193
|
+
string applicationPoolServerExe, spawnServer;
|
1194
|
+
|
1195
|
+
createPassengerTempDir(config->getTempDir(), config->userSwitching,
|
1196
|
+
config->getDefaultUser(), unixd_config.user_id,
|
1197
|
+
unixd_config.group_id);
|
1198
|
+
|
1199
|
+
if (config->userSwitching) {
|
1200
|
+
user = "";
|
1201
|
+
} else {
|
1202
|
+
user = config->getDefaultUser();
|
1203
|
+
}
|
1204
|
+
|
1205
|
+
if (config->root == NULL) {
|
1206
|
+
throw ConfigurationException("The 'PassengerRoot' configuration option "
|
1207
|
+
"is not specified. This option is required, so please specify it. "
|
1208
|
+
"TIP: The correct value for this option was given to you by "
|
1209
|
+
"'passenger-install-apache2-module'.");
|
1210
|
+
}
|
1211
|
+
|
1212
|
+
spawnServer = findSpawnServer(config->root);
|
1213
|
+
if (!fileExists(spawnServer.c_str())) {
|
1214
|
+
string message("The Passenger spawn server script, '");
|
1215
|
+
message.append(spawnServer);
|
1216
|
+
message.append("', does not exist. Please check whether the 'PassengerRoot' "
|
1217
|
+
"option is specified correctly.");
|
1218
|
+
throw FileNotFoundException(message);
|
1219
|
+
}
|
1220
|
+
applicationPoolServerExe = findApplicationPoolServer(config->root);
|
1221
|
+
if (!fileExists(applicationPoolServerExe.c_str())) {
|
1222
|
+
string message("The Passenger application pool server, '");
|
1223
|
+
message.append(applicationPoolServerExe);
|
1224
|
+
message.append("', does not exist. Please check whether the 'PassengerRoot' "
|
1225
|
+
"option is specified correctly.");
|
1226
|
+
throw FileNotFoundException(message);
|
1227
|
+
}
|
1228
|
+
|
1229
|
+
applicationPoolServer = ptr(
|
1230
|
+
new ApplicationPoolServer(
|
1231
|
+
applicationPoolServerExe, spawnServer, "",
|
1232
|
+
config->getRuby(), user)
|
1233
|
+
);
|
1234
|
+
|
1235
|
+
ApplicationPoolPtr pool(applicationPoolServer->connect());
|
1236
|
+
pool->setMax(config->maxPoolSize);
|
1237
|
+
pool->setMaxPerApp(config->maxInstancesPerApp);
|
1238
|
+
pool->setMaxIdleTime(config->poolIdleTime);
|
1239
|
+
}
|
1240
|
+
|
1241
|
+
~Hooks() {
|
1242
|
+
removeDirTree(getPassengerTempDir().c_str());
|
1243
|
+
}
|
1244
|
+
|
1245
|
+
int prepareRequestWhenInHighPerformanceMode(request_rec *r) {
|
1246
|
+
DirConfig *config = getDirConfig(r);
|
1247
|
+
if (config->isEnabled() && config->highPerformanceMode()) {
|
1248
|
+
if (prepareRequest(r, config, r->filename, true)) {
|
1249
|
+
return OK;
|
1250
|
+
} else {
|
1251
|
+
return DECLINED;
|
1252
|
+
}
|
1253
|
+
} else {
|
1254
|
+
return DECLINED;
|
1255
|
+
}
|
1256
|
+
}
|
1257
|
+
|
1258
|
+
/**
|
1259
|
+
* This is the hook method for the map_to_storage hook. Apache's final map_to_storage hook
|
1260
|
+
* method (defined in core.c) will do the following:
|
1261
|
+
*
|
1262
|
+
* If r->filename doesn't exist, then it will change the filename to the
|
1263
|
+
* following form:
|
1264
|
+
*
|
1265
|
+
* A/B
|
1266
|
+
*
|
1267
|
+
* A is top-most directory that exists. B is the first filename piece that
|
1268
|
+
* normally follows A. For example, suppose that a website's DocumentRoot
|
1269
|
+
* is /website, on server http://test.com/. Suppose that there's also a
|
1270
|
+
* directory /website/images. No other files or directories exist in /website.
|
1271
|
+
*
|
1272
|
+
* If we access: then r->filename will be:
|
1273
|
+
* http://test.com/foo/bar /website/foo
|
1274
|
+
* http://test.com/foo/bar/baz /website/foo
|
1275
|
+
* http://test.com/images/foo/bar /website/images/foo
|
1276
|
+
*
|
1277
|
+
* We obviously don't want this to happen because it'll interfere with our page
|
1278
|
+
* cache file search code. So here we save the original value of r->filename so
|
1279
|
+
* that we can use it later.
|
1280
|
+
*/
|
1281
|
+
int saveOriginalFilename(request_rec *r) {
|
1282
|
+
apr_table_set(r->notes, "Phusion Passenger: original filename", r->filename);
|
1283
|
+
return DECLINED;
|
1284
|
+
}
|
1285
|
+
|
1286
|
+
int prepareRequestWhenNotInHighPerformanceMode(request_rec *r) {
|
1287
|
+
DirConfig *config = getDirConfig(r);
|
1288
|
+
if (config->isEnabled()) {
|
1289
|
+
if (config->highPerformanceMode()) {
|
1290
|
+
/* Preparations have already been done in the map_to_storage hook.
|
1291
|
+
* Prevent other modules' fixups hooks from being run.
|
1292
|
+
*/
|
1293
|
+
return OK;
|
1294
|
+
} else {
|
1295
|
+
/* core.c's map_to_storage hook will transform the filename, as
|
1296
|
+
* described by saveOriginalFilename(). Here we restore the
|
1297
|
+
* original filename.
|
1298
|
+
*/
|
1299
|
+
const char *filename = apr_table_get(r->notes, "Phusion Passenger: original filename");
|
1300
|
+
if (filename == NULL) {
|
1301
|
+
return DECLINED;
|
1302
|
+
} else {
|
1303
|
+
prepareRequest(r, config, filename);
|
1304
|
+
/* Always return declined in order to let other modules'
|
1305
|
+
* hooks run, regardless of what prepareRequest()'s
|
1306
|
+
* result is.
|
1307
|
+
*/
|
1308
|
+
return DECLINED;
|
1309
|
+
}
|
1310
|
+
}
|
1311
|
+
} else {
|
1312
|
+
return DECLINED;
|
1313
|
+
}
|
1314
|
+
}
|
1315
|
+
|
1316
|
+
/**
|
1317
|
+
* The default .htaccess provided by on Rails on Rails (that is, before version 2.1.0)
|
1318
|
+
* has the following mod_rewrite rules in it:
|
1319
|
+
*
|
1320
|
+
* RewriteEngine on
|
1321
|
+
* RewriteRule ^$ index.html [QSA]
|
1322
|
+
* RewriteRule ^([^.]+)$ $1.html [QSA]
|
1323
|
+
* RewriteCond %{REQUEST_FILENAME} !-f
|
1324
|
+
* RewriteRule ^(.*)$ dispatch.cgi [QSA,L]
|
1325
|
+
*
|
1326
|
+
* As a result, all requests that do not map to a filename will be redirected to
|
1327
|
+
* dispatch.cgi (or dispatch.fcgi, if the user so specified). We don't want that
|
1328
|
+
* to happen, so before mod_rewrite applies its rules, we save the current state.
|
1329
|
+
* After mod_rewrite has applied its rules, undoRedirectionToDispatchCgi() will
|
1330
|
+
* check whether mod_rewrite attempted to perform an internal redirection to
|
1331
|
+
* dispatch.(f)cgi. If so, then it will revert the state to the way it was before
|
1332
|
+
* mod_rewrite took place.
|
1333
|
+
*/
|
1334
|
+
int saveStateBeforeRewriteRules(request_rec *r) {
|
1335
|
+
RequestNote *note = getRequestNote(r);
|
1336
|
+
if (note != 0 && hasModRewrite()) {
|
1337
|
+
note->handlerBeforeModRewrite = r->handler;
|
1338
|
+
note->filenameBeforeModRewrite = r->filename;
|
1339
|
+
}
|
1340
|
+
return DECLINED;
|
1341
|
+
}
|
1342
|
+
|
1343
|
+
int undoRedirectionToDispatchCgi(request_rec *r) {
|
1344
|
+
RequestNote *note = getRequestNote(r);
|
1345
|
+
if (note == 0 || !hasModRewrite()) {
|
1346
|
+
return DECLINED;
|
1347
|
+
}
|
1348
|
+
|
1349
|
+
if (r->handler != NULL && strcmp(r->handler, "redirect-handler") == 0) {
|
1350
|
+
// Check whether r->filename looks like "redirect:.../dispatch.(f)cgi"
|
1351
|
+
size_t len = strlen(r->filename);
|
1352
|
+
// 22 == strlen("redirect:/dispatch.cgi")
|
1353
|
+
if (len >= 22 && memcmp(r->filename, "redirect:", 9) == 0
|
1354
|
+
&& (memcmp(r->filename + len - 13, "/dispatch.cgi", 13) == 0
|
1355
|
+
|| memcmp(r->filename + len - 14, "/dispatch.fcgi", 14) == 0)) {
|
1356
|
+
if (note->filenameBeforeModRewrite != NULL) {
|
1357
|
+
r->filename = note->filenameBeforeModRewrite;
|
1358
|
+
r->canonical_filename = note->filenameBeforeModRewrite;
|
1359
|
+
r->handler = note->handlerBeforeModRewrite;
|
1360
|
+
}
|
1361
|
+
}
|
1362
|
+
}
|
1363
|
+
return DECLINED;
|
1364
|
+
}
|
1365
|
+
|
1366
|
+
/**
|
1367
|
+
* mod_dir does the following:
|
1368
|
+
* If r->filename is a directory, and the URI doesn't end with a slash,
|
1369
|
+
* then it will redirect the browser to an URI with a slash. For example,
|
1370
|
+
* if you go to http://foo.com/images, then it will redirect you to
|
1371
|
+
* http://foo.com/images/.
|
1372
|
+
*
|
1373
|
+
* This behavior is undesired. Suppose that there is an ImagesController,
|
1374
|
+
* and there's also a 'public/images' folder used for storing page cache
|
1375
|
+
* files. Then we don't want mod_dir to perform the redirection.
|
1376
|
+
*
|
1377
|
+
* So in startBlockingModDir(), we temporarily change some fields in the
|
1378
|
+
* request structure in order to block mod_dir. In endBlockingModDir() we
|
1379
|
+
* revert those fields to their old value.
|
1380
|
+
*/
|
1381
|
+
int startBlockingModDir(request_rec *r) {
|
1382
|
+
RequestNote *note = getRequestNote(r);
|
1383
|
+
if (note != 0 && hasModDir()) {
|
1384
|
+
note->oldFileType = r->finfo.filetype;
|
1385
|
+
r->finfo.filetype = APR_NOFILE;
|
1386
|
+
}
|
1387
|
+
return DECLINED;
|
1388
|
+
}
|
1389
|
+
|
1390
|
+
int endBlockingModDir(request_rec *r) {
|
1391
|
+
RequestNote *note = getRequestNote(r);
|
1392
|
+
if (note != 0 && hasModDir()) {
|
1393
|
+
r->finfo.filetype = note->oldFileType;
|
1394
|
+
}
|
1395
|
+
return DECLINED;
|
1396
|
+
}
|
1397
|
+
|
1398
|
+
/**
|
1399
|
+
* mod_autoindex will try to display a directory index for URIs that map to a directory.
|
1400
|
+
* This is undesired because of page caching semantics. Suppose that a Rails application
|
1401
|
+
* has an ImagesController which has page caching enabled, and thus also a 'public/images'
|
1402
|
+
* directory. When the visitor visits /images we'll want the request to be forwarded to
|
1403
|
+
* the Rails application, instead of displaying a directory index.
|
1404
|
+
*
|
1405
|
+
* So in this hook method, we temporarily change some fields in the request structure
|
1406
|
+
* in order to block mod_autoindex. In endBlockingModAutoIndex(), we restore the request
|
1407
|
+
* structure to its former state.
|
1408
|
+
*/
|
1409
|
+
int startBlockingModAutoIndex(request_rec *r) {
|
1410
|
+
RequestNote *note = getRequestNote(r);
|
1411
|
+
if (note != 0 && hasModAutoIndex()) {
|
1412
|
+
note->handlerBeforeModAutoIndex = r->handler;
|
1413
|
+
r->handler = "";
|
1414
|
+
}
|
1415
|
+
return DECLINED;
|
1416
|
+
}
|
1417
|
+
|
1418
|
+
int endBlockingModAutoIndex(request_rec *r) {
|
1419
|
+
RequestNote *note = getRequestNote(r);
|
1420
|
+
if (note != 0 && hasModAutoIndex()) {
|
1421
|
+
r->handler = note->handlerBeforeModAutoIndex;
|
1422
|
+
}
|
1423
|
+
return DECLINED;
|
1424
|
+
}
|
1425
|
+
|
1426
|
+
int handleRequestWhenInHighPerformanceMode(request_rec *r) {
|
1427
|
+
DirConfig *config = getDirConfig(r);
|
1428
|
+
if (config->highPerformanceMode()) {
|
1429
|
+
return handleRequest(r);
|
1430
|
+
} else {
|
1431
|
+
return DECLINED;
|
1432
|
+
}
|
1433
|
+
}
|
1434
|
+
|
1435
|
+
int handleRequestWhenNotInHighPerformanceMode(request_rec *r) {
|
1436
|
+
DirConfig *config = getDirConfig(r);
|
1437
|
+
if (config->highPerformanceMode()) {
|
1438
|
+
return DECLINED;
|
1439
|
+
} else {
|
1440
|
+
return handleRequest(r);
|
1441
|
+
}
|
1442
|
+
}
|
1443
|
+
};
|
1444
|
+
|
1445
|
+
|
1446
|
+
|
1447
|
+
/******************************************************************
|
1448
|
+
* Below follows lightweight C wrappers around the C++ Hook class.
|
1449
|
+
******************************************************************/
|
1450
|
+
|
1451
|
+
/**
|
1452
|
+
* @ingroup Hooks
|
1453
|
+
* @{
|
1454
|
+
*/
|
1455
|
+
|
1456
|
+
static Hooks *hooks = NULL;
|
1457
|
+
|
1458
|
+
static apr_status_t
|
1459
|
+
destroy_hooks(void *arg) {
|
1460
|
+
try {
|
1461
|
+
this_thread::disable_interruption di;
|
1462
|
+
this_thread::disable_syscall_interruption dsi;
|
1463
|
+
P_DEBUG("Shutting down Phusion Passenger...");
|
1464
|
+
delete hooks;
|
1465
|
+
hooks = NULL;
|
1466
|
+
} catch (const thread_interrupted &) {
|
1467
|
+
// Ignore interruptions, we're shutting down anyway.
|
1468
|
+
P_TRACE(3, "A system call was interrupted during shutdown of mod_passenger.");
|
1469
|
+
} catch (const exception &e) {
|
1470
|
+
// Ignore other exceptions, we're shutting down anyway.
|
1471
|
+
P_TRACE(3, "Exception during shutdown of mod_passenger: " << e.what());
|
1472
|
+
}
|
1473
|
+
return APR_SUCCESS;
|
1474
|
+
}
|
1475
|
+
|
1476
|
+
static int
|
1477
|
+
init_module(apr_pool_t *pconf, apr_pool_t *plog, apr_pool_t *ptemp, server_rec *s) {
|
1478
|
+
/*
|
1479
|
+
* HISTORICAL NOTE:
|
1480
|
+
*
|
1481
|
+
* The Apache initialization process has the following properties:
|
1482
|
+
*
|
1483
|
+
* 1. Apache on Unix calls the post_config hook twice, once before detach() and once
|
1484
|
+
* after. On Windows it never calls detach().
|
1485
|
+
* 2. When Apache is compiled to use DSO modules, the modules are unloaded between the
|
1486
|
+
* two post_config hook calls.
|
1487
|
+
* 3. On Unix, if the -X commandline option is given (the 'DEBUG' config is set),
|
1488
|
+
* detach() will not be called.
|
1489
|
+
*
|
1490
|
+
* Because of property #2, the post_config hook is called twice. We initially tried
|
1491
|
+
* to avoid this with all kinds of hacks and workarounds, but none of them are
|
1492
|
+
* universal, i.e. it works for some people but not for others. So we got rid of the
|
1493
|
+
* hacks, and now we always initialize in the post_config hook.
|
1494
|
+
*/
|
1495
|
+
if (hooks != NULL) {
|
1496
|
+
P_DEBUG("Restarting Phusion Passenger....");
|
1497
|
+
delete hooks;
|
1498
|
+
hooks = NULL;
|
1499
|
+
}
|
1500
|
+
try {
|
1501
|
+
hooks = new Hooks(pconf, plog, ptemp, s);
|
1502
|
+
apr_pool_cleanup_register(pconf, NULL,
|
1503
|
+
destroy_hooks,
|
1504
|
+
apr_pool_cleanup_null);
|
1505
|
+
return OK;
|
1506
|
+
|
1507
|
+
} catch (const thread_interrupted &e) {
|
1508
|
+
P_TRACE(2, "A system call was interrupted during mod_passenger "
|
1509
|
+
"initialization. Apache might be restarting or shutting "
|
1510
|
+
"down. Backtrace:\n" << e.backtrace());
|
1511
|
+
return DECLINED;
|
1512
|
+
|
1513
|
+
} catch (const thread_resource_error &e) {
|
1514
|
+
struct rlimit lim;
|
1515
|
+
string pthread_threads_max;
|
1516
|
+
|
1517
|
+
lim.rlim_cur = 0;
|
1518
|
+
lim.rlim_max = 0;
|
1519
|
+
|
1520
|
+
/* Solaris does not define the RLIMIT_NPROC limit. Setting it to infinity... */
|
1521
|
+
#ifdef RLIMIT_NPROC
|
1522
|
+
getrlimit(RLIMIT_NPROC, &lim);
|
1523
|
+
#else
|
1524
|
+
lim.rlim_cur = lim.rlim_max = RLIM_INFINITY;
|
1525
|
+
#endif
|
1526
|
+
|
1527
|
+
#ifdef PTHREAD_THREADS_MAX
|
1528
|
+
pthread_threads_max = toString(PTHREAD_THREADS_MAX);
|
1529
|
+
#else
|
1530
|
+
pthread_threads_max = "unknown";
|
1531
|
+
#endif
|
1532
|
+
|
1533
|
+
ap_log_error(APLOG_MARK, APLOG_ERR, 0, s,
|
1534
|
+
"*** Passenger could not be initialize because a "
|
1535
|
+
"threading resource could not be allocated or initialized. "
|
1536
|
+
"The error message is:");
|
1537
|
+
fprintf(stderr,
|
1538
|
+
" %s\n\n"
|
1539
|
+
"System settings:\n"
|
1540
|
+
" RLIMIT_NPROC: soft = %d, hard = %d\n"
|
1541
|
+
" PTHREAD_THREADS_MAX: %s\n"
|
1542
|
+
"\n",
|
1543
|
+
e.what(),
|
1544
|
+
(int) lim.rlim_cur, (int) lim.rlim_max,
|
1545
|
+
pthread_threads_max.c_str());
|
1546
|
+
|
1547
|
+
fprintf(stderr, "Output of 'uname -a' follows:\n");
|
1548
|
+
fflush(stderr);
|
1549
|
+
system("uname -a >&2");
|
1550
|
+
|
1551
|
+
fprintf(stderr, "\nOutput of 'ulimit -a' follows:\n");
|
1552
|
+
fflush(stderr);
|
1553
|
+
system("ulimit -a >&2");
|
1554
|
+
|
1555
|
+
return DECLINED;
|
1556
|
+
|
1557
|
+
} catch (const exception &e) {
|
1558
|
+
ap_log_error(APLOG_MARK, APLOG_ERR, 0, s,
|
1559
|
+
"*** Passenger could not be initialized because of this error: %s",
|
1560
|
+
e.what());
|
1561
|
+
hooks = NULL;
|
1562
|
+
return DECLINED;
|
1563
|
+
}
|
1564
|
+
}
|
1565
|
+
|
1566
|
+
#define DEFINE_REQUEST_HOOK(c_name, cpp_name) \
|
1567
|
+
static int c_name(request_rec *r) { \
|
1568
|
+
if (OXT_LIKELY(hooks != NULL)) { \
|
1569
|
+
return hooks->cpp_name(r); \
|
1570
|
+
} else { \
|
1571
|
+
return DECLINED; \
|
1572
|
+
} \
|
1573
|
+
}
|
1574
|
+
|
1575
|
+
DEFINE_REQUEST_HOOK(prepare_request_when_in_high_performance_mode, prepareRequestWhenInHighPerformanceMode)
|
1576
|
+
DEFINE_REQUEST_HOOK(save_original_filename, saveOriginalFilename)
|
1577
|
+
DEFINE_REQUEST_HOOK(prepare_request_when_not_in_high_performance_mode, prepareRequestWhenNotInHighPerformanceMode)
|
1578
|
+
DEFINE_REQUEST_HOOK(save_state_before_rewrite_rules, saveStateBeforeRewriteRules)
|
1579
|
+
DEFINE_REQUEST_HOOK(undo_redirection_to_dispatch_cgi, undoRedirectionToDispatchCgi)
|
1580
|
+
DEFINE_REQUEST_HOOK(start_blocking_mod_dir, startBlockingModDir)
|
1581
|
+
DEFINE_REQUEST_HOOK(end_blocking_mod_dir, endBlockingModDir)
|
1582
|
+
DEFINE_REQUEST_HOOK(start_blocking_mod_autoindex, startBlockingModAutoIndex)
|
1583
|
+
DEFINE_REQUEST_HOOK(end_blocking_mod_autoindex, endBlockingModAutoIndex)
|
1584
|
+
DEFINE_REQUEST_HOOK(handle_request_when_in_high_performance_mode, handleRequestWhenInHighPerformanceMode)
|
1585
|
+
DEFINE_REQUEST_HOOK(handle_request_when_not_in_high_performance_mode, handleRequestWhenNotInHighPerformanceMode)
|
1586
|
+
|
1587
|
+
|
1588
|
+
/**
|
1589
|
+
* Apache hook registration function.
|
1590
|
+
*/
|
1591
|
+
void
|
1592
|
+
passenger_register_hooks(apr_pool_t *p) {
|
1593
|
+
static const char * const rewrite_module[] = { "mod_rewrite.c", NULL };
|
1594
|
+
static const char * const dir_module[] = { "mod_dir.c", NULL };
|
1595
|
+
static const char * const autoindex_module[] = { "mod_autoindex.c", NULL };
|
1596
|
+
|
1597
|
+
ap_hook_post_config(init_module, NULL, NULL, APR_HOOK_MIDDLE);
|
1598
|
+
|
1599
|
+
ap_hook_map_to_storage(prepare_request_when_in_high_performance_mode, NULL, NULL, APR_HOOK_FIRST);
|
1600
|
+
ap_hook_map_to_storage(save_original_filename, NULL, NULL, APR_HOOK_LAST);
|
1601
|
+
|
1602
|
+
ap_hook_fixups(prepare_request_when_not_in_high_performance_mode, NULL, rewrite_module, APR_HOOK_FIRST);
|
1603
|
+
ap_hook_fixups(save_state_before_rewrite_rules, NULL, rewrite_module, APR_HOOK_LAST);
|
1604
|
+
ap_hook_fixups(undo_redirection_to_dispatch_cgi, rewrite_module, NULL, APR_HOOK_FIRST);
|
1605
|
+
ap_hook_fixups(start_blocking_mod_dir, NULL, dir_module, APR_HOOK_MIDDLE);
|
1606
|
+
ap_hook_fixups(end_blocking_mod_dir, dir_module, NULL, APR_HOOK_MIDDLE);
|
1607
|
+
|
1608
|
+
ap_hook_handler(handle_request_when_in_high_performance_mode, NULL, NULL, APR_HOOK_FIRST);
|
1609
|
+
ap_hook_handler(start_blocking_mod_autoindex, NULL, autoindex_module, APR_HOOK_LAST);
|
1610
|
+
ap_hook_handler(end_blocking_mod_autoindex, autoindex_module, NULL, APR_HOOK_FIRST);
|
1611
|
+
ap_hook_handler(handle_request_when_not_in_high_performance_mode, NULL, NULL, APR_HOOK_LAST);
|
1612
|
+
}
|
1613
|
+
|
1614
|
+
/**
|
1615
|
+
* @}
|
1616
|
+
*/
|
1617
|
+
|