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