passenger 2.1.3 → 2.2.0
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of passenger might be problematic. Click here for more details.
- data/DEVELOPERS.TXT +2 -0
- data/INSTALL +3 -1
- data/LICENSE +19 -355
- data/NEWS +3 -0
- data/README +11 -4
- data/Rakefile +435 -236
- data/bin/passenger-config +20 -14
- data/bin/passenger-install-apache2-module +67 -201
- data/bin/passenger-install-nginx-module +477 -0
- data/bin/passenger-make-enterprisey +17 -12
- data/bin/passenger-memory-stats +33 -23
- data/bin/passenger-spawn-server +17 -12
- data/bin/passenger-status +18 -13
- data/bin/passenger-stress-test +17 -12
- data/doc/{Users guide.html → Users guide Apache.html } +79 -61
- data/doc/{Users guide.txt → Users guide Apache.txt } +43 -939
- data/doc/Users guide Nginx.html +2276 -0
- data/doc/Users guide Nginx.txt +776 -0
- data/doc/cxxapi/ApplicationPoolServer_8h-source.html +9 -4
- data/doc/cxxapi/ApplicationPool_8h-source.html +9 -4
- data/doc/cxxapi/Application_8h-source.html +26 -21
- data/doc/cxxapi/Bucket_8h-source.html +54 -44
- data/doc/cxxapi/CachedFileStat_8h-source.html +9 -4
- data/doc/cxxapi/Configuration_8h-source.html +357 -339
- data/doc/cxxapi/DirectoryMapper_8h-source.html +294 -280
- data/doc/cxxapi/DummySpawnManager_8h-source.html +9 -4
- data/doc/cxxapi/Exceptions_8h-source.html +9 -4
- data/doc/cxxapi/FileChecker_8h-source.html +9 -4
- data/doc/cxxapi/Hooks_8h-source.html +50 -40
- data/doc/cxxapi/Logging_8h-source.html +9 -4
- data/doc/cxxapi/MessageChannel_8h-source.html +20 -15
- data/doc/cxxapi/PoolOptions_8h-source.html +10 -5
- data/doc/cxxapi/SpawnManager_8h-source.html +9 -4
- data/doc/cxxapi/StandardApplicationPool_8h-source.html +10 -5
- data/doc/cxxapi/SystemTime_8h-source.html +9 -4
- data/doc/cxxapi/Utils_8h-source.html +242 -214
- data/doc/cxxapi/annotated.html +4 -28
- data/doc/cxxapi/classClient-members.html +4 -4
- data/doc/cxxapi/classClient.html +14 -11
- data/doc/cxxapi/classHooks-members.html +4 -5
- data/doc/cxxapi/classHooks.html +26 -24
- data/doc/cxxapi/classPassenger_1_1Application-members.html +4 -4
- data/doc/cxxapi/classPassenger_1_1Application.html +40 -37
- data/doc/cxxapi/classPassenger_1_1ApplicationPool-members.html +4 -4
- data/doc/cxxapi/classPassenger_1_1ApplicationPool.html +95 -92
- data/doc/cxxapi/classPassenger_1_1ApplicationPoolServer-members.html +4 -4
- data/doc/cxxapi/classPassenger_1_1ApplicationPoolServer.html +26 -23
- data/doc/cxxapi/classPassenger_1_1ApplicationPool__inherit__graph.map +1 -1
- data/doc/cxxapi/classPassenger_1_1ApplicationPool__inherit__graph.md5 +1 -1
- data/doc/cxxapi/classPassenger_1_1ApplicationPool__inherit__graph.png +0 -0
- data/doc/cxxapi/classPassenger_1_1Application_1_1Session-members.html +17 -17
- data/doc/cxxapi/classPassenger_1_1Application_1_1Session.html +139 -136
- data/doc/cxxapi/classPassenger_1_1BufferedUpload-members.html +4 -4
- data/doc/cxxapi/classPassenger_1_1BufferedUpload.html +13 -10
- data/doc/cxxapi/classPassenger_1_1BusyException-members.html +4 -4
- data/doc/cxxapi/classPassenger_1_1BusyException.html +11 -8
- data/doc/cxxapi/classPassenger_1_1ConfigurationException-members.html +4 -4
- data/doc/cxxapi/classPassenger_1_1ConfigurationException.html +11 -8
- data/doc/cxxapi/classPassenger_1_1DirectoryMapper-members.html +4 -5
- data/doc/cxxapi/classPassenger_1_1DirectoryMapper.html +45 -43
- data/doc/cxxapi/classPassenger_1_1DummySpawnManager-members.html +4 -4
- data/doc/cxxapi/classPassenger_1_1DummySpawnManager.html +13 -10
- data/doc/cxxapi/classPassenger_1_1FileChecker-members.html +4 -4
- data/doc/cxxapi/classPassenger_1_1FileChecker.html +22 -19
- data/doc/cxxapi/classPassenger_1_1FileNotFoundException-members.html +4 -4
- data/doc/cxxapi/classPassenger_1_1FileNotFoundException.html +12 -9
- data/doc/cxxapi/classPassenger_1_1FileNotFoundException__inherit__graph.map +1 -1
- data/doc/cxxapi/classPassenger_1_1FileNotFoundException__inherit__graph.md5 +1 -1
- data/doc/cxxapi/classPassenger_1_1FileNotFoundException__inherit__graph.png +0 -0
- data/doc/cxxapi/classPassenger_1_1FileSystemException-members.html +4 -4
- data/doc/cxxapi/classPassenger_1_1FileSystemException.html +14 -11
- data/doc/cxxapi/classPassenger_1_1FileSystemException__inherit__graph.map +1 -1
- data/doc/cxxapi/classPassenger_1_1FileSystemException__inherit__graph.md5 +1 -1
- data/doc/cxxapi/classPassenger_1_1FileSystemException__inherit__graph.png +0 -0
- data/doc/cxxapi/classPassenger_1_1IOException-members.html +4 -4
- data/doc/cxxapi/classPassenger_1_1IOException.html +12 -9
- data/doc/cxxapi/classPassenger_1_1IOException__inherit__graph.map +1 -1
- data/doc/cxxapi/classPassenger_1_1IOException__inherit__graph.md5 +1 -1
- data/doc/cxxapi/classPassenger_1_1IOException__inherit__graph.png +0 -0
- data/doc/cxxapi/classPassenger_1_1MessageChannel-members.html +4 -4
- data/doc/cxxapi/classPassenger_1_1MessageChannel.html +228 -225
- data/doc/cxxapi/classPassenger_1_1RuntimeException-members.html +4 -4
- data/doc/cxxapi/classPassenger_1_1RuntimeException.html +11 -8
- data/doc/cxxapi/classPassenger_1_1SpawnException-members.html +4 -4
- data/doc/cxxapi/classPassenger_1_1SpawnException.html +14 -11
- data/doc/cxxapi/classPassenger_1_1SpawnManager-members.html +4 -4
- data/doc/cxxapi/classPassenger_1_1SpawnManager.html +50 -47
- data/doc/cxxapi/classPassenger_1_1StandardApplicationPool-members.html +4 -4
- data/doc/cxxapi/classPassenger_1_1StandardApplicationPool.html +73 -70
- data/doc/cxxapi/classPassenger_1_1StandardApplicationPool__inherit__graph.map +1 -1
- data/doc/cxxapi/classPassenger_1_1StandardApplicationPool__inherit__graph.md5 +1 -1
- data/doc/cxxapi/classPassenger_1_1StandardApplicationPool__inherit__graph.png +0 -0
- data/doc/cxxapi/classPassenger_1_1SystemException-members.html +4 -4
- data/doc/cxxapi/classPassenger_1_1SystemException.html +17 -14
- data/doc/cxxapi/classPassenger_1_1SystemException__inherit__graph.map +1 -1
- data/doc/cxxapi/classPassenger_1_1SystemException__inherit__graph.md5 +1 -1
- data/doc/cxxapi/classPassenger_1_1SystemException__inherit__graph.png +0 -0
- data/doc/cxxapi/classPassenger_1_1SystemTime-members.html +4 -4
- data/doc/cxxapi/classPassenger_1_1SystemTime.html +14 -11
- data/doc/cxxapi/classes.html +35 -0
- data/doc/cxxapi/definitions_8h-source.html +9 -4
- data/doc/cxxapi/doxygen.css +311 -303
- data/doc/cxxapi/files.html +9 -18
- data/doc/cxxapi/functions.html +5 -224
- data/doc/cxxapi/functions_func.html +5 -185
- data/doc/cxxapi/functions_type.html +4 -4
- data/doc/cxxapi/functions_vars.html +4 -4
- data/doc/cxxapi/graph_legend.dot +19 -19
- data/doc/cxxapi/graph_legend.html +5 -5
- data/doc/cxxapi/graph_legend.png +0 -0
- data/doc/cxxapi/group__Configuration.html +11 -13
- data/doc/cxxapi/group__Configuration.png +0 -0
- data/doc/cxxapi/group__Core.html +10 -12
- data/doc/cxxapi/group__Core.png +0 -0
- data/doc/cxxapi/group__Exceptions.html +5 -7
- data/doc/cxxapi/group__Hooks.html +5 -7
- data/doc/cxxapi/group__Hooks.png +0 -0
- data/doc/cxxapi/group__Support.html +5 -624
- data/doc/cxxapi/hierarchy.html +6 -6
- data/doc/cxxapi/inherit__graph__0.map +1 -1
- data/doc/cxxapi/inherit__graph__0.md5 +1 -1
- data/doc/cxxapi/inherit__graph__0.png +0 -0
- data/doc/cxxapi/inherit__graph__1.map +1 -1
- data/doc/cxxapi/inherit__graph__1.md5 +1 -1
- data/doc/cxxapi/inherit__graph__1.png +0 -0
- data/doc/cxxapi/inherit__graph__10.map +1 -1
- data/doc/cxxapi/inherit__graph__10.md5 +1 -1
- data/doc/cxxapi/inherit__graph__10.png +0 -0
- data/doc/cxxapi/inherit__graph__11.map +1 -1
- data/doc/cxxapi/inherit__graph__11.md5 +1 -1
- data/doc/cxxapi/inherit__graph__11.png +0 -0
- data/doc/cxxapi/inherit__graph__12.map +1 -1
- data/doc/cxxapi/inherit__graph__12.md5 +1 -1
- data/doc/cxxapi/inherit__graph__12.png +0 -0
- data/doc/cxxapi/inherit__graph__13.map +1 -2
- data/doc/cxxapi/inherit__graph__13.md5 +1 -1
- data/doc/cxxapi/inherit__graph__13.png +0 -0
- data/doc/cxxapi/inherit__graph__14.map +2 -1
- data/doc/cxxapi/inherit__graph__14.md5 +1 -1
- data/doc/cxxapi/inherit__graph__14.png +0 -0
- data/doc/cxxapi/inherit__graph__15.map +1 -1
- data/doc/cxxapi/inherit__graph__15.md5 +1 -1
- data/doc/cxxapi/inherit__graph__15.png +0 -0
- data/doc/cxxapi/inherit__graph__16.map +1 -1
- data/doc/cxxapi/inherit__graph__16.md5 +1 -1
- data/doc/cxxapi/inherit__graph__16.png +0 -0
- data/doc/cxxapi/inherit__graph__17.map +1 -1
- data/doc/cxxapi/inherit__graph__17.md5 +1 -1
- data/doc/cxxapi/inherit__graph__17.png +0 -0
- data/doc/cxxapi/inherit__graph__18.map +1 -1
- data/doc/cxxapi/inherit__graph__18.md5 +1 -1
- data/doc/cxxapi/inherit__graph__18.png +0 -0
- data/doc/cxxapi/inherit__graph__19.map +1 -1
- data/doc/cxxapi/inherit__graph__19.md5 +1 -1
- data/doc/cxxapi/inherit__graph__19.png +0 -0
- data/doc/cxxapi/inherit__graph__2.map +1 -1
- data/doc/cxxapi/inherit__graph__2.md5 +1 -1
- data/doc/cxxapi/inherit__graph__2.png +0 -0
- data/doc/cxxapi/inherit__graph__20.map +2 -2
- data/doc/cxxapi/inherit__graph__20.md5 +1 -1
- data/doc/cxxapi/inherit__graph__20.png +0 -0
- data/doc/cxxapi/inherit__graph__21.map +1 -1
- data/doc/cxxapi/inherit__graph__21.md5 +1 -1
- data/doc/cxxapi/inherit__graph__21.png +0 -0
- data/doc/cxxapi/inherit__graph__3.map +1 -1
- data/doc/cxxapi/inherit__graph__3.md5 +1 -1
- data/doc/cxxapi/inherit__graph__3.png +0 -0
- data/doc/cxxapi/inherit__graph__4.map +1 -1
- data/doc/cxxapi/inherit__graph__4.md5 +1 -1
- data/doc/cxxapi/inherit__graph__4.png +0 -0
- data/doc/cxxapi/inherit__graph__5.map +1 -2
- data/doc/cxxapi/inherit__graph__5.md5 +1 -1
- data/doc/cxxapi/inherit__graph__5.png +0 -0
- data/doc/cxxapi/inherit__graph__6.map +2 -1
- data/doc/cxxapi/inherit__graph__6.md5 +1 -1
- data/doc/cxxapi/inherit__graph__6.png +0 -0
- data/doc/cxxapi/inherit__graph__7.map +1 -1
- data/doc/cxxapi/inherit__graph__7.md5 +1 -1
- data/doc/cxxapi/inherit__graph__7.png +0 -0
- data/doc/cxxapi/inherit__graph__8.map +1 -1
- data/doc/cxxapi/inherit__graph__8.md5 +1 -1
- data/doc/cxxapi/inherit__graph__8.png +0 -0
- data/doc/cxxapi/inherit__graph__9.map +1 -1
- data/doc/cxxapi/inherit__graph__9.md5 +1 -1
- data/doc/cxxapi/inherit__graph__9.png +0 -0
- data/doc/cxxapi/inherits.html +41 -41
- data/doc/cxxapi/main.html +4 -4
- data/doc/cxxapi/modules.html +4 -5
- data/doc/cxxapi/structPassenger_1_1AnythingToString-members.html +4 -4
- data/doc/cxxapi/structPassenger_1_1AnythingToString.html +13 -10
- data/doc/cxxapi/structPassenger_1_1AnythingToString_3_01vector_3_01string_01_4_01_4-members.html +5 -5
- data/doc/cxxapi/structPassenger_1_1AnythingToString_3_01vector_3_01string_01_4_01_4.html +16 -13
- data/doc/cxxapi/structPassenger_1_1PoolOptions-members.html +4 -4
- data/doc/cxxapi/structPassenger_1_1PoolOptions.html +63 -60
- data/doc/cxxapi/tabs.css +5 -2
- data/doc/cxxapi/tree.html +7 -81
- data/doc/rdoc/classes/ConditionVariable.html +59 -59
- data/doc/rdoc/classes/Exception.html +11 -11
- data/doc/rdoc/classes/GC.html +4 -4
- data/doc/rdoc/classes/IO.html +14 -14
- data/doc/rdoc/classes/PhusionPassenger.html +75 -20
- data/doc/rdoc/classes/PhusionPassenger/AbstractInstaller.html +153 -0
- data/doc/rdoc/classes/PhusionPassenger/AbstractRequestHandler.html +125 -130
- data/doc/rdoc/classes/PhusionPassenger/AbstractServer.html +236 -236
- data/doc/rdoc/classes/PhusionPassenger/AbstractServerCollection.html +213 -213
- data/doc/rdoc/classes/PhusionPassenger/AdminTools.html +28 -28
- data/doc/rdoc/classes/PhusionPassenger/AdminTools/ControlProcess.html +91 -75
- data/doc/rdoc/classes/PhusionPassenger/AppInitError.html +10 -10
- data/doc/rdoc/classes/PhusionPassenger/Application.html +64 -64
- data/doc/rdoc/classes/PhusionPassenger/ConsoleTextTemplate.html +34 -34
- data/doc/rdoc/classes/PhusionPassenger/FrameworkInitError.html +13 -13
- data/doc/rdoc/classes/PhusionPassenger/HTMLTemplate.html +30 -30
- data/doc/rdoc/classes/PhusionPassenger/InitializationError.html +10 -10
- data/doc/rdoc/classes/PhusionPassenger/MessageChannel.html +136 -136
- data/doc/rdoc/classes/PhusionPassenger/NativeSupport.html +24 -24
- data/doc/rdoc/classes/PhusionPassenger/Rack/ApplicationSpawner.html +42 -42
- data/doc/rdoc/classes/PhusionPassenger/Rack/RequestHandler.html +55 -53
- data/doc/rdoc/classes/PhusionPassenger/Railz.html +1 -1
- data/doc/rdoc/classes/PhusionPassenger/Railz/ApplicationSpawner.html +25 -30
- data/doc/rdoc/classes/PhusionPassenger/Railz/CGIFixed.html +23 -23
- data/doc/rdoc/classes/PhusionPassenger/Railz/FrameworkSpawner.html +116 -117
- data/doc/rdoc/classes/PhusionPassenger/Railz/RequestHandler.html +22 -22
- data/doc/rdoc/classes/PhusionPassenger/SpawnManager.html +118 -124
- data/doc/rdoc/classes/PhusionPassenger/UnknownError.html +10 -10
- data/doc/rdoc/classes/PhusionPassenger/Utils.html +354 -354
- data/doc/rdoc/classes/PhusionPassenger/VersionNotFound.html +9 -9
- data/doc/rdoc/classes/PhusionPassenger/WSGI/ApplicationSpawner.html +37 -37
- data/doc/rdoc/classes/PlatformInfo.html +282 -261
- data/doc/rdoc/classes/RakeExtensions.html +7 -7
- data/doc/rdoc/classes/Signal.html +26 -26
- data/doc/rdoc/created.rid +1 -1
- data/doc/rdoc/files/DEVELOPERS_TXT.html +6 -1
- data/doc/rdoc/files/README.html +15 -6
- data/doc/rdoc/files/ext/phusion_passenger/native_support_c.html +1 -1
- 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 +20 -13
- data/doc/rdoc/files/lib/phusion_passenger/abstract_server_collection_rb.html +19 -13
- data/doc/rdoc/files/lib/phusion_passenger/abstract_server_rb.html +19 -13
- data/doc/rdoc/files/lib/phusion_passenger/admin_tools/control_process_rb.html +31 -1
- data/doc/rdoc/files/lib/phusion_passenger/admin_tools_rb.html +31 -1
- data/doc/rdoc/files/lib/phusion_passenger/application_rb.html +19 -13
- data/doc/rdoc/files/lib/phusion_passenger/console_text_template_rb.html +19 -13
- data/doc/rdoc/files/lib/phusion_passenger/constants_rb.html +21 -12
- data/doc/rdoc/files/lib/phusion_passenger/dependencies_rb.html +19 -13
- data/doc/rdoc/files/lib/phusion_passenger/events_rb.html +19 -13
- data/doc/rdoc/files/lib/phusion_passenger/exceptions_rb.html +19 -13
- data/doc/rdoc/files/lib/phusion_passenger/html_template_rb.html +19 -13
- data/doc/rdoc/files/lib/phusion_passenger/message_channel_rb.html +19 -13
- data/doc/rdoc/files/lib/phusion_passenger/packaging_rb.html +122 -0
- data/doc/rdoc/files/lib/phusion_passenger/platform_info_rb.html +19 -13
- data/doc/rdoc/files/lib/phusion_passenger/rack/application_spawner_rb.html +22 -12
- data/doc/rdoc/files/lib/phusion_passenger/rack/request_handler_rb.html +21 -12
- data/doc/rdoc/files/lib/phusion_passenger/railz/application_spawner_rb.html +19 -13
- data/doc/rdoc/files/lib/phusion_passenger/railz/cgi_fixed_rb.html +1 -1
- data/doc/rdoc/files/lib/phusion_passenger/railz/framework_spawner_rb.html +19 -13
- data/doc/rdoc/files/lib/phusion_passenger/railz/request_handler_rb.html +21 -12
- data/doc/rdoc/files/lib/phusion_passenger/simple_benchmarking_rb.html +19 -13
- data/doc/rdoc/files/lib/phusion_passenger/spawn_manager_rb.html +19 -13
- data/doc/rdoc/files/lib/phusion_passenger/utils_rb.html +27 -21
- data/doc/rdoc/files/lib/phusion_passenger/wsgi/application_spawner_rb.html +21 -12
- data/doc/rdoc/files/misc/rake/extensions_rb.html +21 -12
- data/doc/rdoc/fr_class_index.html +1 -0
- data/doc/rdoc/fr_file_index.html +2 -0
- data/doc/rdoc/fr_method_index.html +116 -112
- 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 +75 -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 +17 -12
- data/ext/apache2/Bucket.h +17 -12
- data/ext/apache2/Configuration.cpp +17 -12
- data/ext/apache2/Configuration.h +27 -14
- data/ext/apache2/DirectoryMapper.h +21 -12
- data/ext/apache2/Hooks.cpp +67 -21
- data/ext/apache2/Hooks.h +17 -12
- data/ext/apache2/mod_passenger.c +17 -12
- data/ext/{apache2 → common}/Application.h +19 -14
- data/ext/{apache2 → common}/ApplicationPool.h +17 -12
- data/ext/{apache2 → common}/ApplicationPoolServer.h +18 -72
- data/ext/{apache2 → common}/ApplicationPoolServerExecutable.cpp +45 -104
- data/ext/common/ApplicationPoolStatusReporter.h +212 -0
- data/ext/{apache2 → common}/CachedFileStat.cpp +17 -12
- data/ext/{apache2 → common}/CachedFileStat.h +17 -12
- data/ext/{apache2 → common}/DummySpawnManager.h +17 -12
- data/ext/{apache2 → common}/Exceptions.h +17 -12
- data/ext/{apache2 → common}/FileChecker.h +17 -12
- data/ext/common/Logging.cpp +65 -0
- data/ext/{apache2 → common}/Logging.h +17 -12
- data/ext/{apache2 → common}/MessageChannel.h +17 -12
- data/ext/{apache2 → common}/PoolOptions.h +17 -12
- data/ext/{apache2 → common}/SpawnManager.h +17 -12
- data/ext/{apache2 → common}/StandardApplicationPool.h +17 -12
- data/ext/common/StaticString.h +147 -0
- data/ext/common/SystemTime.cpp +33 -0
- data/ext/{apache2 → common}/SystemTime.h +17 -12
- data/ext/{apache2 → common}/Utils.cpp +69 -12
- data/ext/{apache2 → common}/Utils.h +41 -12
- data/ext/nginx/Configuration.c +1091 -0
- data/ext/nginx/Configuration.h +71 -0
- data/ext/nginx/ContentHandler.c +1154 -0
- data/ext/nginx/ContentHandler.h +64 -0
- data/ext/nginx/HelperServer.cpp +857 -0
- data/ext/nginx/HttpStatusExtractor.h +161 -0
- data/ext/nginx/ScgiRequestParser.h +317 -0
- data/ext/nginx/StaticContentHandler.c +222 -0
- data/ext/nginx/StaticContentHandler.h +37 -0
- data/ext/nginx/config +41 -0
- data/ext/nginx/ngx_http_passenger_module.c +572 -0
- data/ext/nginx/ngx_http_passenger_module.h +72 -0
- data/ext/oxt/backtrace.cpp +8 -1
- data/ext/oxt/system_calls.cpp +40 -0
- data/ext/oxt/system_calls.hpp +14 -7
- data/ext/phusion_passenger/extconf.rb +17 -12
- data/ext/phusion_passenger/native_support.c +19 -12
- data/lib/phusion_passenger/abstract_installer.rb +196 -0
- data/lib/phusion_passenger/abstract_request_handler.rb +19 -24
- data/lib/phusion_passenger/abstract_server.rb +17 -12
- data/lib/phusion_passenger/abstract_server_collection.rb +17 -12
- data/lib/phusion_passenger/admin_tools.rb +23 -0
- data/lib/phusion_passenger/admin_tools/control_process.rb +39 -13
- data/lib/phusion_passenger/application.rb +17 -12
- data/lib/phusion_passenger/console_text_template.rb +17 -12
- data/lib/phusion_passenger/constants.rb +22 -11
- data/lib/phusion_passenger/dependencies.rb +47 -12
- data/lib/phusion_passenger/events.rb +17 -12
- data/lib/phusion_passenger/exceptions.rb +17 -12
- data/lib/phusion_passenger/html_template.rb +17 -12
- data/lib/phusion_passenger/message_channel.rb +17 -12
- data/lib/phusion_passenger/packaging.rb +39 -0
- data/lib/phusion_passenger/platform_info.rb +48 -22
- data/lib/phusion_passenger/rack/application_spawner.rb +22 -11
- data/lib/phusion_passenger/rack/request_handler.rb +21 -12
- data/lib/phusion_passenger/railz/application_spawner.rb +23 -23
- data/lib/phusion_passenger/railz/framework_spawner.rb +18 -14
- data/lib/phusion_passenger/railz/request_handler.rb +18 -11
- data/lib/phusion_passenger/simple_benchmarking.rb +17 -12
- data/lib/phusion_passenger/spawn_manager.rb +17 -20
- data/lib/phusion_passenger/templates/{apache_must_be_compiled_with_compatible_mpm.txt.erb → apache2/apache_must_be_compiled_with_compatible_mpm.txt.erb} +0 -0
- data/lib/phusion_passenger/templates/{apache2_config_snippets.txt.erb → apache2/config_snippets.txt.erb} +0 -0
- data/lib/phusion_passenger/templates/{deployment_example.txt.erb → apache2/deployment_example.txt.erb} +0 -0
- data/lib/phusion_passenger/templates/{no_write_permission_to_passenger_root.txt.erb → apache2/no_write_permission_to_passenger_root.txt.erb} +0 -0
- data/lib/phusion_passenger/templates/{possible_solutions_for_compilation_and_installation_problems.txt.erb → apache2/possible_solutions_for_compilation_and_installation_problems.txt.erb} +0 -0
- data/lib/phusion_passenger/templates/{run_installer_as_root.txt.erb → apache2/run_installer_as_root.txt.erb} +0 -0
- data/lib/phusion_passenger/templates/{welcome.txt.erb → apache2/welcome.txt.erb} +0 -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/utils.rb +20 -15
- data/lib/phusion_passenger/wsgi/application_spawner.rb +18 -11
- data/lib/phusion_passenger/wsgi/request_handler.py +23 -0
- data/misc/copy_boost_headers.rb +23 -0
- data/misc/find_owner_pipe_leaks.rb +18 -11
- data/misc/rake/cplusplus.rb +18 -11
- data/misc/rake/extensions.rb +21 -14
- data/misc/render_error_pages.rb +18 -11
- data/test/ApplicationPoolServerTest.cpp +1 -3
- data/test/ApplicationPoolServer_ApplicationPoolTest.cpp +1 -1
- data/test/CxxTestMain.cpp +19 -3
- data/test/HttpStatusExtractorTest.cpp +181 -0
- data/test/ScgiRequestParserTest.cpp +337 -0
- data/test/StaticStringTest.cpp +51 -0
- data/test/UtilsTest.cpp +32 -0
- data/test/config.yml.example +5 -0
- data/test/{integration_tests.rb → integration_tests/apache2_tests.rb} +7 -299
- 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 +98 -0
- data/test/ruby/rack/application_spawner_spec.rb +40 -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/rails_apps/mycook/app/controllers/uploads_controller.rb +4 -0
- data/test/stub/rails_apps/mycook/config/routes.rb +1 -1
- data/test/stub/wsgi/passenger_wsgi.pyc +0 -0
- data/test/support/Support.h +40 -0
- data/test/support/nginx_controller.rb +98 -0
- data/test/support/test_helper.rb +79 -0
- metadata +1091 -1028
- data/benchmark/DummyRequestHandler.cpp +0 -101
- data/ext/apache2/Logging.cpp +0 -60
- data/ext/apache2/SystemTime.cpp +0 -28
@@ -85,9 +85,9 @@ fascade for the rest of the spawn manager system.
|
|
85
85
|
<p>
|
86
86
|
<b>Note</b>: <a href="SpawnManager.html">SpawnManager</a> may only be
|
87
87
|
started synchronously with <a
|
88
|
-
href="AbstractServer.html#
|
88
|
+
href="AbstractServer.html#M000127">AbstractServer#start_synchronously</a>.
|
89
89
|
Starting asynchronously has not been tested. Don‘t forget to call <a
|
90
|
-
href="SpawnManager.html#
|
90
|
+
href="SpawnManager.html#M000115">cleanup</a> after the server‘s main
|
91
91
|
loop has finished.
|
92
92
|
</p>
|
93
93
|
<h2>Ruby on Rails optimizations</h2>
|
@@ -116,10 +116,10 @@ work around an obscure bug in ActiveSupport‘s Dispatcher.
|
|
116
116
|
|
117
117
|
<div class="sectiontitle">Methods</div>
|
118
118
|
<ul>
|
119
|
-
<li><a href="#
|
120
|
-
<li><a href="#
|
121
|
-
<li><a href="#
|
122
|
-
<li><a href="#
|
119
|
+
<li><a href="#M000115">cleanup</a></li>
|
120
|
+
<li><a href="#M000112">new</a></li>
|
121
|
+
<li><a href="#M000114">reload</a></li>
|
122
|
+
<li><a href="#M000113">spawn_application</a></li>
|
123
123
|
</ul>
|
124
124
|
|
125
125
|
<div class="sectiontitle">Included Modules</div>
|
@@ -134,45 +134,45 @@ work around an obscure bug in ActiveSupport‘s Dispatcher.
|
|
134
134
|
<div class="sectiontitle">Public Class methods</div>
|
135
135
|
<div class="method">
|
136
136
|
<div class="title">
|
137
|
-
<a name="
|
137
|
+
<a name="M000112"></a><b>new</b>()
|
138
138
|
</div>
|
139
139
|
<div class="sourcecode">
|
140
|
-
<p class="source-link">[ <a href="javascript:toggleSource('
|
141
|
-
<div id="
|
140
|
+
<p class="source-link">[ <a href="javascript:toggleSource('M000112_source')" id="l_M000112_source">show source</a> ]</p>
|
141
|
+
<div id="M000112_source" class="dyn-source">
|
142
142
|
<pre>
|
143
|
-
<span class="ruby-comment cmt"># File lib/phusion_passenger/spawn_manager.rb, line
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
|
143
|
+
<span class="ruby-comment cmt"># File lib/phusion_passenger/spawn_manager.rb, line 60</span>
|
144
|
+
60: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">initialize</span>
|
145
|
+
61: <span class="ruby-keyword kw">super</span>()
|
146
|
+
62: <span class="ruby-ivar">@spawners</span> = <span class="ruby-constant">AbstractServerCollection</span>.<span class="ruby-identifier">new</span>
|
147
|
+
63: <span class="ruby-identifier">define_message_handler</span>(<span class="ruby-identifier">:spawn_application</span>, <span class="ruby-identifier">:handle_spawn_application</span>)
|
148
|
+
64: <span class="ruby-identifier">define_message_handler</span>(<span class="ruby-identifier">:reload</span>, <span class="ruby-identifier">:handle_reload</span>)
|
149
|
+
65: <span class="ruby-identifier">define_signal_handler</span>(<span class="ruby-value str">'SIGHUP'</span>, <span class="ruby-identifier">:reload</span>)
|
150
|
+
66:
|
151
|
+
67: <span class="ruby-comment cmt"># Start garbage collector in order to free up some existing</span>
|
152
|
+
68: <span class="ruby-comment cmt"># heap slots. This prevents the heap from growing unnecessarily</span>
|
153
|
+
69: <span class="ruby-comment cmt"># during the startup phase.</span>
|
154
|
+
70: <span class="ruby-constant">GC</span>.<span class="ruby-identifier">start</span>
|
155
|
+
71: <span class="ruby-keyword kw">if</span> <span class="ruby-constant">GC</span>.<span class="ruby-identifier">copy_on_write_friendly?</span>
|
156
|
+
72: <span class="ruby-comment cmt"># Preload libraries for copy-on-write semantics.</span>
|
157
|
+
73: <span class="ruby-identifier">require</span> <span class="ruby-value str">'base64'</span>
|
158
|
+
74: <span class="ruby-identifier">require</span> <span class="ruby-value str">'phusion_passenger/application'</span>
|
159
|
+
75: <span class="ruby-identifier">require</span> <span class="ruby-value str">'phusion_passenger/railz/framework_spawner'</span>
|
160
|
+
76: <span class="ruby-identifier">require</span> <span class="ruby-value str">'phusion_passenger/railz/application_spawner'</span>
|
161
|
+
77: <span class="ruby-identifier">require</span> <span class="ruby-value str">'phusion_passenger/rack/application_spawner'</span>
|
162
|
+
78: <span class="ruby-identifier">require</span> <span class="ruby-value str">'phusion_passenger/html_template'</span>
|
163
|
+
79: <span class="ruby-identifier">require</span> <span class="ruby-value str">'phusion_passenger/platform_info'</span>
|
164
|
+
80: <span class="ruby-identifier">require</span> <span class="ruby-value str">'phusion_passenger/exceptions'</span>
|
165
|
+
81:
|
166
|
+
82: <span class="ruby-comment cmt"># Commonly used libraries.</span>
|
167
|
+
83: [<span class="ruby-value str">'mysql'</span>, <span class="ruby-value str">'sqlite3'</span>].<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">lib</span><span class="ruby-operator">|</span>
|
168
|
+
84: <span class="ruby-keyword kw">begin</span>
|
169
|
+
85: <span class="ruby-identifier">require</span> <span class="ruby-identifier">lib</span>
|
170
|
+
86: <span class="ruby-keyword kw">rescue</span> <span class="ruby-constant">LoadError</span>
|
171
|
+
87: <span class="ruby-comment cmt"># Do nothing; ignore if not present.</span>
|
172
|
+
88: <span class="ruby-keyword kw">end</span>
|
173
|
+
89: <span class="ruby-keyword kw">end</span>
|
174
|
+
90: <span class="ruby-keyword kw">end</span>
|
175
|
+
91: <span class="ruby-keyword kw">end</span>
|
176
176
|
</pre>
|
177
177
|
</div>
|
178
178
|
</div>
|
@@ -180,7 +180,7 @@ work around an obscure bug in ActiveSupport‘s Dispatcher.
|
|
180
180
|
<div class="sectiontitle">Public Instance methods</div>
|
181
181
|
<div class="method">
|
182
182
|
<div class="title">
|
183
|
-
<a name="
|
183
|
+
<a name="M000115"></a><b>cleanup</b>()
|
184
184
|
</div>
|
185
185
|
<div class="description">
|
186
186
|
<p>
|
@@ -189,20 +189,20 @@ href="SpawnManager.html">SpawnManager</a> is no longer needed.
|
|
189
189
|
</p>
|
190
190
|
</div>
|
191
191
|
<div class="sourcecode">
|
192
|
-
<p class="source-link">[ <a href="javascript:toggleSource('
|
193
|
-
<div id="
|
192
|
+
<p class="source-link">[ <a href="javascript:toggleSource('M000115_source')" id="l_M000115_source">show source</a> ]</p>
|
193
|
+
<div id="M000115_source" class="dyn-source">
|
194
194
|
<pre>
|
195
|
-
<span class="ruby-comment cmt"># File lib/phusion_passenger/spawn_manager.rb, line
|
196
|
-
|
197
|
-
|
198
|
-
|
195
|
+
<span class="ruby-comment cmt"># File lib/phusion_passenger/spawn_manager.rb, line 214</span>
|
196
|
+
214: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">cleanup</span>
|
197
|
+
215: <span class="ruby-ivar">@spawners</span>.<span class="ruby-identifier">cleanup</span>
|
198
|
+
216: <span class="ruby-keyword kw">end</span>
|
199
199
|
</pre>
|
200
200
|
</div>
|
201
201
|
</div>
|
202
202
|
</div>
|
203
203
|
<div class="method">
|
204
204
|
<div class="title">
|
205
|
-
<a name="
|
205
|
+
<a name="M000114"></a><b>reload</b>(app_root = nil)
|
206
206
|
</div>
|
207
207
|
<div class="description">
|
208
208
|
<p>
|
@@ -213,8 +213,8 @@ will be removed, no matter the application root.
|
|
213
213
|
<p>
|
214
214
|
<b>Long description:</b> <a href="Application.html">Application</a> code
|
215
215
|
might be cached in memory. But once it a while, it will be necessary to <a
|
216
|
-
href="SpawnManager.html#
|
217
|
-
such as after deploying a <a href="SpawnManager.html#
|
216
|
+
href="SpawnManager.html#M000114">reload</a> the code for an application,
|
217
|
+
such as after deploying a <a href="SpawnManager.html#M000112">new</a>
|
218
218
|
version of the application. This method makes sure that any cached
|
219
219
|
application code is removed, so that the next time an application instance
|
220
220
|
is spawned, the application code will be freshly loaded into memory.
|
@@ -224,48 +224,42 @@ Raises AbstractServer::SpawnError if something went wrong.
|
|
224
224
|
</p>
|
225
225
|
</div>
|
226
226
|
<div class="sourcecode">
|
227
|
-
<p class="source-link">[ <a href="javascript:toggleSource('
|
228
|
-
<div id="
|
227
|
+
<p class="source-link">[ <a href="javascript:toggleSource('M000114_source')" id="l_M000114_source">show source</a> ]</p>
|
228
|
+
<div id="M000114_source" class="dyn-source">
|
229
229
|
<pre>
|
230
|
-
<span class="ruby-comment cmt"># File lib/phusion_passenger/spawn_manager.rb, line
|
231
|
-
|
232
|
-
|
233
|
-
|
234
|
-
|
235
|
-
|
236
|
-
|
237
|
-
|
238
|
-
|
239
|
-
|
240
|
-
|
241
|
-
|
242
|
-
|
243
|
-
|
244
|
-
|
245
|
-
|
246
|
-
|
247
|
-
|
248
|
-
|
249
|
-
|
250
|
-
|
251
|
-
|
252
|
-
|
253
|
-
|
254
|
-
|
255
|
-
|
256
|
-
207: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">spawner</span>.<span class="ruby-identifier">respond_to?</span>(<span class="ruby-identifier">:reload</span>)
|
257
|
-
208: <span class="ruby-identifier">spawner</span>.<span class="ruby-identifier">reload</span>(<span class="ruby-identifier">app_root</span>)
|
258
|
-
209: <span class="ruby-keyword kw">end</span>
|
259
|
-
210: <span class="ruby-keyword kw">end</span>
|
260
|
-
211: <span class="ruby-keyword kw">end</span>
|
261
|
-
212: <span class="ruby-keyword kw">end</span>
|
230
|
+
<span class="ruby-comment cmt"># File lib/phusion_passenger/spawn_manager.rb, line 187</span>
|
231
|
+
187: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">reload</span>(<span class="ruby-identifier">app_root</span> = <span class="ruby-keyword kw">nil</span>)
|
232
|
+
188: <span class="ruby-ivar">@spawners</span>.<span class="ruby-identifier">synchronize</span> <span class="ruby-keyword kw">do</span>
|
233
|
+
189: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">app_root</span>
|
234
|
+
190: <span class="ruby-comment cmt"># Delete associated ApplicationSpawner.</span>
|
235
|
+
191: <span class="ruby-ivar">@spawners</span>.<span class="ruby-identifier">delete</span>(<span class="ruby-node">"app:#{app_root}"</span>)
|
236
|
+
192: <span class="ruby-keyword kw">else</span>
|
237
|
+
193: <span class="ruby-comment cmt"># Delete all ApplicationSpawners.</span>
|
238
|
+
194: <span class="ruby-identifier">keys_to_delete</span> = []
|
239
|
+
195: <span class="ruby-ivar">@spawners</span>.<span class="ruby-identifier">each_pair</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">key</span>, <span class="ruby-identifier">spawner</span><span class="ruby-operator">|</span>
|
240
|
+
196: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">spawner</span>.<span class="ruby-identifier">is_a?</span>(<span class="ruby-constant">Railz</span><span class="ruby-operator">::</span><span class="ruby-constant">ApplicationSpawner</span>)
|
241
|
+
197: <span class="ruby-identifier">keys_to_delete</span> <span class="ruby-operator"><<</span> <span class="ruby-identifier">key</span>
|
242
|
+
198: <span class="ruby-keyword kw">end</span>
|
243
|
+
199: <span class="ruby-keyword kw">end</span>
|
244
|
+
200: <span class="ruby-identifier">keys_to_delete</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">key</span><span class="ruby-operator">|</span>
|
245
|
+
201: <span class="ruby-ivar">@spawners</span>.<span class="ruby-identifier">delete</span>(<span class="ruby-identifier">key</span>)
|
246
|
+
202: <span class="ruby-keyword kw">end</span>
|
247
|
+
203: <span class="ruby-keyword kw">end</span>
|
248
|
+
204: <span class="ruby-ivar">@spawners</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">spawner</span><span class="ruby-operator">|</span>
|
249
|
+
205: <span class="ruby-comment cmt"># Reload all FrameworkSpawners.</span>
|
250
|
+
206: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">spawner</span>.<span class="ruby-identifier">respond_to?</span>(<span class="ruby-identifier">:reload</span>)
|
251
|
+
207: <span class="ruby-identifier">spawner</span>.<span class="ruby-identifier">reload</span>(<span class="ruby-identifier">app_root</span>)
|
252
|
+
208: <span class="ruby-keyword kw">end</span>
|
253
|
+
209: <span class="ruby-keyword kw">end</span>
|
254
|
+
210: <span class="ruby-keyword kw">end</span>
|
255
|
+
211: <span class="ruby-keyword kw">end</span>
|
262
256
|
</pre>
|
263
257
|
</div>
|
264
258
|
</div>
|
265
259
|
</div>
|
266
260
|
<div class="method">
|
267
261
|
<div class="title">
|
268
|
-
<a name="
|
262
|
+
<a name="M000113"></a><b>spawn_application</b>(options)
|
269
263
|
</div>
|
270
264
|
<div class="description">
|
271
265
|
<p>
|
@@ -294,12 +288,12 @@ must do one of these things:
|
|
294
288
|
|
295
289
|
<ul>
|
296
290
|
<li>Restart this <a href="SpawnManager.html">SpawnManager</a> by calling <a
|
297
|
-
href="AbstractServer.html#
|
298
|
-
href="AbstractServer.html#
|
291
|
+
href="AbstractServer.html#M000128">AbstractServer#stop</a>, then <a
|
292
|
+
href="AbstractServer.html#M000126">AbstractServer#start</a>.
|
299
293
|
|
300
294
|
</li>
|
301
295
|
<li>Reload the application by calling <a
|
302
|
-
href="SpawnManager.html#
|
296
|
+
href="SpawnManager.html#M000114">reload</a> with the correct app_root
|
303
297
|
argument.
|
304
298
|
|
305
299
|
</li>
|
@@ -360,42 +354,42 @@ exception or called exit() during startup.
|
|
360
354
|
</ul>
|
361
355
|
</div>
|
362
356
|
<div class="sourcecode">
|
363
|
-
<p class="source-link">[ <a href="javascript:toggleSource('
|
364
|
-
<div id="
|
357
|
+
<p class="source-link">[ <a href="javascript:toggleSource('M000113_source')" id="l_M000113_source">show source</a> ]</p>
|
358
|
+
<div id="M000113_source" class="dyn-source">
|
365
359
|
<pre>
|
366
|
-
<span class="ruby-comment cmt"># File lib/phusion_passenger/spawn_manager.rb, line
|
367
|
-
|
368
|
-
|
369
|
-
|
370
|
-
|
371
|
-
|
372
|
-
|
373
|
-
|
374
|
-
|
375
|
-
|
376
|
-
|
377
|
-
|
378
|
-
147: <span class="ruby-keyword kw">end</span>
|
379
|
-
148: <span class="ruby-keyword kw">return</span> <span class="ruby-identifier">spawn_rails_application</span>(<span class="ruby-identifier">options</span>)
|
380
|
-
149: <span class="ruby-keyword kw">elsif</span> <span class="ruby-identifier">options</span>[<span class="ruby-value str">"app_type"</span>] <span class="ruby-operator">==</span> <span class="ruby-value str">"rack"</span>
|
381
|
-
150: <span class="ruby-keyword kw">if</span> <span class="ruby-operator">!</span><span class="ruby-keyword kw">defined?</span>(<span class="ruby-constant">Rack</span><span class="ruby-operator">::</span><span class="ruby-constant">ApplicationSpawner</span>)
|
382
|
-
151: <span class="ruby-identifier">require</span> <span class="ruby-value str">'phusion_passenger/rack/application_spawner'</span>
|
360
|
+
<span class="ruby-comment cmt"># File lib/phusion_passenger/spawn_manager.rb, line 141</span>
|
361
|
+
141: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">spawn_application</span>(<span class="ruby-identifier">options</span>)
|
362
|
+
142: <span class="ruby-keyword kw">if</span> <span class="ruby-operator">!</span><span class="ruby-identifier">options</span>[<span class="ruby-value str">"app_root"</span>]
|
363
|
+
143: <span class="ruby-identifier">raise</span> <span class="ruby-constant">ArgumentError</span>, <span class="ruby-value str">"The 'app_root' option must be given."</span>
|
364
|
+
144: <span class="ruby-keyword kw">end</span>
|
365
|
+
145: <span class="ruby-identifier">options</span> = <span class="ruby-identifier">sanitize_spawn_options</span>(<span class="ruby-identifier">options</span>)
|
366
|
+
146:
|
367
|
+
147: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">options</span>[<span class="ruby-value str">"app_type"</span>] <span class="ruby-operator">==</span> <span class="ruby-value str">"rails"</span>
|
368
|
+
148: <span class="ruby-keyword kw">if</span> <span class="ruby-operator">!</span><span class="ruby-keyword kw">defined?</span>(<span class="ruby-constant">Railz</span><span class="ruby-operator">::</span><span class="ruby-constant">FrameworkSpawner</span>)
|
369
|
+
149: <span class="ruby-identifier">require</span> <span class="ruby-value str">'phusion_passenger/application'</span>
|
370
|
+
150: <span class="ruby-identifier">require</span> <span class="ruby-value str">'phusion_passenger/railz/framework_spawner'</span>
|
371
|
+
151: <span class="ruby-identifier">require</span> <span class="ruby-value str">'phusion_passenger/railz/application_spawner'</span>
|
383
372
|
152: <span class="ruby-keyword kw">end</span>
|
384
|
-
153: <span class="ruby-keyword kw">return</span> <span class="ruby-
|
385
|
-
154:
|
386
|
-
155: )
|
387
|
-
156:
|
388
|
-
157: <span class="ruby-
|
389
|
-
158: <span class="ruby-keyword kw">return</span> <span class="ruby-constant">
|
390
|
-
159: <span class="ruby-identifier">options</span>[<span class="ruby-value str">"app_root"</span>],
|
391
|
-
160:
|
392
|
-
161:
|
393
|
-
162:
|
394
|
-
163:
|
395
|
-
164:
|
396
|
-
165:
|
397
|
-
166:
|
398
|
-
167:
|
373
|
+
153: <span class="ruby-keyword kw">return</span> <span class="ruby-identifier">spawn_rails_application</span>(<span class="ruby-identifier">options</span>)
|
374
|
+
154: <span class="ruby-keyword kw">elsif</span> <span class="ruby-identifier">options</span>[<span class="ruby-value str">"app_type"</span>] <span class="ruby-operator">==</span> <span class="ruby-value str">"rack"</span>
|
375
|
+
155: <span class="ruby-keyword kw">if</span> <span class="ruby-operator">!</span><span class="ruby-keyword kw">defined?</span>(<span class="ruby-constant">Rack</span><span class="ruby-operator">::</span><span class="ruby-constant">ApplicationSpawner</span>)
|
376
|
+
156: <span class="ruby-identifier">require</span> <span class="ruby-value str">'phusion_passenger/rack/application_spawner'</span>
|
377
|
+
157: <span class="ruby-keyword kw">end</span>
|
378
|
+
158: <span class="ruby-keyword kw">return</span> <span class="ruby-constant">Rack</span><span class="ruby-operator">::</span><span class="ruby-constant">ApplicationSpawner</span>.<span class="ruby-identifier">spawn_application</span>(
|
379
|
+
159: <span class="ruby-identifier">options</span>[<span class="ruby-value str">"app_root"</span>], <span class="ruby-identifier">options</span>
|
380
|
+
160: )
|
381
|
+
161: <span class="ruby-keyword kw">elsif</span> <span class="ruby-identifier">options</span>[<span class="ruby-value str">"app_type"</span>] <span class="ruby-operator">==</span> <span class="ruby-value str">"wsgi"</span>
|
382
|
+
162: <span class="ruby-identifier">require</span> <span class="ruby-value str">'phusion_passenger/wsgi/application_spawner'</span>
|
383
|
+
163: <span class="ruby-keyword kw">return</span> <span class="ruby-constant">WSGI</span><span class="ruby-operator">::</span><span class="ruby-constant">ApplicationSpawner</span>.<span class="ruby-identifier">spawn_application</span>(
|
384
|
+
164: <span class="ruby-identifier">options</span>[<span class="ruby-value str">"app_root"</span>],
|
385
|
+
165: <span class="ruby-identifier">options</span>[<span class="ruby-value str">"lower_privilege"</span>],
|
386
|
+
166: <span class="ruby-identifier">options</span>[<span class="ruby-value str">"lowest_user"</span>],
|
387
|
+
167: <span class="ruby-identifier">options</span>[<span class="ruby-value str">"environment"</span>]
|
388
|
+
168: )
|
389
|
+
169: <span class="ruby-keyword kw">else</span>
|
390
|
+
170: <span class="ruby-identifier">raise</span> <span class="ruby-constant">ArgumentError</span>, <span class="ruby-node">"Unknown 'app_type' value '#{options["app_type"]}'."</span>
|
391
|
+
171: <span class="ruby-keyword kw">end</span>
|
392
|
+
172: <span class="ruby-keyword kw">end</span>
|
399
393
|
</pre>
|
400
394
|
</div>
|
401
395
|
</div>
|
@@ -80,7 +80,7 @@ StandardError
|
|
80
80
|
|
81
81
|
<div class="sectiontitle">Methods</div>
|
82
82
|
<ul>
|
83
|
-
<li><a href="#
|
83
|
+
<li><a href="#M000121">new</a></li>
|
84
84
|
</ul>
|
85
85
|
|
86
86
|
|
@@ -101,18 +101,18 @@ StandardError
|
|
101
101
|
<div class="sectiontitle">Public Class methods</div>
|
102
102
|
<div class="method">
|
103
103
|
<div class="title">
|
104
|
-
<a name="
|
104
|
+
<a name="M000121"></a><b>new</b>(message, class_name, backtrace)
|
105
105
|
</div>
|
106
106
|
<div class="sourcecode">
|
107
|
-
<p class="source-link">[ <a href="javascript:toggleSource('
|
108
|
-
<div id="
|
107
|
+
<p class="source-link">[ <a href="javascript:toggleSource('M000121_source')" id="l_M000121_source">show source</a> ]</p>
|
108
|
+
<div id="M000121_source" class="dyn-source">
|
109
109
|
<pre>
|
110
|
-
<span class="ruby-comment cmt"># File lib/phusion_passenger/exceptions.rb, line
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
110
|
+
<span class="ruby-comment cmt"># File lib/phusion_passenger/exceptions.rb, line 93</span>
|
111
|
+
93: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">initialize</span>(<span class="ruby-identifier">message</span>, <span class="ruby-identifier">class_name</span>, <span class="ruby-identifier">backtrace</span>)
|
112
|
+
94: <span class="ruby-keyword kw">super</span>(<span class="ruby-node">"#{message} (#{class_name})"</span>)
|
113
|
+
95: <span class="ruby-identifier">set_backtrace</span>(<span class="ruby-identifier">backtrace</span>)
|
114
|
+
96: <span class="ruby-ivar">@real_class_name</span> = <span class="ruby-identifier">class_name</span>
|
115
|
+
97: <span class="ruby-keyword kw">end</span>
|
116
116
|
</pre>
|
117
117
|
</div>
|
118
118
|
</div>
|
@@ -78,23 +78,23 @@ Utility functions.
|
|
78
78
|
|
79
79
|
<div class="sectiontitle">Methods</div>
|
80
80
|
<ul>
|
81
|
-
<li><a href="#
|
82
|
-
<li><a href="#
|
83
|
-
<li><a href="#
|
84
|
-
<li><a href="#
|
85
|
-
<li><a href="#
|
86
|
-
<li><a href="#
|
87
|
-
<li><a href="#
|
88
|
-
<li><a href="#
|
89
|
-
<li><a href="#
|
90
|
-
<li><a href="#
|
91
|
-
<li><a href="#
|
92
|
-
<li><a href="#
|
93
|
-
<li><a href="#
|
94
|
-
<li><a href="#
|
95
|
-
<li><a href="#
|
96
|
-
<li><a href="#
|
97
|
-
<li><a href="#
|
81
|
+
<li><a href="#M000074">assert_valid_app_root</a></li>
|
82
|
+
<li><a href="#M000075">assert_valid_directory</a></li>
|
83
|
+
<li><a href="#M000076">assert_valid_file</a></li>
|
84
|
+
<li><a href="#M000078">assert_valid_groupname</a></li>
|
85
|
+
<li><a href="#M000077">assert_valid_username</a></li>
|
86
|
+
<li><a href="#M000073">canonicalize_path</a></li>
|
87
|
+
<li><a href="#M000079">close_all_io_objects_for_fds</a></li>
|
88
|
+
<li><a href="#M000086">lower_privilege</a></li>
|
89
|
+
<li><a href="#M000080">marshal_exception</a></li>
|
90
|
+
<li><a href="#M000089">passenger_tmpdir</a></li>
|
91
|
+
<li><a href="#M000082">print_exception</a></li>
|
92
|
+
<li><a href="#M000084">report_app_init_status</a></li>
|
93
|
+
<li><a href="#M000083">safe_fork</a></li>
|
94
|
+
<li><a href="#M000088">sanitize_spawn_options</a></li>
|
95
|
+
<li><a href="#M000087">switch_to_user</a></li>
|
96
|
+
<li><a href="#M000085">unmarshal_and_raise_errors</a></li>
|
97
|
+
<li><a href="#M000081">unmarshal_exception</a></li>
|
98
98
|
</ul>
|
99
99
|
|
100
100
|
|
@@ -105,7 +105,7 @@ Utility functions.
|
|
105
105
|
<div class="sectiontitle">Protected Instance methods</div>
|
106
106
|
<div class="method">
|
107
107
|
<div class="title">
|
108
|
-
<a name="
|
108
|
+
<a name="M000074"></a><b>assert_valid_app_root</b>(app_root)
|
109
109
|
</div>
|
110
110
|
<div class="description">
|
111
111
|
<p>
|
@@ -114,21 +114,21 @@ Raises <a href="InvalidPath.html">InvalidPath</a> if that is not the case.
|
|
114
114
|
</p>
|
115
115
|
</div>
|
116
116
|
<div class="sourcecode">
|
117
|
-
<p class="source-link">[ <a href="javascript:toggleSource('
|
118
|
-
<div id="
|
117
|
+
<p class="source-link">[ <a href="javascript:toggleSource('M000074_source')" id="l_M000074_source">show source</a> ]</p>
|
118
|
+
<div id="M000074_source" class="dyn-source">
|
119
119
|
<pre>
|
120
|
-
<span class="ruby-comment cmt"># File lib/phusion_passenger/utils.rb, line
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
120
|
+
<span class="ruby-comment cmt"># File lib/phusion_passenger/utils.rb, line 59</span>
|
121
|
+
59: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">assert_valid_app_root</span>(<span class="ruby-identifier">app_root</span>)
|
122
|
+
60: <span class="ruby-identifier">assert_valid_directory</span>(<span class="ruby-identifier">app_root</span>)
|
123
|
+
61: <span class="ruby-identifier">assert_valid_file</span>(<span class="ruby-node">"#{app_root}/config/environment.rb"</span>)
|
124
|
+
62: <span class="ruby-keyword kw">end</span>
|
125
125
|
</pre>
|
126
126
|
</div>
|
127
127
|
</div>
|
128
128
|
</div>
|
129
129
|
<div class="method">
|
130
130
|
<div class="title">
|
131
|
-
<a name="
|
131
|
+
<a name="M000075"></a><b>assert_valid_directory</b>(path)
|
132
132
|
</div>
|
133
133
|
<div class="description">
|
134
134
|
<p>
|
@@ -137,22 +137,22 @@ href="InvalidPath.html">InvalidPath</a></tt> if it isn‘t.
|
|
137
137
|
</p>
|
138
138
|
</div>
|
139
139
|
<div class="sourcecode">
|
140
|
-
<p class="source-link">[ <a href="javascript:toggleSource('
|
141
|
-
<div id="
|
140
|
+
<p class="source-link">[ <a href="javascript:toggleSource('M000075_source')" id="l_M000075_source">show source</a> ]</p>
|
141
|
+
<div id="M000075_source" class="dyn-source">
|
142
142
|
<pre>
|
143
|
-
<span class="ruby-comment cmt"># File lib/phusion_passenger/utils.rb, line
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
143
|
+
<span class="ruby-comment cmt"># File lib/phusion_passenger/utils.rb, line 65</span>
|
144
|
+
65: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">assert_valid_directory</span>(<span class="ruby-identifier">path</span>)
|
145
|
+
66: <span class="ruby-keyword kw">if</span> <span class="ruby-operator">!</span><span class="ruby-constant">File</span>.<span class="ruby-identifier">directory?</span>(<span class="ruby-identifier">path</span>)
|
146
|
+
67: <span class="ruby-identifier">raise</span> <span class="ruby-constant">InvalidPath</span>, <span class="ruby-node">"'#{path}' is not a valid directory."</span>
|
147
|
+
68: <span class="ruby-keyword kw">end</span>
|
148
|
+
69: <span class="ruby-keyword kw">end</span>
|
149
149
|
</pre>
|
150
150
|
</div>
|
151
151
|
</div>
|
152
152
|
</div>
|
153
153
|
<div class="method">
|
154
154
|
<div class="title">
|
155
|
-
<a name="
|
155
|
+
<a name="M000076"></a><b>assert_valid_file</b>(path)
|
156
156
|
</div>
|
157
157
|
<div class="description">
|
158
158
|
<p>
|
@@ -161,22 +161,22 @@ href="InvalidPath.html">InvalidPath</a></tt> if it isn‘t.
|
|
161
161
|
</p>
|
162
162
|
</div>
|
163
163
|
<div class="sourcecode">
|
164
|
-
<p class="source-link">[ <a href="javascript:toggleSource('
|
165
|
-
<div id="
|
164
|
+
<p class="source-link">[ <a href="javascript:toggleSource('M000076_source')" id="l_M000076_source">show source</a> ]</p>
|
165
|
+
<div id="M000076_source" class="dyn-source">
|
166
166
|
<pre>
|
167
|
-
<span class="ruby-comment cmt"># File lib/phusion_passenger/utils.rb, line
|
168
|
-
|
169
|
-
|
170
|
-
|
171
|
-
|
172
|
-
|
167
|
+
<span class="ruby-comment cmt"># File lib/phusion_passenger/utils.rb, line 72</span>
|
168
|
+
72: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">assert_valid_file</span>(<span class="ruby-identifier">path</span>)
|
169
|
+
73: <span class="ruby-keyword kw">if</span> <span class="ruby-operator">!</span><span class="ruby-constant">File</span>.<span class="ruby-identifier">file?</span>(<span class="ruby-identifier">path</span>)
|
170
|
+
74: <span class="ruby-identifier">raise</span> <span class="ruby-constant">InvalidPath</span>, <span class="ruby-node">"'#{path}' is not a valid file."</span>
|
171
|
+
75: <span class="ruby-keyword kw">end</span>
|
172
|
+
76: <span class="ruby-keyword kw">end</span>
|
173
173
|
</pre>
|
174
174
|
</div>
|
175
175
|
</div>
|
176
176
|
</div>
|
177
177
|
<div class="method">
|
178
178
|
<div class="title">
|
179
|
-
<a name="
|
179
|
+
<a name="M000078"></a><b>assert_valid_groupname</b>(groupname)
|
180
180
|
</div>
|
181
181
|
<div class="description">
|
182
182
|
<p>
|
@@ -185,21 +185,21 @@ if that is not the case.
|
|
185
185
|
</p>
|
186
186
|
</div>
|
187
187
|
<div class="sourcecode">
|
188
|
-
<p class="source-link">[ <a href="javascript:toggleSource('
|
189
|
-
<div id="
|
188
|
+
<p class="source-link">[ <a href="javascript:toggleSource('M000078_source')" id="l_M000078_source">show source</a> ]</p>
|
189
|
+
<div id="M000078_source" class="dyn-source">
|
190
190
|
<pre>
|
191
|
-
<span class="ruby-comment cmt"># File lib/phusion_passenger/utils.rb, line
|
192
|
-
|
193
|
-
|
194
|
-
|
195
|
-
|
191
|
+
<span class="ruby-comment cmt"># File lib/phusion_passenger/utils.rb, line 87</span>
|
192
|
+
87: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">assert_valid_groupname</span>(<span class="ruby-identifier">groupname</span>)
|
193
|
+
88: <span class="ruby-comment cmt"># If groupname does not exist then getgrnam() will raise an ArgumentError.</span>
|
194
|
+
89: <span class="ruby-identifier">groupname</span> <span class="ruby-operator">&&</span> <span class="ruby-constant">Etc</span>.<span class="ruby-identifier">getgrnam</span>(<span class="ruby-identifier">groupname</span>)
|
195
|
+
90: <span class="ruby-keyword kw">end</span>
|
196
196
|
</pre>
|
197
197
|
</div>
|
198
198
|
</div>
|
199
199
|
</div>
|
200
200
|
<div class="method">
|
201
201
|
<div class="title">
|
202
|
-
<a name="
|
202
|
+
<a name="M000077"></a><b>assert_valid_username</b>(username)
|
203
203
|
</div>
|
204
204
|
<div class="description">
|
205
205
|
<p>
|
@@ -207,140 +207,140 @@ Assert that <tt>username</tt> is a valid username. Raises ArgumentError if
|
|
207
207
|
that is not the case.
|
208
208
|
</p>
|
209
209
|
</div>
|
210
|
-
<div class="sourcecode">
|
211
|
-
<p class="source-link">[ <a href="javascript:toggleSource('M000075_source')" id="l_M000075_source">show source</a> ]</p>
|
212
|
-
<div id="M000075_source" class="dyn-source">
|
213
|
-
<pre>
|
214
|
-
<span class="ruby-comment cmt"># File lib/phusion_passenger/utils.rb, line 75</span>
|
215
|
-
75: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">assert_valid_username</span>(<span class="ruby-identifier">username</span>)
|
216
|
-
76: <span class="ruby-comment cmt"># If username does not exist then getpwnam() will raise an ArgumentError.</span>
|
217
|
-
77: <span class="ruby-identifier">username</span> <span class="ruby-operator">&&</span> <span class="ruby-constant">Etc</span>.<span class="ruby-identifier">getpwnam</span>(<span class="ruby-identifier">username</span>)
|
218
|
-
78: <span class="ruby-keyword kw">end</span>
|
219
|
-
</pre>
|
220
|
-
</div>
|
221
|
-
</div>
|
222
|
-
</div>
|
223
|
-
<div class="method">
|
224
|
-
<div class="title">
|
225
|
-
<a name="M000077"></a><b>close_all_io_objects_for_fds</b>(file_descriptors_to_leave_open)
|
226
|
-
</div>
|
227
210
|
<div class="sourcecode">
|
228
211
|
<p class="source-link">[ <a href="javascript:toggleSource('M000077_source')" id="l_M000077_source">show source</a> ]</p>
|
229
212
|
<div id="M000077_source" class="dyn-source">
|
230
213
|
<pre>
|
231
|
-
<span class="ruby-comment cmt"># File lib/phusion_passenger/utils.rb, line
|
232
|
-
|
233
|
-
|
234
|
-
|
235
|
-
|
236
|
-
91: <span class="ruby-identifier">io</span>.<span class="ruby-identifier">close</span>
|
237
|
-
92: <span class="ruby-keyword kw">end</span>
|
238
|
-
93: <span class="ruby-keyword kw">rescue</span>
|
239
|
-
94: <span class="ruby-keyword kw">end</span>
|
240
|
-
95: <span class="ruby-keyword kw">end</span>
|
241
|
-
96: <span class="ruby-keyword kw">end</span>
|
214
|
+
<span class="ruby-comment cmt"># File lib/phusion_passenger/utils.rb, line 80</span>
|
215
|
+
80: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">assert_valid_username</span>(<span class="ruby-identifier">username</span>)
|
216
|
+
81: <span class="ruby-comment cmt"># If username does not exist then getpwnam() will raise an ArgumentError.</span>
|
217
|
+
82: <span class="ruby-identifier">username</span> <span class="ruby-operator">&&</span> <span class="ruby-constant">Etc</span>.<span class="ruby-identifier">getpwnam</span>(<span class="ruby-identifier">username</span>)
|
218
|
+
83: <span class="ruby-keyword kw">end</span>
|
242
219
|
</pre>
|
243
220
|
</div>
|
244
221
|
</div>
|
245
222
|
</div>
|
246
223
|
<div class="method">
|
247
224
|
<div class="title">
|
248
|
-
<a name="
|
225
|
+
<a name="M000073"></a><b>canonicalize_path</b>(path)
|
249
226
|
</div>
|
250
227
|
<div class="description">
|
251
228
|
<p>
|
252
|
-
|
253
|
-
|
229
|
+
Return the canonicalized version of <tt>path</tt>. This path is guaranteed
|
230
|
+
to to be "normal", i.e. it doesn‘t contain stuff like
|
231
|
+
".." or "/", and it fully resolves symbolic links.
|
232
|
+
</p>
|
233
|
+
<p>
|
234
|
+
Raises SystemCallError if something went wrong. Raises ArgumentError if
|
235
|
+
<tt>path</tt> is nil. Raises <a href="InvalidPath.html">InvalidPath</a> if
|
236
|
+
<tt>path</tt> does not appear to be a valid path.
|
254
237
|
</p>
|
255
238
|
</div>
|
256
239
|
<div class="sourcecode">
|
257
|
-
<p class="source-link">[ <a href="javascript:toggleSource('
|
258
|
-
<div id="
|
240
|
+
<p class="source-link">[ <a href="javascript:toggleSource('M000073_source')" id="l_M000073_source">show source</a> ]</p>
|
241
|
+
<div id="M000073_source" class="dyn-source">
|
259
242
|
<pre>
|
260
|
-
|
261
|
-
|
262
|
-
|
263
|
-
|
264
|
-
|
265
|
-
|
266
|
-
|
267
|
-
280: <span class="ruby-keyword kw">rescue</span> <span class="ruby-constant">Errno</span><span class="ruby-operator">::</span><span class="ruby-constant">EPERM</span>
|
268
|
-
281: <span class="ruby-comment cmt"># No problem if we were unable to switch user.</span>
|
269
|
-
282: <span class="ruby-keyword kw">end</span>
|
270
|
-
283: <span class="ruby-keyword kw">end</span>
|
243
|
+
<span class="ruby-comment cmt"># File lib/phusion_passenger/utils.rb, line 50</span>
|
244
|
+
50: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">canonicalize_path</span>(<span class="ruby-identifier">path</span>)
|
245
|
+
51: <span class="ruby-identifier">raise</span> <span class="ruby-constant">ArgumentError</span>, <span class="ruby-value str">"The 'path' argument may not be nil"</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">path</span>.<span class="ruby-identifier">nil?</span>
|
246
|
+
52: <span class="ruby-keyword kw">return</span> <span class="ruby-constant">Pathname</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">path</span>).<span class="ruby-identifier">realpath</span>.<span class="ruby-identifier">to_s</span>
|
247
|
+
53: <span class="ruby-keyword kw">rescue</span> <span class="ruby-constant">Errno</span><span class="ruby-operator">::</span><span class="ruby-constant">ENOENT</span> =<span class="ruby-operator">></span> <span class="ruby-identifier">e</span>
|
248
|
+
54: <span class="ruby-identifier">raise</span> <span class="ruby-constant">InvalidAPath</span>, <span class="ruby-identifier">e</span>.<span class="ruby-identifier">message</span>
|
249
|
+
55: <span class="ruby-keyword kw">end</span>
|
271
250
|
</pre>
|
272
251
|
</div>
|
273
252
|
</div>
|
274
253
|
</div>
|
275
254
|
<div class="method">
|
276
255
|
<div class="title">
|
277
|
-
<a name="
|
256
|
+
<a name="M000079"></a><b>close_all_io_objects_for_fds</b>(file_descriptors_to_leave_open)
|
278
257
|
</div>
|
279
258
|
<div class="sourcecode">
|
280
|
-
<p class="source-link">[ <a href="javascript:toggleSource('
|
281
|
-
<div id="
|
259
|
+
<p class="source-link">[ <a href="javascript:toggleSource('M000079_source')" id="l_M000079_source">show source</a> ]</p>
|
260
|
+
<div id="M000079_source" class="dyn-source">
|
282
261
|
<pre>
|
283
|
-
<span class="ruby-comment cmt"># File lib/phusion_passenger/utils.rb, line
|
284
|
-
|
285
|
-
|
286
|
-
|
287
|
-
|
288
|
-
|
289
|
-
|
290
|
-
|
291
|
-
|
292
|
-
|
293
|
-
|
294
|
-
108: <span class="ruby-keyword kw">end</span>
|
295
|
-
109: <span class="ruby-keyword kw">else</span>
|
296
|
-
110: <span class="ruby-keyword kw">begin</span>
|
297
|
-
111: <span class="ruby-identifier">data</span>[<span class="ruby-identifier">:exception</span>] = <span class="ruby-constant">Marshal</span>.<span class="ruby-identifier">dump</span>(<span class="ruby-identifier">exception</span>)
|
298
|
-
112: <span class="ruby-keyword kw">rescue</span> <span class="ruby-constant">ArgumentError</span>, <span class="ruby-constant">TypeError</span>
|
299
|
-
113: <span class="ruby-identifier">e</span> = <span class="ruby-constant">UnknownError</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">exception</span>.<span class="ruby-identifier">message</span>, <span class="ruby-identifier">exception</span>.<span class="ruby-identifier">class</span>.<span class="ruby-identifier">to_s</span>,
|
300
|
-
114: <span class="ruby-identifier">exception</span>.<span class="ruby-identifier">backtrace</span>)
|
301
|
-
115: <span class="ruby-identifier">data</span>[<span class="ruby-identifier">:exception</span>] = <span class="ruby-constant">Marshal</span>.<span class="ruby-identifier">dump</span>(<span class="ruby-identifier">e</span>)
|
302
|
-
116: <span class="ruby-keyword kw">end</span>
|
303
|
-
117: <span class="ruby-keyword kw">end</span>
|
304
|
-
118: <span class="ruby-keyword kw">return</span> <span class="ruby-constant">Marshal</span>.<span class="ruby-identifier">dump</span>(<span class="ruby-identifier">data</span>)
|
305
|
-
119: <span class="ruby-keyword kw">end</span>
|
262
|
+
<span class="ruby-comment cmt"># File lib/phusion_passenger/utils.rb, line 92</span>
|
263
|
+
92: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">close_all_io_objects_for_fds</span>(<span class="ruby-identifier">file_descriptors_to_leave_open</span>)
|
264
|
+
93: <span class="ruby-constant">ObjectSpace</span>.<span class="ruby-identifier">each_object</span>(<span class="ruby-constant">IO</span>) <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">io</span><span class="ruby-operator">|</span>
|
265
|
+
94: <span class="ruby-keyword kw">begin</span>
|
266
|
+
95: <span class="ruby-keyword kw">if</span> <span class="ruby-operator">!</span><span class="ruby-identifier">file_descriptors_to_leave_open</span>.<span class="ruby-identifier">include?</span>(<span class="ruby-identifier">io</span>.<span class="ruby-identifier">fileno</span>) <span class="ruby-operator">&&</span> <span class="ruby-operator">!</span><span class="ruby-identifier">io</span>.<span class="ruby-identifier">closed?</span>
|
267
|
+
96: <span class="ruby-identifier">io</span>.<span class="ruby-identifier">close</span>
|
268
|
+
97: <span class="ruby-keyword kw">end</span>
|
269
|
+
98: <span class="ruby-keyword kw">rescue</span>
|
270
|
+
99: <span class="ruby-keyword kw">end</span>
|
271
|
+
100: <span class="ruby-keyword kw">end</span>
|
272
|
+
101: <span class="ruby-keyword kw">end</span>
|
306
273
|
</pre>
|
307
274
|
</div>
|
308
275
|
</div>
|
309
276
|
</div>
|
310
277
|
<div class="method">
|
311
278
|
<div class="title">
|
312
|
-
<a name="
|
279
|
+
<a name="M000086"></a><b>lower_privilege</b>(filename, lowest_user = "nobody")
|
313
280
|
</div>
|
314
281
|
<div class="description">
|
315
282
|
<p>
|
316
|
-
|
317
|
-
be
|
318
|
-
".." or "/", and it correctly respects symbolic links.
|
319
|
-
</p>
|
320
|
-
<p>
|
321
|
-
Raises SystemCallError if something went wrong. Raises ArgumentError if
|
322
|
-
<tt>path</tt> is nil. Raises <a href="InvalidPath.html">InvalidPath</a> if
|
323
|
-
<tt>path</tt> does not appear to be a valid path.
|
283
|
+
Lower the current process‘s privilege to the owner of the given file.
|
284
|
+
No exceptions will be raised in the event that privilege lowering fails.
|
324
285
|
</p>
|
325
286
|
</div>
|
326
287
|
<div class="sourcecode">
|
327
|
-
<p class="source-link">[ <a href="javascript:toggleSource('
|
328
|
-
<div id="
|
288
|
+
<p class="source-link">[ <a href="javascript:toggleSource('M000086_source')" id="l_M000086_source">show source</a> ]</p>
|
289
|
+
<div id="M000086_source" class="dyn-source">
|
329
290
|
<pre>
|
330
|
-
|
331
|
-
|
332
|
-
|
333
|
-
|
334
|
-
|
335
|
-
|
336
|
-
|
291
|
+
<span class="ruby-comment cmt"># File lib/phusion_passenger/utils.rb, line 279</span>
|
292
|
+
279: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">lower_privilege</span>(<span class="ruby-identifier">filename</span>, <span class="ruby-identifier">lowest_user</span> = <span class="ruby-value str">"nobody"</span>)
|
293
|
+
280: <span class="ruby-identifier">stat</span> = <span class="ruby-constant">File</span>.<span class="ruby-identifier">lstat</span>(<span class="ruby-identifier">filename</span>)
|
294
|
+
281: <span class="ruby-keyword kw">begin</span>
|
295
|
+
282: <span class="ruby-keyword kw">if</span> <span class="ruby-operator">!</span><span class="ruby-identifier">switch_to_user</span>(<span class="ruby-identifier">stat</span>.<span class="ruby-identifier">uid</span>)
|
296
|
+
283: <span class="ruby-identifier">switch_to_user</span>(<span class="ruby-identifier">lowest_user</span>)
|
297
|
+
284: <span class="ruby-keyword kw">end</span>
|
298
|
+
285: <span class="ruby-keyword kw">rescue</span> <span class="ruby-constant">Errno</span><span class="ruby-operator">::</span><span class="ruby-constant">EPERM</span>
|
299
|
+
286: <span class="ruby-comment cmt"># No problem if we were unable to switch user.</span>
|
300
|
+
287: <span class="ruby-keyword kw">end</span>
|
301
|
+
288: <span class="ruby-keyword kw">end</span>
|
337
302
|
</pre>
|
338
303
|
</div>
|
339
304
|
</div>
|
340
305
|
</div>
|
341
306
|
<div class="method">
|
342
307
|
<div class="title">
|
343
|
-
<a name="
|
308
|
+
<a name="M000080"></a><b>marshal_exception</b>(exception)
|
309
|
+
</div>
|
310
|
+
<div class="sourcecode">
|
311
|
+
<p class="source-link">[ <a href="javascript:toggleSource('M000080_source')" id="l_M000080_source">show source</a> ]</p>
|
312
|
+
<div id="M000080_source" class="dyn-source">
|
313
|
+
<pre>
|
314
|
+
<span class="ruby-comment cmt"># File lib/phusion_passenger/utils.rb, line 103</span>
|
315
|
+
103: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">marshal_exception</span>(<span class="ruby-identifier">exception</span>)
|
316
|
+
104: <span class="ruby-identifier">data</span> = {
|
317
|
+
105: <span class="ruby-identifier">:message</span> =<span class="ruby-operator">></span> <span class="ruby-identifier">exception</span>.<span class="ruby-identifier">message</span>,
|
318
|
+
106: <span class="ruby-identifier">:class</span> =<span class="ruby-operator">></span> <span class="ruby-identifier">exception</span>.<span class="ruby-identifier">class</span>.<span class="ruby-identifier">to_s</span>,
|
319
|
+
107: <span class="ruby-identifier">:backtrace</span> =<span class="ruby-operator">></span> <span class="ruby-identifier">exception</span>.<span class="ruby-identifier">backtrace</span>
|
320
|
+
108: }
|
321
|
+
109: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">exception</span>.<span class="ruby-identifier">is_a?</span>(<span class="ruby-constant">InitializationError</span>)
|
322
|
+
110: <span class="ruby-identifier">data</span>[<span class="ruby-identifier">:is_initialization_error</span>] = <span class="ruby-keyword kw">true</span>
|
323
|
+
111: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">exception</span>.<span class="ruby-identifier">child_exception</span>
|
324
|
+
112: <span class="ruby-identifier">data</span>[<span class="ruby-identifier">:child_exception</span>] = <span class="ruby-identifier">marshal_exception</span>(<span class="ruby-identifier">exception</span>.<span class="ruby-identifier">child_exception</span>)
|
325
|
+
113: <span class="ruby-keyword kw">end</span>
|
326
|
+
114: <span class="ruby-keyword kw">else</span>
|
327
|
+
115: <span class="ruby-keyword kw">begin</span>
|
328
|
+
116: <span class="ruby-identifier">data</span>[<span class="ruby-identifier">:exception</span>] = <span class="ruby-constant">Marshal</span>.<span class="ruby-identifier">dump</span>(<span class="ruby-identifier">exception</span>)
|
329
|
+
117: <span class="ruby-keyword kw">rescue</span> <span class="ruby-constant">ArgumentError</span>, <span class="ruby-constant">TypeError</span>
|
330
|
+
118: <span class="ruby-identifier">e</span> = <span class="ruby-constant">UnknownError</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">exception</span>.<span class="ruby-identifier">message</span>, <span class="ruby-identifier">exception</span>.<span class="ruby-identifier">class</span>.<span class="ruby-identifier">to_s</span>,
|
331
|
+
119: <span class="ruby-identifier">exception</span>.<span class="ruby-identifier">backtrace</span>)
|
332
|
+
120: <span class="ruby-identifier">data</span>[<span class="ruby-identifier">:exception</span>] = <span class="ruby-constant">Marshal</span>.<span class="ruby-identifier">dump</span>(<span class="ruby-identifier">e</span>)
|
333
|
+
121: <span class="ruby-keyword kw">end</span>
|
334
|
+
122: <span class="ruby-keyword kw">end</span>
|
335
|
+
123: <span class="ruby-keyword kw">return</span> <span class="ruby-constant">Marshal</span>.<span class="ruby-identifier">dump</span>(<span class="ruby-identifier">data</span>)
|
336
|
+
124: <span class="ruby-keyword kw">end</span>
|
337
|
+
</pre>
|
338
|
+
</div>
|
339
|
+
</div>
|
340
|
+
</div>
|
341
|
+
<div class="method">
|
342
|
+
<div class="title">
|
343
|
+
<a name="M000089"></a><b>passenger_tmpdir</b>(create = true)
|
344
344
|
</div>
|
345
345
|
<div class="description">
|
346
346
|
<p>
|
@@ -350,34 +350,34 @@ directory if it doesn‘t exist.
|
|
350
350
|
</p>
|
351
351
|
</div>
|
352
352
|
<div class="sourcecode">
|
353
|
-
<p class="source-link">[ <a href="javascript:toggleSource('
|
354
|
-
<div id="
|
353
|
+
<p class="source-link">[ <a href="javascript:toggleSource('M000089_source')" id="l_M000089_source">show source</a> ]</p>
|
354
|
+
<div id="M000089_source" class="dyn-source">
|
355
355
|
<pre>
|
356
|
-
<span class="ruby-comment cmt"># File lib/phusion_passenger/utils.rb, line
|
357
|
-
|
358
|
-
|
359
|
-
|
360
|
-
|
361
|
-
|
362
|
-
|
363
|
-
|
364
|
-
|
365
|
-
|
366
|
-
|
367
|
-
|
368
|
-
|
369
|
-
|
370
|
-
|
371
|
-
|
372
|
-
|
373
|
-
|
356
|
+
<span class="ruby-comment cmt"># File lib/phusion_passenger/utils.rb, line 343</span>
|
357
|
+
343: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">passenger_tmpdir</span>(<span class="ruby-identifier">create</span> = <span class="ruby-keyword kw">true</span>)
|
358
|
+
344: <span class="ruby-identifier">dir</span> = <span class="ruby-constant">ENV</span>[<span class="ruby-value str">'PASSENGER_INSTANCE_TEMP_DIR'</span>]
|
359
|
+
345: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">dir</span>.<span class="ruby-identifier">nil?</span> <span class="ruby-operator">||</span> <span class="ruby-identifier">dir</span>.<span class="ruby-identifier">empty?</span>
|
360
|
+
346: <span class="ruby-identifier">dir</span> = <span class="ruby-node">"#{Dir.tmpdir}/passenger.#{Process.pid}"</span>
|
361
|
+
347: <span class="ruby-constant">ENV</span>[<span class="ruby-value str">'PASSENGER_INSTANCE_TEMP_DIR'</span>] = <span class="ruby-identifier">dir</span>
|
362
|
+
348: <span class="ruby-keyword kw">end</span>
|
363
|
+
349: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">create</span> <span class="ruby-operator">&&</span> <span class="ruby-operator">!</span><span class="ruby-constant">File</span>.<span class="ruby-identifier">exist?</span>(<span class="ruby-identifier">dir</span>)
|
364
|
+
350: <span class="ruby-comment cmt"># This is a very minimal implementation of the function</span>
|
365
|
+
351: <span class="ruby-comment cmt"># passengerCreateTempDir() in Utils.cpp. This implementation</span>
|
366
|
+
352: <span class="ruby-comment cmt"># is only meant to make the unit tests pass. For production</span>
|
367
|
+
353: <span class="ruby-comment cmt"># systems one should pre-create the temp directory with</span>
|
368
|
+
354: <span class="ruby-comment cmt"># passengerCreateTempDir().</span>
|
369
|
+
355: <span class="ruby-identifier">system</span>(<span class="ruby-value str">"mkdir"</span>, <span class="ruby-value str">"-p"</span>, <span class="ruby-value str">"-m"</span>, <span class="ruby-value str">"u=wxs,g=wx,o=wx"</span>, <span class="ruby-identifier">dir</span>)
|
370
|
+
356: <span class="ruby-identifier">system</span>(<span class="ruby-value str">"mkdir"</span>, <span class="ruby-value str">"-p"</span>, <span class="ruby-value str">"-m"</span>, <span class="ruby-value str">"u=wxs,g=wx,o=wx"</span>, <span class="ruby-node">"#{dir}/backends"</span>)
|
371
|
+
357: <span class="ruby-keyword kw">end</span>
|
372
|
+
358: <span class="ruby-keyword kw">return</span> <span class="ruby-identifier">dir</span>
|
373
|
+
359: <span class="ruby-keyword kw">end</span>
|
374
374
|
</pre>
|
375
375
|
</div>
|
376
376
|
</div>
|
377
377
|
</div>
|
378
378
|
<div class="method">
|
379
379
|
<div class="title">
|
380
|
-
<a name="
|
380
|
+
<a name="M000082"></a><b>print_exception</b>(current_location, exception)
|
381
381
|
</div>
|
382
382
|
<div class="description">
|
383
383
|
<p>
|
@@ -389,23 +389,23 @@ currently at. Usually the current class name will be enough.
|
|
389
389
|
</p>
|
390
390
|
</div>
|
391
391
|
<div class="sourcecode">
|
392
|
-
<p class="source-link">[ <a href="javascript:toggleSource('
|
393
|
-
<div id="
|
392
|
+
<p class="source-link">[ <a href="javascript:toggleSource('M000082_source')" id="l_M000082_source">show source</a> ]</p>
|
393
|
+
<div id="M000082_source" class="dyn-source">
|
394
394
|
<pre>
|
395
|
-
<span class="ruby-comment cmt"># File lib/phusion_passenger/utils.rb, line
|
396
|
-
|
397
|
-
|
398
|
-
|
399
|
-
|
400
|
-
|
401
|
-
|
395
|
+
<span class="ruby-comment cmt"># File lib/phusion_passenger/utils.rb, line 157</span>
|
396
|
+
157: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">print_exception</span>(<span class="ruby-identifier">current_location</span>, <span class="ruby-identifier">exception</span>)
|
397
|
+
158: <span class="ruby-keyword kw">if</span> <span class="ruby-operator">!</span><span class="ruby-identifier">exception</span>.<span class="ruby-identifier">is_a?</span>(<span class="ruby-constant">SystemExit</span>)
|
398
|
+
159: <span class="ruby-constant">STDERR</span>.<span class="ruby-identifier">puts</span>(<span class="ruby-identifier">exception</span>.<span class="ruby-identifier">backtrace_string</span>(<span class="ruby-identifier">current_location</span>))
|
399
|
+
160: <span class="ruby-constant">STDERR</span>.<span class="ruby-identifier">flush</span>
|
400
|
+
161: <span class="ruby-keyword kw">end</span>
|
401
|
+
162: <span class="ruby-keyword kw">end</span>
|
402
402
|
</pre>
|
403
403
|
</div>
|
404
404
|
</div>
|
405
405
|
</div>
|
406
406
|
<div class="method">
|
407
407
|
<div class="title">
|
408
|
-
<a name="
|
408
|
+
<a name="M000084"></a><b>report_app_init_status</b>(channel) {|| ...}
|
409
409
|
</div>
|
410
410
|
<div class="description">
|
411
411
|
<p>
|
@@ -417,55 +417,55 @@ for SystemExit.
|
|
417
417
|
</p>
|
418
418
|
</div>
|
419
419
|
<div class="sourcecode">
|
420
|
-
<p class="source-link">[ <a href="javascript:toggleSource('
|
421
|
-
<div id="
|
420
|
+
<p class="source-link">[ <a href="javascript:toggleSource('M000084_source')" id="l_M000084_source">show source</a> ]</p>
|
421
|
+
<div id="M000084_source" class="dyn-source">
|
422
422
|
<pre>
|
423
|
-
<span class="ruby-comment cmt"># File lib/phusion_passenger/utils.rb, line
|
424
|
-
|
425
|
-
|
426
|
-
|
427
|
-
|
428
|
-
|
429
|
-
|
430
|
-
|
431
|
-
|
432
|
-
|
433
|
-
|
434
|
-
|
435
|
-
|
436
|
-
|
437
|
-
|
438
|
-
|
439
|
-
|
440
|
-
|
441
|
-
|
442
|
-
|
443
|
-
|
444
|
-
|
445
|
-
|
446
|
-
|
447
|
-
|
448
|
-
|
449
|
-
|
450
|
-
|
451
|
-
|
452
|
-
229: <span class="ruby-identifier">channel</span>.<span class="ruby-identifier">write_scalar</span>(<span class="ruby-identifier">marshal_exception</span>(<span class="ruby-identifier">e</span>))
|
453
|
-
230: <span class="ruby-identifier">channel</span>.<span class="ruby-identifier">write_scalar</span>(<span class="ruby-identifier">stderr_output</span>)
|
454
|
-
231: <span class="ruby-keyword kw">return</span> <span class="ruby-keyword kw">false</span>
|
455
|
-
232: <span class="ruby-keyword kw">rescue</span> <span class="ruby-constant">SystemExit</span> =<span class="ruby-operator">></span> <span class="ruby-identifier">e</span>
|
456
|
-
233: <span class="ruby-identifier">channel</span>.<span class="ruby-identifier">write</span>(<span class="ruby-value str">'exit'</span>)
|
423
|
+
<span class="ruby-comment cmt"># File lib/phusion_passenger/utils.rb, line 206</span>
|
424
|
+
206: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">report_app_init_status</span>(<span class="ruby-identifier">channel</span>)
|
425
|
+
207: <span class="ruby-keyword kw">begin</span>
|
426
|
+
208: <span class="ruby-identifier">old_global_stderr</span> = <span class="ruby-identifier">$stderr</span>
|
427
|
+
209: <span class="ruby-identifier">old_stderr</span> = <span class="ruby-constant">STDERR</span>
|
428
|
+
210: <span class="ruby-identifier">stderr_output</span> = <span class="ruby-value str">""</span>
|
429
|
+
211: <span class="ruby-identifier">tempfile</span> = <span class="ruby-constant">Tempfile</span>.<span class="ruby-identifier">new</span>(<span class="ruby-value str">'passenger-stderr'</span>)
|
430
|
+
212: <span class="ruby-identifier">tempfile</span>.<span class="ruby-identifier">unlink</span>
|
431
|
+
213: <span class="ruby-constant">Object</span>.<span class="ruby-identifier">send</span>(<span class="ruby-identifier">:remove_const</span>, <span class="ruby-value str">'STDERR'</span>) <span class="ruby-keyword kw">rescue</span> <span class="ruby-keyword kw">nil</span>
|
432
|
+
214: <span class="ruby-constant">Object</span>.<span class="ruby-identifier">const_set</span>(<span class="ruby-value str">'STDERR'</span>, <span class="ruby-identifier">tempfile</span>)
|
433
|
+
215: <span class="ruby-keyword kw">begin</span>
|
434
|
+
216: <span class="ruby-keyword kw">yield</span>
|
435
|
+
217: <span class="ruby-keyword kw">ensure</span>
|
436
|
+
218: <span class="ruby-constant">Object</span>.<span class="ruby-identifier">send</span>(<span class="ruby-identifier">:remove_const</span>, <span class="ruby-value str">'STDERR'</span>) <span class="ruby-keyword kw">rescue</span> <span class="ruby-keyword kw">nil</span>
|
437
|
+
219: <span class="ruby-constant">Object</span>.<span class="ruby-identifier">const_set</span>(<span class="ruby-value str">'STDERR'</span>, <span class="ruby-identifier">old_stderr</span>)
|
438
|
+
220: <span class="ruby-identifier">$stderr</span> = <span class="ruby-identifier">old_global_stderr</span>
|
439
|
+
221: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">tempfile</span>
|
440
|
+
222: <span class="ruby-identifier">tempfile</span>.<span class="ruby-identifier">rewind</span>
|
441
|
+
223: <span class="ruby-identifier">stderr_output</span> = <span class="ruby-identifier">tempfile</span>.<span class="ruby-identifier">read</span>
|
442
|
+
224: <span class="ruby-identifier">tempfile</span>.<span class="ruby-identifier">close</span> <span class="ruby-keyword kw">rescue</span> <span class="ruby-keyword kw">nil</span>
|
443
|
+
225: <span class="ruby-keyword kw">end</span>
|
444
|
+
226: <span class="ruby-keyword kw">end</span>
|
445
|
+
227: <span class="ruby-identifier">channel</span>.<span class="ruby-identifier">write</span>(<span class="ruby-value str">'success'</span>)
|
446
|
+
228: <span class="ruby-keyword kw">return</span> <span class="ruby-keyword kw">true</span>
|
447
|
+
229: <span class="ruby-keyword kw">rescue</span> <span class="ruby-constant">StandardError</span>, <span class="ruby-constant">ScriptError</span>, <span class="ruby-constant">NoMemoryError</span> =<span class="ruby-operator">></span> <span class="ruby-identifier">e</span>
|
448
|
+
230: <span class="ruby-keyword kw">if</span> <span class="ruby-constant">ENV</span>[<span class="ruby-value str">'TESTING_PASSENGER'</span>] <span class="ruby-operator">==</span> <span class="ruby-value str">'1'</span>
|
449
|
+
231: <span class="ruby-identifier">print_exception</span>(<span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">class</span>.<span class="ruby-identifier">to_s</span>, <span class="ruby-identifier">e</span>)
|
450
|
+
232: <span class="ruby-keyword kw">end</span>
|
451
|
+
233: <span class="ruby-identifier">channel</span>.<span class="ruby-identifier">write</span>(<span class="ruby-value str">'exception'</span>)
|
457
452
|
234: <span class="ruby-identifier">channel</span>.<span class="ruby-identifier">write_scalar</span>(<span class="ruby-identifier">marshal_exception</span>(<span class="ruby-identifier">e</span>))
|
458
453
|
235: <span class="ruby-identifier">channel</span>.<span class="ruby-identifier">write_scalar</span>(<span class="ruby-identifier">stderr_output</span>)
|
459
|
-
236: <span class="ruby-
|
460
|
-
237: <span class="ruby-keyword kw">
|
461
|
-
238:
|
454
|
+
236: <span class="ruby-keyword kw">return</span> <span class="ruby-keyword kw">false</span>
|
455
|
+
237: <span class="ruby-keyword kw">rescue</span> <span class="ruby-constant">SystemExit</span> =<span class="ruby-operator">></span> <span class="ruby-identifier">e</span>
|
456
|
+
238: <span class="ruby-identifier">channel</span>.<span class="ruby-identifier">write</span>(<span class="ruby-value str">'exit'</span>)
|
457
|
+
239: <span class="ruby-identifier">channel</span>.<span class="ruby-identifier">write_scalar</span>(<span class="ruby-identifier">marshal_exception</span>(<span class="ruby-identifier">e</span>))
|
458
|
+
240: <span class="ruby-identifier">channel</span>.<span class="ruby-identifier">write_scalar</span>(<span class="ruby-identifier">stderr_output</span>)
|
459
|
+
241: <span class="ruby-identifier">raise</span>
|
460
|
+
242: <span class="ruby-keyword kw">end</span>
|
461
|
+
243: <span class="ruby-keyword kw">end</span>
|
462
462
|
</pre>
|
463
463
|
</div>
|
464
464
|
</div>
|
465
465
|
</div>
|
466
466
|
<div class="method">
|
467
467
|
<div class="title">
|
468
|
-
<a name="
|
468
|
+
<a name="M000083"></a><b>safe_fork</b>(current_location = self.class, double_fork = false) {|| ...}
|
469
469
|
</div>
|
470
470
|
<div class="description">
|
471
471
|
<p>
|
@@ -484,122 +484,122 @@ the expense of not being able to waitpid() the second child.
|
|
484
484
|
</p>
|
485
485
|
</div>
|
486
486
|
<div class="sourcecode">
|
487
|
-
<p class="source-link">[ <a href="javascript:toggleSource('
|
488
|
-
<div id="
|
487
|
+
<p class="source-link">[ <a href="javascript:toggleSource('M000083_source')" id="l_M000083_source">show source</a> ]</p>
|
488
|
+
<div id="M000083_source" class="dyn-source">
|
489
489
|
<pre>
|
490
|
-
<span class="ruby-comment cmt"># File lib/phusion_passenger/utils.rb, line
|
491
|
-
|
492
|
-
|
493
|
-
|
494
|
-
|
495
|
-
|
496
|
-
|
497
|
-
|
498
|
-
|
499
|
-
|
500
|
-
|
501
|
-
|
502
|
-
|
503
|
-
|
504
|
-
|
505
|
-
|
506
|
-
|
507
|
-
|
508
|
-
|
509
|
-
|
510
|
-
|
511
|
-
|
512
|
-
|
513
|
-
|
514
|
-
|
515
|
-
|
516
|
-
|
490
|
+
<span class="ruby-comment cmt"># File lib/phusion_passenger/utils.rb, line 174</span>
|
491
|
+
174: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">safe_fork</span>(<span class="ruby-identifier">current_location</span> = <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">class</span>, <span class="ruby-identifier">double_fork</span> = <span class="ruby-keyword kw">false</span>)
|
492
|
+
175: <span class="ruby-identifier">pid</span> = <span class="ruby-identifier">fork</span>
|
493
|
+
176: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">pid</span>.<span class="ruby-identifier">nil?</span>
|
494
|
+
177: <span class="ruby-keyword kw">begin</span>
|
495
|
+
178: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">double_fork</span>
|
496
|
+
179: <span class="ruby-identifier">pid2</span> = <span class="ruby-identifier">fork</span>
|
497
|
+
180: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">pid2</span>.<span class="ruby-identifier">nil?</span>
|
498
|
+
181: <span class="ruby-keyword kw">yield</span>
|
499
|
+
182: <span class="ruby-keyword kw">end</span>
|
500
|
+
183: <span class="ruby-keyword kw">else</span>
|
501
|
+
184: <span class="ruby-keyword kw">yield</span>
|
502
|
+
185: <span class="ruby-keyword kw">end</span>
|
503
|
+
186: <span class="ruby-keyword kw">rescue</span> <span class="ruby-constant">Exception</span> =<span class="ruby-operator">></span> <span class="ruby-identifier">e</span>
|
504
|
+
187: <span class="ruby-identifier">print_exception</span>(<span class="ruby-identifier">current_location</span>.<span class="ruby-identifier">to_s</span>, <span class="ruby-identifier">e</span>)
|
505
|
+
188: <span class="ruby-keyword kw">ensure</span>
|
506
|
+
189: <span class="ruby-identifier">exit!</span>
|
507
|
+
190: <span class="ruby-keyword kw">end</span>
|
508
|
+
191: <span class="ruby-keyword kw">else</span>
|
509
|
+
192: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">double_fork</span>
|
510
|
+
193: <span class="ruby-constant">Process</span>.<span class="ruby-identifier">waitpid</span>(<span class="ruby-identifier">pid</span>) <span class="ruby-keyword kw">rescue</span> <span class="ruby-keyword kw">nil</span>
|
511
|
+
194: <span class="ruby-keyword kw">return</span> <span class="ruby-identifier">pid</span>
|
512
|
+
195: <span class="ruby-keyword kw">else</span>
|
513
|
+
196: <span class="ruby-keyword kw">return</span> <span class="ruby-identifier">pid</span>
|
514
|
+
197: <span class="ruby-keyword kw">end</span>
|
515
|
+
198: <span class="ruby-keyword kw">end</span>
|
516
|
+
199: <span class="ruby-keyword kw">end</span>
|
517
517
|
</pre>
|
518
518
|
</div>
|
519
519
|
</div>
|
520
520
|
</div>
|
521
521
|
<div class="method">
|
522
522
|
<div class="title">
|
523
|
-
<a name="
|
523
|
+
<a name="M000088"></a><b>sanitize_spawn_options</b>(options)
|
524
524
|
</div>
|
525
525
|
<div class="sourcecode">
|
526
|
-
<p class="source-link">[ <a href="javascript:toggleSource('
|
527
|
-
<div id="
|
526
|
+
<p class="source-link">[ <a href="javascript:toggleSource('M000088_source')" id="l_M000088_source">show source</a> ]</p>
|
527
|
+
<div id="M000088_source" class="dyn-source">
|
528
528
|
<pre>
|
529
|
-
<span class="ruby-comment cmt"># File lib/phusion_passenger/utils.rb, line
|
530
|
-
|
531
|
-
|
532
|
-
|
533
|
-
|
534
|
-
|
535
|
-
|
536
|
-
|
537
|
-
|
538
|
-
|
539
|
-
|
540
|
-
|
541
|
-
|
542
|
-
|
543
|
-
|
544
|
-
|
545
|
-
|
529
|
+
<span class="ruby-comment cmt"># File lib/phusion_passenger/utils.rb, line 323</span>
|
530
|
+
323: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">sanitize_spawn_options</span>(<span class="ruby-identifier">options</span>)
|
531
|
+
324: <span class="ruby-identifier">defaults</span> = {
|
532
|
+
325: <span class="ruby-value str">"lower_privilege"</span> =<span class="ruby-operator">></span> <span class="ruby-keyword kw">true</span>,
|
533
|
+
326: <span class="ruby-value str">"lowest_user"</span> =<span class="ruby-operator">></span> <span class="ruby-value str">"nobody"</span>,
|
534
|
+
327: <span class="ruby-value str">"environment"</span> =<span class="ruby-operator">></span> <span class="ruby-value str">"production"</span>,
|
535
|
+
328: <span class="ruby-value str">"app_type"</span> =<span class="ruby-operator">></span> <span class="ruby-value str">"rails"</span>,
|
536
|
+
329: <span class="ruby-value str">"spawn_method"</span> =<span class="ruby-operator">></span> <span class="ruby-value str">"smart-lv2"</span>,
|
537
|
+
330: <span class="ruby-value str">"framework_spawner_timeout"</span> =<span class="ruby-operator">></span> <span class="ruby-value">-1</span>,
|
538
|
+
331: <span class="ruby-value str">"app_spawner_timeout"</span> =<span class="ruby-operator">></span> <span class="ruby-value">-1</span>
|
539
|
+
332: }
|
540
|
+
333: <span class="ruby-identifier">options</span> = <span class="ruby-identifier">defaults</span>.<span class="ruby-identifier">merge</span>(<span class="ruby-identifier">options</span>)
|
541
|
+
334: <span class="ruby-identifier">options</span>[<span class="ruby-value str">"lower_privilege"</span>] = <span class="ruby-identifier">options</span>[<span class="ruby-value str">"lower_privilege"</span>].<span class="ruby-identifier">to_s</span> <span class="ruby-operator">==</span> <span class="ruby-value str">"true"</span>
|
542
|
+
335: <span class="ruby-identifier">options</span>[<span class="ruby-value str">"framework_spawner_timeout"</span>] = <span class="ruby-identifier">options</span>[<span class="ruby-value str">"framework_spawner_timeout"</span>].<span class="ruby-identifier">to_i</span>
|
543
|
+
336: <span class="ruby-identifier">options</span>[<span class="ruby-value str">"app_spawner_timeout"</span>] = <span class="ruby-identifier">options</span>[<span class="ruby-value str">"app_spawner_timeout"</span>].<span class="ruby-identifier">to_i</span>
|
544
|
+
337: <span class="ruby-keyword kw">return</span> <span class="ruby-identifier">options</span>
|
545
|
+
338: <span class="ruby-keyword kw">end</span>
|
546
546
|
</pre>
|
547
547
|
</div>
|
548
548
|
</div>
|
549
549
|
</div>
|
550
550
|
<div class="method">
|
551
551
|
<div class="title">
|
552
|
-
<a name="
|
552
|
+
<a name="M000087"></a><b>switch_to_user</b>(user)
|
553
553
|
</div>
|
554
554
|
<div class="sourcecode">
|
555
|
-
<p class="source-link">[ <a href="javascript:toggleSource('
|
556
|
-
<div id="
|
555
|
+
<p class="source-link">[ <a href="javascript:toggleSource('M000087_source')" id="l_M000087_source">show source</a> ]</p>
|
556
|
+
<div id="M000087_source" class="dyn-source">
|
557
557
|
<pre>
|
558
|
-
<span class="ruby-comment cmt"># File lib/phusion_passenger/utils.rb, line
|
559
|
-
|
560
|
-
|
561
|
-
|
562
|
-
|
563
|
-
|
564
|
-
|
565
|
-
291: <span class="ruby-identifier">gid</span> = <span class="ruby-identifier">pw</span>.<span class="ruby-identifier">gid</span>
|
566
|
-
292: <span class="ruby-keyword kw">else</span>
|
567
|
-
293: <span class="ruby-identifier">pw</span> = <span class="ruby-constant">Etc</span>.<span class="ruby-identifier">getpwuid</span>(<span class="ruby-identifier">user</span>)
|
568
|
-
294: <span class="ruby-identifier">username</span> = <span class="ruby-identifier">pw</span>.<span class="ruby-identifier">name</span>
|
569
|
-
295: <span class="ruby-identifier">uid</span> = <span class="ruby-identifier">user</span>
|
558
|
+
<span class="ruby-comment cmt"># File lib/phusion_passenger/utils.rb, line 290</span>
|
559
|
+
290: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">switch_to_user</span>(<span class="ruby-identifier">user</span>)
|
560
|
+
291: <span class="ruby-keyword kw">begin</span>
|
561
|
+
292: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">user</span>.<span class="ruby-identifier">is_a?</span>(<span class="ruby-constant">String</span>)
|
562
|
+
293: <span class="ruby-identifier">pw</span> = <span class="ruby-constant">Etc</span>.<span class="ruby-identifier">getpwnam</span>(<span class="ruby-identifier">user</span>)
|
563
|
+
294: <span class="ruby-identifier">username</span> = <span class="ruby-identifier">user</span>
|
564
|
+
295: <span class="ruby-identifier">uid</span> = <span class="ruby-identifier">pw</span>.<span class="ruby-identifier">uid</span>
|
570
565
|
296: <span class="ruby-identifier">gid</span> = <span class="ruby-identifier">pw</span>.<span class="ruby-identifier">gid</span>
|
571
|
-
297: <span class="ruby-keyword kw">
|
572
|
-
298:
|
573
|
-
299:
|
574
|
-
300:
|
575
|
-
301:
|
576
|
-
302: <span class="ruby-keyword kw">
|
577
|
-
303: <span class="ruby-keyword kw">
|
578
|
-
304: <span class="ruby-
|
579
|
-
305:
|
580
|
-
306:
|
581
|
-
307: <span class="ruby-keyword kw">
|
582
|
-
308:
|
583
|
-
309: <span class="ruby-
|
584
|
-
310: <span class="ruby-
|
585
|
-
311: <span class="ruby-
|
586
|
-
312: <span class="ruby-
|
587
|
-
313:
|
588
|
-
314: <span class="ruby-keyword kw">
|
589
|
-
315:
|
590
|
-
316:
|
566
|
+
297: <span class="ruby-keyword kw">else</span>
|
567
|
+
298: <span class="ruby-identifier">pw</span> = <span class="ruby-constant">Etc</span>.<span class="ruby-identifier">getpwuid</span>(<span class="ruby-identifier">user</span>)
|
568
|
+
299: <span class="ruby-identifier">username</span> = <span class="ruby-identifier">pw</span>.<span class="ruby-identifier">name</span>
|
569
|
+
300: <span class="ruby-identifier">uid</span> = <span class="ruby-identifier">user</span>
|
570
|
+
301: <span class="ruby-identifier">gid</span> = <span class="ruby-identifier">pw</span>.<span class="ruby-identifier">gid</span>
|
571
|
+
302: <span class="ruby-keyword kw">end</span>
|
572
|
+
303: <span class="ruby-keyword kw">rescue</span>
|
573
|
+
304: <span class="ruby-keyword kw">return</span> <span class="ruby-keyword kw">false</span>
|
574
|
+
305: <span class="ruby-keyword kw">end</span>
|
575
|
+
306: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">uid</span> <span class="ruby-operator">==</span> <span class="ruby-value">0</span>
|
576
|
+
307: <span class="ruby-keyword kw">return</span> <span class="ruby-keyword kw">false</span>
|
577
|
+
308: <span class="ruby-keyword kw">else</span>
|
578
|
+
309: <span class="ruby-comment cmt"># Some systems are broken. initgroups can fail because of</span>
|
579
|
+
310: <span class="ruby-comment cmt"># all kinds of stupid reasons. So we ignore any errors</span>
|
580
|
+
311: <span class="ruby-comment cmt"># raised by initgroups.</span>
|
581
|
+
312: <span class="ruby-keyword kw">begin</span>
|
582
|
+
313: <span class="ruby-constant">Process</span>.<span class="ruby-identifier">groups</span> = <span class="ruby-constant">Process</span>.<span class="ruby-identifier">initgroups</span>(<span class="ruby-identifier">username</span>, <span class="ruby-identifier">gid</span>)
|
583
|
+
314: <span class="ruby-keyword kw">rescue</span>
|
584
|
+
315: <span class="ruby-keyword kw">end</span>
|
585
|
+
316: <span class="ruby-constant">Process</span><span class="ruby-operator">::</span><span class="ruby-constant">Sys</span>.<span class="ruby-identifier">setgid</span>(<span class="ruby-identifier">gid</span>)
|
586
|
+
317: <span class="ruby-constant">Process</span><span class="ruby-operator">::</span><span class="ruby-constant">Sys</span>.<span class="ruby-identifier">setuid</span>(<span class="ruby-identifier">uid</span>)
|
587
|
+
318: <span class="ruby-constant">ENV</span>[<span class="ruby-value str">'HOME'</span>] = <span class="ruby-identifier">pw</span>.<span class="ruby-identifier">dir</span>
|
588
|
+
319: <span class="ruby-keyword kw">return</span> <span class="ruby-keyword kw">true</span>
|
589
|
+
320: <span class="ruby-keyword kw">end</span>
|
590
|
+
321: <span class="ruby-keyword kw">end</span>
|
591
591
|
</pre>
|
592
592
|
</div>
|
593
593
|
</div>
|
594
594
|
</div>
|
595
595
|
<div class="method">
|
596
596
|
<div class="title">
|
597
|
-
<a name="
|
597
|
+
<a name="M000085"></a><b>unmarshal_and_raise_errors</b>(channel, app_type = "rails")
|
598
598
|
</div>
|
599
599
|
<div class="description">
|
600
600
|
<p>
|
601
601
|
Receive status information that was sent to <tt>channel</tt> by <a
|
602
|
-
href="Utils.html#
|
602
|
+
href="Utils.html#M000084">report_app_init_status</a>. If an error occured
|
603
603
|
according to the received information, then an appropriate exception will
|
604
604
|
be raised.
|
605
605
|
</p>
|
@@ -616,72 +616,72 @@ Raises:
|
|
616
616
|
</ul>
|
617
617
|
</div>
|
618
618
|
<div class="sourcecode">
|
619
|
-
<p class="source-link">[ <a href="javascript:toggleSource('
|
620
|
-
<div id="
|
619
|
+
<p class="source-link">[ <a href="javascript:toggleSource('M000085_source')" id="l_M000085_source">show source</a> ]</p>
|
620
|
+
<div id="M000085_source" class="dyn-source">
|
621
621
|
<pre>
|
622
|
-
<span class="ruby-comment cmt"># File lib/phusion_passenger/utils.rb, line
|
623
|
-
|
624
|
-
|
625
|
-
|
626
|
-
|
627
|
-
|
628
|
-
|
629
|
-
|
630
|
-
|
631
|
-
|
632
|
-
|
633
|
-
|
634
|
-
|
635
|
-
|
636
|
-
|
637
|
-
|
638
|
-
|
639
|
-
|
640
|
-
|
641
|
-
|
642
|
-
|
643
|
-
|
644
|
-
|
645
|
-
|
622
|
+
<span class="ruby-comment cmt"># File lib/phusion_passenger/utils.rb, line 253</span>
|
623
|
+
253: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">unmarshal_and_raise_errors</span>(<span class="ruby-identifier">channel</span>, <span class="ruby-identifier">app_type</span> = <span class="ruby-value str">"rails"</span>)
|
624
|
+
254: <span class="ruby-identifier">args</span> = <span class="ruby-identifier">channel</span>.<span class="ruby-identifier">read</span>
|
625
|
+
255: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">args</span>.<span class="ruby-identifier">nil?</span>
|
626
|
+
256: <span class="ruby-identifier">raise</span> <span class="ruby-constant">EOFError</span>, <span class="ruby-value str">"Unexpected end-of-file detected."</span>
|
627
|
+
257: <span class="ruby-keyword kw">end</span>
|
628
|
+
258: <span class="ruby-identifier">status</span> = <span class="ruby-identifier">args</span>[<span class="ruby-value">0</span>]
|
629
|
+
259: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">status</span> <span class="ruby-operator">==</span> <span class="ruby-value str">'exception'</span>
|
630
|
+
260: <span class="ruby-identifier">child_exception</span> = <span class="ruby-identifier">unmarshal_exception</span>(<span class="ruby-identifier">channel</span>.<span class="ruby-identifier">read_scalar</span>)
|
631
|
+
261: <span class="ruby-identifier">stderr</span> = <span class="ruby-identifier">channel</span>.<span class="ruby-identifier">read_scalar</span>
|
632
|
+
262: <span class="ruby-comment cmt">#print_exception(self.class.to_s, child_exception)</span>
|
633
|
+
263: <span class="ruby-identifier">raise</span> <span class="ruby-constant">AppInitError</span>.<span class="ruby-identifier">new</span>(
|
634
|
+
264: <span class="ruby-node">"Application '#{@app_root}' raised an exception: "</span> <span class="ruby-operator"><<</span>
|
635
|
+
265: <span class="ruby-node">"#{child_exception.class} (#{child_exception.message})"</span>,
|
636
|
+
266: <span class="ruby-identifier">child_exception</span>,
|
637
|
+
267: <span class="ruby-identifier">app_type</span>,
|
638
|
+
268: <span class="ruby-identifier">stderr</span>.<span class="ruby-identifier">empty?</span> <span class="ruby-value">? </span><span class="ruby-keyword kw">nil</span> <span class="ruby-operator">:</span> <span class="ruby-identifier">stderr</span>)
|
639
|
+
269: <span class="ruby-keyword kw">elsif</span> <span class="ruby-identifier">status</span> <span class="ruby-operator">==</span> <span class="ruby-value str">'exit'</span>
|
640
|
+
270: <span class="ruby-identifier">child_exception</span> = <span class="ruby-identifier">unmarshal_exception</span>(<span class="ruby-identifier">channel</span>.<span class="ruby-identifier">read_scalar</span>)
|
641
|
+
271: <span class="ruby-identifier">stderr</span> = <span class="ruby-identifier">channel</span>.<span class="ruby-identifier">read_scalar</span>
|
642
|
+
272: <span class="ruby-identifier">raise</span> <span class="ruby-constant">AppInitError</span>.<span class="ruby-identifier">new</span>(<span class="ruby-node">"Application '#{@app_root}' exited during startup"</span>,
|
643
|
+
273: <span class="ruby-identifier">child_exception</span>, <span class="ruby-identifier">app_type</span>, <span class="ruby-identifier">stderr</span>.<span class="ruby-identifier">empty?</span> <span class="ruby-value">? </span><span class="ruby-keyword kw">nil</span> <span class="ruby-operator">:</span> <span class="ruby-identifier">stderr</span>)
|
644
|
+
274: <span class="ruby-keyword kw">end</span>
|
645
|
+
275: <span class="ruby-keyword kw">end</span>
|
646
646
|
</pre>
|
647
647
|
</div>
|
648
648
|
</div>
|
649
649
|
</div>
|
650
650
|
<div class="method">
|
651
651
|
<div class="title">
|
652
|
-
<a name="
|
652
|
+
<a name="M000081"></a><b>unmarshal_exception</b>(data)
|
653
653
|
</div>
|
654
654
|
<div class="sourcecode">
|
655
|
-
<p class="source-link">[ <a href="javascript:toggleSource('
|
656
|
-
<div id="
|
655
|
+
<p class="source-link">[ <a href="javascript:toggleSource('M000081_source')" id="l_M000081_source">show source</a> ]</p>
|
656
|
+
<div id="M000081_source" class="dyn-source">
|
657
657
|
<pre>
|
658
|
-
<span class="ruby-comment cmt"># File lib/phusion_passenger/utils.rb, line
|
659
|
-
|
660
|
-
|
661
|
-
|
662
|
-
|
663
|
-
|
664
|
-
|
665
|
-
|
666
|
-
|
667
|
-
|
668
|
-
|
669
|
-
|
670
|
-
|
671
|
-
|
672
|
-
|
673
|
-
|
674
|
-
|
675
|
-
|
676
|
-
|
677
|
-
|
678
|
-
|
679
|
-
|
680
|
-
|
681
|
-
|
682
|
-
|
683
|
-
|
684
|
-
|
658
|
+
<span class="ruby-comment cmt"># File lib/phusion_passenger/utils.rb, line 126</span>
|
659
|
+
126: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">unmarshal_exception</span>(<span class="ruby-identifier">data</span>)
|
660
|
+
127: <span class="ruby-identifier">hash</span> = <span class="ruby-constant">Marshal</span>.<span class="ruby-identifier">load</span>(<span class="ruby-identifier">data</span>)
|
661
|
+
128: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">hash</span>[<span class="ruby-identifier">:is_initialization_error</span>]
|
662
|
+
129: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">hash</span>[<span class="ruby-identifier">:child_exception</span>]
|
663
|
+
130: <span class="ruby-identifier">child_exception</span> = <span class="ruby-identifier">unmarshal_exception</span>(<span class="ruby-identifier">hash</span>[<span class="ruby-identifier">:child_exception</span>])
|
664
|
+
131: <span class="ruby-keyword kw">else</span>
|
665
|
+
132: <span class="ruby-identifier">child_exception</span> = <span class="ruby-keyword kw">nil</span>
|
666
|
+
133: <span class="ruby-keyword kw">end</span>
|
667
|
+
134:
|
668
|
+
135: <span class="ruby-keyword kw">case</span> <span class="ruby-identifier">hash</span>[<span class="ruby-identifier">:class</span>]
|
669
|
+
136: <span class="ruby-keyword kw">when</span> <span class="ruby-constant">AppInitError</span>.<span class="ruby-identifier">to_s</span>
|
670
|
+
137: <span class="ruby-identifier">exception_class</span> = <span class="ruby-constant">AppInitError</span>
|
671
|
+
138: <span class="ruby-keyword kw">when</span> <span class="ruby-constant">FrameworkInitError</span>.<span class="ruby-identifier">to_s</span>
|
672
|
+
139: <span class="ruby-identifier">exception_class</span> = <span class="ruby-constant">FrameworkInitError</span>
|
673
|
+
140: <span class="ruby-keyword kw">else</span>
|
674
|
+
141: <span class="ruby-identifier">exception_class</span> = <span class="ruby-constant">InitializationError</span>
|
675
|
+
142: <span class="ruby-keyword kw">end</span>
|
676
|
+
143: <span class="ruby-keyword kw">return</span> <span class="ruby-identifier">exception_class</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">hash</span>[<span class="ruby-identifier">:message</span>], <span class="ruby-identifier">child_exception</span>)
|
677
|
+
144: <span class="ruby-keyword kw">else</span>
|
678
|
+
145: <span class="ruby-keyword kw">begin</span>
|
679
|
+
146: <span class="ruby-keyword kw">return</span> <span class="ruby-constant">Marshal</span>.<span class="ruby-identifier">load</span>(<span class="ruby-identifier">hash</span>[<span class="ruby-identifier">:exception</span>])
|
680
|
+
147: <span class="ruby-keyword kw">rescue</span> <span class="ruby-constant">ArgumentError</span>, <span class="ruby-constant">TypeError</span>
|
681
|
+
148: <span class="ruby-keyword kw">return</span> <span class="ruby-constant">UnknownError</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">hash</span>[<span class="ruby-identifier">:message</span>], <span class="ruby-identifier">hash</span>[<span class="ruby-identifier">:class</span>], <span class="ruby-identifier">hash</span>[<span class="ruby-identifier">:backtrace</span>])
|
682
|
+
149: <span class="ruby-keyword kw">end</span>
|
683
|
+
150: <span class="ruby-keyword kw">end</span>
|
684
|
+
151: <span class="ruby-keyword kw">end</span>
|
685
685
|
</pre>
|
686
686
|
</div>
|
687
687
|
</div>
|