passenger 2.2.2 → 2.2.3
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 +13 -3
- data/Rakefile +42 -33
- data/bin/passenger-install-apache2-module +1 -2
- data/bin/passenger-install-nginx-module +7 -19
- data/bin/passenger-status +64 -15
- data/bin/passenger-stress-test +2 -2
- data/doc/ApplicationPool algorithm.txt +26 -22
- data/doc/Users guide Apache.html +374 -149
- data/doc/Users guide Apache.txt +318 -51
- data/doc/Users guide Nginx.html +13 -13
- data/doc/Users guide Nginx.txt +7 -2
- data/doc/cxxapi/Bucket_8h-source.html +62 -25
- data/doc/cxxapi/Configuration_8h-source.html +343 -326
- data/doc/cxxapi/DirectoryMapper_8h-source.html +12 -12
- data/doc/cxxapi/Hooks_8h-source.html +1 -1
- data/doc/cxxapi/annotated.html +1 -1
- data/doc/cxxapi/classHooks-members.html +1 -1
- data/doc/cxxapi/classHooks.html +1 -1
- data/doc/cxxapi/classPassenger_1_1DirectoryMapper-members.html +2 -2
- data/doc/cxxapi/classPassenger_1_1DirectoryMapper.html +9 -9
- data/doc/cxxapi/classes.html +1 -1
- data/doc/cxxapi/definitions_8h-source.html +1 -1
- data/doc/cxxapi/files.html +1 -1
- data/doc/cxxapi/functions.html +2 -2
- data/doc/cxxapi/functions_func.html +2 -2
- data/doc/cxxapi/graph_legend.html +1 -1
- data/doc/cxxapi/group__Configuration.html +1 -1
- data/doc/cxxapi/group__Core.html +1 -1
- data/doc/cxxapi/group__Hooks.html +1 -1
- data/doc/cxxapi/group__Support.html +1 -1
- data/doc/cxxapi/main.html +1 -1
- data/doc/cxxapi/modules.html +1 -1
- data/doc/rdoc/classes/ConditionVariable.html +194 -0
- data/doc/rdoc/classes/Exception.html +120 -0
- data/doc/rdoc/classes/GC.html +113 -0
- data/doc/rdoc/classes/IO.html +169 -0
- data/doc/rdoc/classes/PhusionPassenger.html +238 -0
- data/doc/rdoc/classes/PhusionPassenger/AbstractInstaller.html +153 -0
- data/doc/rdoc/classes/PhusionPassenger/AbstractRequestHandler.html +517 -0
- data/doc/rdoc/classes/PhusionPassenger/AbstractServer.html +719 -0
- data/doc/rdoc/classes/PhusionPassenger/AbstractServer/ServerAlreadyStarted.html +97 -0
- data/doc/rdoc/classes/PhusionPassenger/AbstractServer/ServerError.html +96 -0
- data/doc/rdoc/classes/PhusionPassenger/AbstractServer/ServerNotStarted.html +97 -0
- data/doc/rdoc/classes/PhusionPassenger/AbstractServer/UnknownMessage.html +96 -0
- data/doc/rdoc/classes/PhusionPassenger/AbstractServerCollection.html +598 -0
- data/doc/rdoc/classes/PhusionPassenger/AdminTools.html +140 -0
- data/doc/rdoc/classes/PhusionPassenger/AdminTools/ControlProcess.html +317 -0
- data/doc/rdoc/classes/PhusionPassenger/AdminTools/ControlProcess/Instance.html +138 -0
- data/doc/rdoc/classes/PhusionPassenger/AppInitError.html +154 -0
- data/doc/rdoc/classes/PhusionPassenger/Application.html +283 -0
- data/doc/rdoc/classes/PhusionPassenger/ConsoleTextTemplate.html +172 -0
- data/doc/rdoc/classes/PhusionPassenger/FrameworkInitError.html +145 -0
- data/doc/rdoc/classes/PhusionPassenger/HTMLTemplate.html +175 -0
- data/doc/rdoc/classes/PhusionPassenger/InitializationError.html +141 -0
- data/doc/rdoc/classes/PhusionPassenger/InvalidPath.html +92 -0
- data/doc/rdoc/classes/PhusionPassenger/MessageChannel.html +489 -0
- data/doc/rdoc/classes/PhusionPassenger/NativeSupport.html +350 -0
- data/doc/rdoc/classes/PhusionPassenger/Rack.html +91 -0
- data/doc/rdoc/classes/PhusionPassenger/Rack/ApplicationSpawner.html +188 -0
- data/doc/rdoc/classes/PhusionPassenger/Rack/RequestHandler.html +194 -0
- data/doc/rdoc/classes/PhusionPassenger/Railz.html +95 -0
- data/doc/rdoc/classes/PhusionPassenger/Railz/ApplicationSpawner.html +442 -0
- data/doc/rdoc/classes/PhusionPassenger/Railz/ApplicationSpawner/Error.html +98 -0
- data/doc/rdoc/classes/PhusionPassenger/Railz/CGIFixed.html +200 -0
- data/doc/rdoc/classes/PhusionPassenger/Railz/FrameworkSpawner.html +436 -0
- data/doc/rdoc/classes/PhusionPassenger/Railz/FrameworkSpawner/Error.html +98 -0
- data/doc/rdoc/classes/PhusionPassenger/Railz/RequestHandler.html +155 -0
- data/doc/rdoc/classes/PhusionPassenger/SpawnManager.html +402 -0
- data/doc/rdoc/classes/PhusionPassenger/UnknownError.html +125 -0
- data/doc/rdoc/classes/PhusionPassenger/Utils.html +805 -0
- data/doc/rdoc/classes/PhusionPassenger/VersionNotFound.html +140 -0
- data/doc/rdoc/classes/PhusionPassenger/WSGI.html +89 -0
- data/doc/rdoc/classes/PhusionPassenger/WSGI/ApplicationSpawner.html +188 -0
- data/doc/rdoc/classes/PlatformInfo.html +831 -0
- data/doc/rdoc/classes/RakeExtensions.html +197 -0
- data/doc/rdoc/classes/Signal.html +131 -0
- data/doc/rdoc/created.rid +1 -0
- data/doc/rdoc/files/DEVELOPERS_TXT.html +255 -0
- data/doc/rdoc/files/README.html +157 -0
- data/doc/rdoc/files/ext/phusion_passenger/native_support_c.html +92 -0
- data/doc/rdoc/files/lib/phusion_passenger/abstract_installer_rb.html +129 -0
- data/doc/rdoc/files/lib/phusion_passenger/abstract_request_handler_rb.html +131 -0
- data/doc/rdoc/files/lib/phusion_passenger/abstract_server_collection_rb.html +126 -0
- data/doc/rdoc/files/lib/phusion_passenger/abstract_server_rb.html +130 -0
- data/doc/rdoc/files/lib/phusion_passenger/admin_tools/control_process_rb.html +130 -0
- data/doc/rdoc/files/lib/phusion_passenger/admin_tools_rb.html +122 -0
- data/doc/rdoc/files/lib/phusion_passenger/application_rb.html +127 -0
- data/doc/rdoc/files/lib/phusion_passenger/console_text_template_rb.html +126 -0
- data/doc/rdoc/files/lib/phusion_passenger/constants_rb.html +122 -0
- data/doc/rdoc/files/lib/phusion_passenger/dependencies_rb.html +134 -0
- data/doc/rdoc/files/lib/phusion_passenger/events_rb.html +122 -0
- data/doc/rdoc/files/lib/phusion_passenger/exceptions_rb.html +122 -0
- data/doc/rdoc/files/lib/phusion_passenger/html_template_rb.html +126 -0
- data/doc/rdoc/files/lib/phusion_passenger/message_channel_rb.html +122 -0
- data/doc/rdoc/files/lib/phusion_passenger/packaging_rb.html +122 -0
- data/doc/rdoc/files/lib/phusion_passenger/platform_info_rb.html +127 -0
- data/doc/rdoc/files/lib/phusion_passenger/rack/application_spawner_rb.html +133 -0
- data/doc/rdoc/files/lib/phusion_passenger/rack/request_handler_rb.html +127 -0
- data/doc/rdoc/files/lib/phusion_passenger/railz/application_spawner_rb.html +143 -0
- data/doc/rdoc/files/lib/phusion_passenger/railz/cgi_fixed_rb.html +126 -0
- data/doc/rdoc/files/lib/phusion_passenger/railz/framework_spawner_rb.html +145 -0
- data/doc/rdoc/files/lib/phusion_passenger/railz/request_handler_rb.html +127 -0
- data/doc/rdoc/files/lib/phusion_passenger/simple_benchmarking_rb.html +122 -0
- data/doc/rdoc/files/lib/phusion_passenger/spawn_manager_rb.html +161 -0
- data/doc/rdoc/files/lib/phusion_passenger/utils_rb.html +175 -0
- data/doc/rdoc/files/lib/phusion_passenger/wsgi/application_spawner_rb.html +129 -0
- data/doc/rdoc/files/misc/rake/extensions_rb.html +130 -0
- data/doc/rdoc/fr_class_index.html +90 -0
- data/doc/rdoc/fr_file_index.html +76 -0
- data/doc/rdoc/fr_method_index.html +200 -0
- data/doc/rdoc/index.html +26 -0
- data/doc/rdoc/rdoc-style.css +187 -0
- data/doc/users_guide_snippets/rackup_specifications.txt +2 -8
- data/ext/apache2/Bucket.cpp +71 -38
- data/ext/apache2/Bucket.h +53 -16
- data/ext/apache2/Configuration.cpp +15 -0
- data/ext/apache2/Configuration.h +19 -2
- data/ext/apache2/DirectoryMapper.h +10 -10
- data/ext/apache2/Hooks.cpp +334 -74
- data/ext/boost/mpl/apply.hpp +5 -1
- data/ext/boost/mpl/apply_wrap.hpp +5 -2
- data/ext/boost/mpl/aux_/full_lambda.hpp +5 -1
- data/ext/boost/mpl/bind.hpp +5 -1
- data/ext/common/Application.h +11 -31
- data/ext/common/ApplicationPool.h +2 -1
- data/ext/common/ApplicationPoolServer.h +61 -20
- data/ext/common/ApplicationPoolServerExecutable.cpp +132 -4
- data/ext/common/ApplicationPoolStatusReporter.h +189 -65
- data/ext/common/Base64.cpp +143 -0
- data/ext/common/Base64.h +57 -0
- data/ext/common/CachedFileStat.cpp +25 -82
- data/ext/common/CachedFileStat.h +11 -125
- data/ext/common/CachedFileStat.hpp +243 -0
- data/ext/common/Exceptions.h +13 -0
- data/ext/common/FileChangeChecker.h +209 -0
- data/ext/common/Logging.h +3 -2
- data/ext/common/MessageChannel.h +10 -10
- data/ext/common/PoolOptions.h +72 -5
- data/ext/common/SpawnManager.h +11 -8
- data/ext/common/StandardApplicationPool.h +38 -39
- data/ext/common/StaticString.h +1 -0
- data/ext/common/StringListCreator.h +83 -0
- data/ext/common/SystemTime.h +3 -2
- data/ext/common/Timer.h +88 -0
- data/ext/common/Utils.cpp +161 -42
- data/ext/common/Utils.h +62 -31
- data/ext/common/Version.h +1 -1
- data/ext/nginx/Configuration.c +0 -4
- data/ext/nginx/ContentHandler.c +8 -6
- data/ext/nginx/HelperServer.cpp +45 -55
- data/ext/nginx/HttpStatusExtractor.h +4 -0
- data/ext/nginx/StaticContentHandler.c +25 -5
- data/ext/nginx/config +3 -0
- data/ext/nginx/ngx_http_passenger_module.c +72 -17
- data/ext/nginx/ngx_http_passenger_module.h +2 -2
- data/lib/phusion_passenger/abstract_request_handler.rb +15 -7
- data/lib/phusion_passenger/abstract_server.rb +16 -2
- data/lib/phusion_passenger/admin_tools/control_process.rb +36 -25
- data/lib/phusion_passenger/constants.rb +1 -1
- data/lib/phusion_passenger/dependencies.rb +10 -0
- data/lib/phusion_passenger/platform_info.rb +1 -1
- data/lib/phusion_passenger/rack/application_spawner.rb +21 -2
- data/lib/phusion_passenger/rack/request_handler.rb +10 -0
- data/lib/phusion_passenger/railz/application_spawner.rb +38 -2
- data/lib/phusion_passenger/railz/framework_spawner.rb +26 -28
- data/lib/phusion_passenger/railz/request_handler.rb +5 -1
- data/lib/phusion_passenger/spawn_manager.rb +6 -2
- data/lib/phusion_passenger/utils.rb +79 -27
- data/misc/rake/cplusplus.rb +5 -5
- data/test/ApplicationPoolServerTest.cpp +42 -0
- data/test/ApplicationPoolTest.cpp +255 -267
- data/test/Base64Test.cpp +48 -0
- data/test/CachedFileStatTest.cpp +243 -103
- data/test/FileChangeCheckerTest.cpp +331 -0
- data/test/PoolOptionsTest.cpp +80 -0
- data/test/UtilsTest.cpp +5 -17
- data/test/integration_tests/apache2_tests.rb +15 -4
- data/test/integration_tests/mycook_spec.rb +3 -4
- data/test/oxt/syscall_interruption_test.cpp +2 -14
- data/test/ruby/abstract_server_collection_spec.rb +1 -1
- data/test/ruby/abstract_server_spec.rb +35 -1
- data/test/ruby/rack/application_spawner_spec.rb +23 -6
- data/test/ruby/rails/application_spawner_spec.rb +6 -6
- data/test/ruby/rails/framework_spawner_spec.rb +6 -5
- data/test/ruby/rails/minimal_spawner_spec.rb +19 -0
- data/test/ruby/rails/spawner_error_handling_spec.rb +62 -7
- data/test/ruby/spawn_manager_spec.rb +10 -7
- data/test/ruby/spawn_server_spec.rb +1 -1
- data/test/ruby/utils_spec.rb +193 -20
- data/test/ruby/wsgi/application_spawner_spec.rb +3 -1
- data/test/stub/apache2/httpd.conf.erb +3 -0
- data/test/stub/rack/config.ru +1 -1
- data/test/stub/rails_apps/mycook/app/controllers/welcome_controller.rb +8 -0
- data/test/support/Support.cpp +84 -0
- data/test/support/Support.h +66 -8
- data/test/support/config.rb +14 -2
- data/test/support/test_helper.rb +5 -0
- data/vendor/rack-1.0.0-git/lib/rack/auth/openid.rb +123 -116
- data/vendor/rack-1.0.0-git/lib/rack/cascade.rb +17 -12
- data/vendor/rack-1.0.0-git/lib/rack/commonlogger.rb +34 -43
- data/vendor/rack-1.0.0-git/lib/rack/handler/cgi.rb +1 -1
- data/vendor/rack-1.0.0-git/lib/rack/handler/fastcgi.rb +1 -1
- data/vendor/rack-1.0.0-git/lib/rack/handler/lsws.rb +1 -1
- data/vendor/rack-1.0.0-git/lib/rack/handler/mongrel.rb +1 -1
- data/vendor/rack-1.0.0-git/lib/rack/handler/scgi.rb +1 -1
- data/vendor/rack-1.0.0-git/lib/rack/handler/webrick.rb +1 -1
- data/vendor/rack-1.0.0-git/lib/rack/mock.rb +4 -17
- data/vendor/rack-1.0.0-git/lib/rack/request.rb +3 -9
- data/vendor/rack-1.0.0-git/lib/rack/rewindable_input.rb +2 -0
- data/vendor/rack-1.0.0-git/lib/rack/utils.rb +38 -12
- metadata +231 -186
- data/ext/common/FileChecker.h +0 -112
- data/test/FileCheckerTest.cpp +0 -79
- data/test/stub/minimal-railsapp/README +0 -3
- data/test/stub/minimal-railsapp/config/application.rb +0 -0
- data/test/stub/minimal-railsapp/config/environment.rb +0 -3
- data/test/stub/minimal-railsapp/vendor/rails/actionmailer/lib/action_mailer.rb +0 -0
- data/test/stub/minimal-railsapp/vendor/rails/actionpack/lib/action_controller.rb +0 -10
- data/test/stub/minimal-railsapp/vendor/rails/actionpack/lib/action_pack.rb +0 -0
- data/test/stub/minimal-railsapp/vendor/rails/actionpack/lib/action_view.rb +0 -0
- data/test/stub/minimal-railsapp/vendor/rails/activerecord/lib/active_record.rb +0 -7
- data/test/stub/minimal-railsapp/vendor/rails/activeresource/lib/active_resource.rb +0 -0
- data/test/stub/minimal-railsapp/vendor/rails/activesupport/lib/active_support.rb +0 -17
- data/test/stub/minimal-railsapp/vendor/rails/activesupport/lib/active_support/whiny_nil.rb +0 -0
- data/test/stub/minimal-railsapp/vendor/rails/railties/lib/dispatcher.rb +0 -0
- data/test/stub/minimal-railsapp/vendor/rails/railties/lib/initializer.rb +0 -8
- data/test/stub/minimal-railsapp/vendor/rails/railties/lib/ruby_version_check.rb +0 -1
- data/test/stub/railsapp/app/controllers/application.rb +0 -12
- data/test/stub/railsapp/app/controllers/bar_controller.rb +0 -5
- data/test/stub/railsapp/app/controllers/bar_controller_1.txt +0 -5
- data/test/stub/railsapp/app/controllers/bar_controller_2.txt +0 -5
- data/test/stub/railsapp/app/controllers/foo_controller.rb +0 -9
- data/test/stub/railsapp/app/helpers/application_helper.rb +0 -3
- data/test/stub/railsapp/config/boot.rb +0 -108
- data/test/stub/railsapp/config/database.yml +0 -19
- data/test/stub/railsapp/config/environment.rb +0 -59
- data/test/stub/railsapp/config/environments/development.rb +0 -18
- data/test/stub/railsapp/config/environments/production.rb +0 -19
- data/test/stub/railsapp/config/initializers/inflections.rb +0 -10
- data/test/stub/railsapp/config/initializers/mime_types.rb +0 -5
- data/test/stub/railsapp/config/routes.rb +0 -35
- data/test/stub/railsapp/public/useless.txt +0 -1
- data/test/stub/railsapp2/app/controllers/application.rb +0 -12
- data/test/stub/railsapp2/app/controllers/foo_controller.rb +0 -5
- data/test/stub/railsapp2/app/helpers/application_helper.rb +0 -3
- data/test/stub/railsapp2/config/boot.rb +0 -108
- data/test/stub/railsapp2/config/database.yml +0 -19
- data/test/stub/railsapp2/config/environment.rb +0 -59
- data/test/stub/railsapp2/config/environments/development.rb +0 -18
- data/test/stub/railsapp2/config/environments/production.rb +0 -19
- data/test/stub/railsapp2/config/initializers/inflections.rb +0 -10
- data/test/stub/railsapp2/config/initializers/mime_types.rb +0 -5
- data/test/stub/railsapp2/config/routes.rb +0 -35
- data/test/stub/railsapp2/public/useless.txt +0 -1
@@ -0,0 +1,153 @@
|
|
1
|
+
<?xml version="1.0" encoding="iso-8859-1"?>
|
2
|
+
<!DOCTYPE html
|
3
|
+
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
4
|
+
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
5
|
+
<html>
|
6
|
+
<head>
|
7
|
+
<title>Class: PhusionPassenger::AbstractInstaller</title>
|
8
|
+
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
|
9
|
+
<link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
|
10
|
+
|
11
|
+
<script language="JavaScript" type="text/javascript">
|
12
|
+
// <![CDATA[
|
13
|
+
|
14
|
+
function toggleSource( id )
|
15
|
+
{
|
16
|
+
var elem
|
17
|
+
var link
|
18
|
+
|
19
|
+
if( document.getElementById )
|
20
|
+
{
|
21
|
+
elem = document.getElementById( id )
|
22
|
+
link = document.getElementById( "l_" + id )
|
23
|
+
}
|
24
|
+
else if ( document.all )
|
25
|
+
{
|
26
|
+
elem = eval( "document.all." + id )
|
27
|
+
link = eval( "document.all.l_" + id )
|
28
|
+
}
|
29
|
+
else
|
30
|
+
return false;
|
31
|
+
|
32
|
+
if( elem.style.display == "block" )
|
33
|
+
{
|
34
|
+
elem.style.display = "none"
|
35
|
+
link.innerHTML = "show source"
|
36
|
+
}
|
37
|
+
else
|
38
|
+
{
|
39
|
+
elem.style.display = "block"
|
40
|
+
link.innerHTML = "hide source"
|
41
|
+
}
|
42
|
+
}
|
43
|
+
|
44
|
+
function openCode( url )
|
45
|
+
{
|
46
|
+
window.open( url, "SOURCE_CODE", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=480,width=750" ).focus();
|
47
|
+
}
|
48
|
+
// ]]>
|
49
|
+
</script>
|
50
|
+
</head>
|
51
|
+
|
52
|
+
<body>
|
53
|
+
<table width="100%" border='0' cellpadding='0' cellspacing='0' class='banner'><tr>
|
54
|
+
<td class="file-title"><span class="file-title-prefix">Class</span><br />PhusionPassenger::AbstractInstaller</td>
|
55
|
+
<td align="right">
|
56
|
+
<table cellspacing="0" cellpadding="2">
|
57
|
+
<tr valign="top">
|
58
|
+
<td>In:</td>
|
59
|
+
<td>
|
60
|
+
<a href="../../files/lib/phusion_passenger/abstract_installer_rb.html">lib/phusion_passenger/abstract_installer.rb</a>
|
61
|
+
</td>
|
62
|
+
</tr>
|
63
|
+
<tr>
|
64
|
+
<td>Parent:</td>
|
65
|
+
<td>
|
66
|
+
Object
|
67
|
+
</td>
|
68
|
+
</tr>
|
69
|
+
</table>
|
70
|
+
</td>
|
71
|
+
</tr>
|
72
|
+
</table>
|
73
|
+
<!-- banner header -->
|
74
|
+
|
75
|
+
<div id="bodyContent">
|
76
|
+
<div id="content">
|
77
|
+
|
78
|
+
<div class="description"><p>
|
79
|
+
Abstract base class for installers. Used by
|
80
|
+
passenger-install-apache2-module and passenger-install-nginx-module.
|
81
|
+
</p>
|
82
|
+
</div>
|
83
|
+
|
84
|
+
|
85
|
+
|
86
|
+
<div class="sectiontitle">Methods</div>
|
87
|
+
<ul>
|
88
|
+
<li><a href="#M000153">new</a></li>
|
89
|
+
<li><a href="#M000154">start</a></li>
|
90
|
+
</ul>
|
91
|
+
|
92
|
+
|
93
|
+
|
94
|
+
|
95
|
+
<div class="sectiontitle">Constants</div>
|
96
|
+
<table border='0' cellpadding='5'>
|
97
|
+
<tr valign='top'>
|
98
|
+
<td class="attr-name">PASSENGER_WEBSITE</td>
|
99
|
+
<td>=</td>
|
100
|
+
<td class="attr-value">"http://www.modrails.com/"</td>
|
101
|
+
</tr>
|
102
|
+
<tr valign='top'>
|
103
|
+
<td class="attr-name">PHUSION_WEBSITE</td>
|
104
|
+
<td>=</td>
|
105
|
+
<td class="attr-value">"www.phusion.nl"</td>
|
106
|
+
</tr>
|
107
|
+
</table>
|
108
|
+
|
109
|
+
|
110
|
+
<div class="sectiontitle">Public Class methods</div>
|
111
|
+
<div class="method">
|
112
|
+
<div class="title">
|
113
|
+
<a name="M000153"></a><b>new</b>(options = {})
|
114
|
+
</div>
|
115
|
+
<div class="sourcecode">
|
116
|
+
<p class="source-link">[ <a href="javascript:toggleSource('M000153_source')" id="l_M000153_source">show source</a> ]</p>
|
117
|
+
<div id="M000153_source" class="dyn-source">
|
118
|
+
<pre>
|
119
|
+
<span class="ruby-comment cmt"># File lib/phusion_passenger/abstract_installer.rb, line 36</span>
|
120
|
+
36: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">initialize</span>(<span class="ruby-identifier">options</span> = {})
|
121
|
+
37: <span class="ruby-identifier">options</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">value</span><span class="ruby-operator">|</span>
|
122
|
+
38: <span class="ruby-identifier">instance_variable_set</span>(<span class="ruby-node">"@#{key}"</span><span class="ruby-node">"@#{key}"</span>, <span class="ruby-identifier">value</span>)
|
123
|
+
39: <span class="ruby-keyword kw">end</span>
|
124
|
+
40: <span class="ruby-keyword kw">end</span>
|
125
|
+
</pre>
|
126
|
+
</div>
|
127
|
+
</div>
|
128
|
+
</div>
|
129
|
+
<div class="sectiontitle">Public Instance methods</div>
|
130
|
+
<div class="method">
|
131
|
+
<div class="title">
|
132
|
+
<a name="M000154"></a><b>start</b>()
|
133
|
+
</div>
|
134
|
+
<div class="sourcecode">
|
135
|
+
<p class="source-link">[ <a href="javascript:toggleSource('M000154_source')" id="l_M000154_source">show source</a> ]</p>
|
136
|
+
<div id="M000154_source" class="dyn-source">
|
137
|
+
<pre>
|
138
|
+
<span class="ruby-comment cmt"># File lib/phusion_passenger/abstract_installer.rb, line 42</span>
|
139
|
+
42: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">start</span>
|
140
|
+
43: <span class="ruby-identifier">install!</span>
|
141
|
+
44: <span class="ruby-keyword kw">ensure</span>
|
142
|
+
45: <span class="ruby-identifier">reset_terminal_colors</span>
|
143
|
+
46: <span class="ruby-keyword kw">end</span>
|
144
|
+
</pre>
|
145
|
+
</div>
|
146
|
+
</div>
|
147
|
+
</div>
|
148
|
+
</div>
|
149
|
+
|
150
|
+
</div>
|
151
|
+
|
152
|
+
</body>
|
153
|
+
</html>
|
@@ -0,0 +1,517 @@
|
|
1
|
+
<?xml version="1.0" encoding="iso-8859-1"?>
|
2
|
+
<!DOCTYPE html
|
3
|
+
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
4
|
+
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
5
|
+
<html>
|
6
|
+
<head>
|
7
|
+
<title>Class: PhusionPassenger::AbstractRequestHandler</title>
|
8
|
+
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
|
9
|
+
<link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
|
10
|
+
|
11
|
+
<script language="JavaScript" type="text/javascript">
|
12
|
+
// <![CDATA[
|
13
|
+
|
14
|
+
function toggleSource( id )
|
15
|
+
{
|
16
|
+
var elem
|
17
|
+
var link
|
18
|
+
|
19
|
+
if( document.getElementById )
|
20
|
+
{
|
21
|
+
elem = document.getElementById( id )
|
22
|
+
link = document.getElementById( "l_" + id )
|
23
|
+
}
|
24
|
+
else if ( document.all )
|
25
|
+
{
|
26
|
+
elem = eval( "document.all." + id )
|
27
|
+
link = eval( "document.all.l_" + id )
|
28
|
+
}
|
29
|
+
else
|
30
|
+
return false;
|
31
|
+
|
32
|
+
if( elem.style.display == "block" )
|
33
|
+
{
|
34
|
+
elem.style.display = "none"
|
35
|
+
link.innerHTML = "show source"
|
36
|
+
}
|
37
|
+
else
|
38
|
+
{
|
39
|
+
elem.style.display = "block"
|
40
|
+
link.innerHTML = "hide source"
|
41
|
+
}
|
42
|
+
}
|
43
|
+
|
44
|
+
function openCode( url )
|
45
|
+
{
|
46
|
+
window.open( url, "SOURCE_CODE", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=480,width=750" ).focus();
|
47
|
+
}
|
48
|
+
// ]]>
|
49
|
+
</script>
|
50
|
+
</head>
|
51
|
+
|
52
|
+
<body>
|
53
|
+
<table width="100%" border='0' cellpadding='0' cellspacing='0' class='banner'><tr>
|
54
|
+
<td class="file-title"><span class="file-title-prefix">Class</span><br />PhusionPassenger::AbstractRequestHandler</td>
|
55
|
+
<td align="right">
|
56
|
+
<table cellspacing="0" cellpadding="2">
|
57
|
+
<tr valign="top">
|
58
|
+
<td>In:</td>
|
59
|
+
<td>
|
60
|
+
<a href="../../files/lib/phusion_passenger/abstract_request_handler_rb.html">lib/phusion_passenger/abstract_request_handler.rb</a>
|
61
|
+
</td>
|
62
|
+
</tr>
|
63
|
+
<tr>
|
64
|
+
<td>Parent:</td>
|
65
|
+
<td>
|
66
|
+
Object
|
67
|
+
</td>
|
68
|
+
</tr>
|
69
|
+
</table>
|
70
|
+
</td>
|
71
|
+
</tr>
|
72
|
+
</table>
|
73
|
+
<!-- banner header -->
|
74
|
+
|
75
|
+
<div id="bodyContent">
|
76
|
+
<div id="content">
|
77
|
+
|
78
|
+
<div class="description"><p>
|
79
|
+
The request handler is the layer which connects Apache with the underlying
|
80
|
+
application‘s request dispatcher (i.e. either Rails‘s
|
81
|
+
Dispatcher class or <a href="Rack.html">Rack</a>). The request
|
82
|
+
handler‘s job is to process incoming HTTP requests using the
|
83
|
+
currently loaded Ruby on Rails application. HTTP requests are forwarded to
|
84
|
+
the request handler by the web server. HTTP responses generated by the RoR
|
85
|
+
application are forwarded to the web server, which, in turn, sends the
|
86
|
+
response back to the HTTP client.
|
87
|
+
</p>
|
88
|
+
<p>
|
89
|
+
<a href="AbstractRequestHandler.html">AbstractRequestHandler</a> is an
|
90
|
+
abstract base class for easing the implementation of request handlers for
|
91
|
+
Rails and <a href="Rack.html">Rack</a>.
|
92
|
+
</p>
|
93
|
+
<h2>Design decisions</h2>
|
94
|
+
<p>
|
95
|
+
Some design decisions are made because we want to decrease system
|
96
|
+
administrator maintenance overhead. These decisions are documented in this
|
97
|
+
section.
|
98
|
+
</p>
|
99
|
+
<h3>Owner pipes</h3>
|
100
|
+
<p>
|
101
|
+
Because only the web server communicates directly with a request handler,
|
102
|
+
we want the request handler to exit if the web server has also exited. This
|
103
|
+
is implemented by using a so-called _owner pipe_. The writable part of the
|
104
|
+
pipe will be passed to the web server* via a Unix socket, and the web
|
105
|
+
server will own that part of the pipe, while <a
|
106
|
+
href="AbstractRequestHandler.html">AbstractRequestHandler</a> owns the
|
107
|
+
readable part of the pipe. <a
|
108
|
+
href="AbstractRequestHandler.html">AbstractRequestHandler</a> will
|
109
|
+
continuously check whether the other side of the pipe has been closed. If
|
110
|
+
so, then it knows that the web server has exited, and so the request
|
111
|
+
handler will exit as well. This works even if the web server gets killed by
|
112
|
+
SIGKILL.
|
113
|
+
</p>
|
114
|
+
<ul>
|
115
|
+
<li>It might also be passed to the ApplicationPoolServerExecutable, if the web
|
116
|
+
server‘s using ApplicationPoolServer instead of
|
117
|
+
StandardApplicationPool.
|
118
|
+
|
119
|
+
</li>
|
120
|
+
</ul>
|
121
|
+
<h2>Request format</h2>
|
122
|
+
<p>
|
123
|
+
Incoming "HTTP requests" are not true HTTP requests, i.e. their
|
124
|
+
binary representation do not conform to RFC 2616. Instead, the request
|
125
|
+
format is based on CGI, and is similar to that of SCGI.
|
126
|
+
</p>
|
127
|
+
<p>
|
128
|
+
The format consists of 3 parts:
|
129
|
+
</p>
|
130
|
+
<ul>
|
131
|
+
<li>A 32-bit big-endian integer, containing the size of the transformed
|
132
|
+
headers.
|
133
|
+
|
134
|
+
</li>
|
135
|
+
<li>The transformed HTTP headers.
|
136
|
+
|
137
|
+
</li>
|
138
|
+
<li>The verbatim (untransformed) HTTP request body.
|
139
|
+
|
140
|
+
</li>
|
141
|
+
</ul>
|
142
|
+
<p>
|
143
|
+
HTTP headers are transformed to a format that satisfies the following
|
144
|
+
grammar:
|
145
|
+
</p>
|
146
|
+
<pre>
|
147
|
+
headers ::= header*
|
148
|
+
header ::= name NUL value NUL
|
149
|
+
name ::= notnull+
|
150
|
+
value ::= notnull+
|
151
|
+
notnull ::= "\x01" | "\x02" | "\x02" | ... | "\xFF"
|
152
|
+
NUL = "\x00"
|
153
|
+
</pre>
|
154
|
+
<p>
|
155
|
+
The web server transforms the HTTP request to the aforementioned format,
|
156
|
+
and sends it to the request handler.
|
157
|
+
</p>
|
158
|
+
</div>
|
159
|
+
|
160
|
+
|
161
|
+
|
162
|
+
<div class="sectiontitle">Methods</div>
|
163
|
+
<ul>
|
164
|
+
<li><a href="#M000121">cleanup</a></li>
|
165
|
+
<li><a href="#M000123">main_loop</a></li>
|
166
|
+
<li><a href="#M000122">main_loop_running?</a></li>
|
167
|
+
<li><a href="#M000120">new</a></li>
|
168
|
+
<li><a href="#M000124">start_main_loop_thread</a></li>
|
169
|
+
</ul>
|
170
|
+
|
171
|
+
<div class="sectiontitle">Included Modules</div>
|
172
|
+
<ul>
|
173
|
+
<li><a href="Utils.html">Utils</a></li>
|
174
|
+
</ul>
|
175
|
+
|
176
|
+
|
177
|
+
|
178
|
+
<div class="sectiontitle">Constants</div>
|
179
|
+
<table border='0' cellpadding='5'>
|
180
|
+
<tr valign='top'>
|
181
|
+
<td class="attr-name">HARD_TERMINATION_SIGNAL</td>
|
182
|
+
<td>=</td>
|
183
|
+
<td class="attr-value">"SIGTERM"</td>
|
184
|
+
</tr>
|
185
|
+
<tr valign='top'>
|
186
|
+
<td> </td>
|
187
|
+
<td colspan="2" class="attr-desc">
|
188
|
+
<a href="../Signal.html">Signal</a> which will cause the Rails application
|
189
|
+
to exit immediately.
|
190
|
+
|
191
|
+
</td>
|
192
|
+
</tr>
|
193
|
+
<tr valign='top'>
|
194
|
+
<td class="attr-name">SOFT_TERMINATION_SIGNAL</td>
|
195
|
+
<td>=</td>
|
196
|
+
<td class="attr-value">"SIGUSR1"</td>
|
197
|
+
</tr>
|
198
|
+
<tr valign='top'>
|
199
|
+
<td> </td>
|
200
|
+
<td colspan="2" class="attr-desc">
|
201
|
+
<a href="../Signal.html">Signal</a> which will cause the Rails application
|
202
|
+
to exit as soon as it‘s done processing a request.
|
203
|
+
|
204
|
+
</td>
|
205
|
+
</tr>
|
206
|
+
<tr valign='top'>
|
207
|
+
<td class="attr-name">BACKLOG_SIZE</td>
|
208
|
+
<td>=</td>
|
209
|
+
<td class="attr-value">100</td>
|
210
|
+
</tr>
|
211
|
+
<tr valign='top'>
|
212
|
+
<td class="attr-name">MAX_HEADER_SIZE</td>
|
213
|
+
<td>=</td>
|
214
|
+
<td class="attr-value">128 * 1024</td>
|
215
|
+
</tr>
|
216
|
+
<tr valign='top'>
|
217
|
+
<td class="attr-name">PASSENGER_HEADER</td>
|
218
|
+
<td>=</td>
|
219
|
+
<td class="attr-value">determine_passenger_header</td>
|
220
|
+
</tr>
|
221
|
+
</table>
|
222
|
+
|
223
|
+
<div class="sectiontitle">Attributes</div>
|
224
|
+
<table border='0' cellpadding='5'>
|
225
|
+
<tr valign='top'>
|
226
|
+
<td class='attr-rw'>
|
227
|
+
[R]
|
228
|
+
</td>
|
229
|
+
<td class='attr-name'>iterations</td>
|
230
|
+
<td class='attr-desc'>
|
231
|
+
The number of times the main loop has iterated so far. Mostly useful for
|
232
|
+
unit test assertions.
|
233
|
+
|
234
|
+
</td>
|
235
|
+
</tr>
|
236
|
+
<tr valign='top'>
|
237
|
+
<td class='attr-rw'>
|
238
|
+
[RW]
|
239
|
+
</td>
|
240
|
+
<td class='attr-name'>memory_limit</td>
|
241
|
+
<td class='attr-desc'>
|
242
|
+
Specifies the maximum allowed memory usage, in MB. If after having
|
243
|
+
processed a request <a
|
244
|
+
href="AbstractRequestHandler.html">AbstractRequestHandler</a> detects that
|
245
|
+
memory usage has risen above this limit, then it will gracefully exit (that
|
246
|
+
is, exit after having processed all pending requests).
|
247
|
+
|
248
|
+
<p>
|
249
|
+
A value of 0 (the default) indicates that there‘s no limit.
|
250
|
+
</p>
|
251
|
+
</td>
|
252
|
+
</tr>
|
253
|
+
<tr valign='top'>
|
254
|
+
<td class='attr-rw'>
|
255
|
+
[R]
|
256
|
+
</td>
|
257
|
+
<td class='attr-name'>processed_requests</td>
|
258
|
+
<td class='attr-desc'>
|
259
|
+
Number of requests processed so far. This includes requests that raised
|
260
|
+
exceptions.
|
261
|
+
|
262
|
+
</td>
|
263
|
+
</tr>
|
264
|
+
<tr valign='top'>
|
265
|
+
<td class='attr-rw'>
|
266
|
+
[R]
|
267
|
+
</td>
|
268
|
+
<td class='attr-name'>socket_name</td>
|
269
|
+
<td class='attr-desc'>
|
270
|
+
The name of the socket on which the request handler accepts <a
|
271
|
+
href="AbstractRequestHandler.html#M000120">new</a> connections. At this
|
272
|
+
moment, this value is always the filename of a Unix domain socket.
|
273
|
+
|
274
|
+
<p>
|
275
|
+
See also #socket_type.
|
276
|
+
</p>
|
277
|
+
</td>
|
278
|
+
</tr>
|
279
|
+
<tr valign='top'>
|
280
|
+
<td class='attr-rw'>
|
281
|
+
[R]
|
282
|
+
</td>
|
283
|
+
<td class='attr-name'>socket_type</td>
|
284
|
+
<td class='attr-desc'>
|
285
|
+
The type of socket that #socket_name refers to. At the moment, the value is
|
286
|
+
always ‘unix’, which indicates a Unix domain socket.
|
287
|
+
|
288
|
+
</td>
|
289
|
+
</tr>
|
290
|
+
</table>
|
291
|
+
|
292
|
+
<div class="sectiontitle">Public Class methods</div>
|
293
|
+
<div class="method">
|
294
|
+
<div class="title">
|
295
|
+
<a name="M000120"></a><b>new</b>(owner_pipe, options = {})
|
296
|
+
</div>
|
297
|
+
<div class="description">
|
298
|
+
<p>
|
299
|
+
Create a <a href="AbstractRequestHandler.html#M000120">new</a>
|
300
|
+
RequestHandler with the given owner pipe. <tt>owner_pipe</tt> must be the
|
301
|
+
readable part of a pipe <a href="../IO.html">IO</a> object.
|
302
|
+
</p>
|
303
|
+
<p>
|
304
|
+
Additionally, the following options may be given:
|
305
|
+
</p>
|
306
|
+
<ul>
|
307
|
+
<li>memory_limit: Used to set the <tt>memory_limit</tt> attribute.
|
308
|
+
|
309
|
+
</li>
|
310
|
+
</ul>
|
311
|
+
</div>
|
312
|
+
<div class="sourcecode">
|
313
|
+
<p class="source-link">[ <a href="javascript:toggleSource('M000120_source')" id="l_M000120_source">show source</a> ]</p>
|
314
|
+
<div id="M000120_source" class="dyn-source">
|
315
|
+
<pre>
|
316
|
+
<span class="ruby-comment cmt"># File lib/phusion_passenger/abstract_request_handler.rb, line 136</span>
|
317
|
+
136: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">initialize</span>(<span class="ruby-identifier">owner_pipe</span>, <span class="ruby-identifier">options</span> = {})
|
318
|
+
137: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">should_use_unix_sockets?</span>
|
319
|
+
138: <span class="ruby-identifier">create_unix_socket_on_filesystem</span>
|
320
|
+
139: <span class="ruby-keyword kw">else</span>
|
321
|
+
140: <span class="ruby-identifier">create_tcp_socket</span>
|
322
|
+
141: <span class="ruby-keyword kw">end</span>
|
323
|
+
142: <span class="ruby-ivar">@socket</span>.<span class="ruby-identifier">close_on_exec!</span>
|
324
|
+
143: <span class="ruby-ivar">@owner_pipe</span> = <span class="ruby-identifier">owner_pipe</span>
|
325
|
+
144: <span class="ruby-ivar">@previous_signal_handlers</span> = {}
|
326
|
+
145: <span class="ruby-ivar">@main_loop_generation</span> = <span class="ruby-value">0</span>
|
327
|
+
146: <span class="ruby-ivar">@main_loop_thread_lock</span> = <span class="ruby-constant">Mutex</span>.<span class="ruby-identifier">new</span>
|
328
|
+
147: <span class="ruby-ivar">@main_loop_thread_cond</span> = <span class="ruby-constant">ConditionVariable</span>.<span class="ruby-identifier">new</span>
|
329
|
+
148: <span class="ruby-ivar">@memory_limit</span> = <span class="ruby-identifier">options</span>[<span class="ruby-value str">"memory_limit"</span>] <span class="ruby-operator">||</span> <span class="ruby-value">0</span>
|
330
|
+
149: <span class="ruby-ivar">@iterations</span> = <span class="ruby-value">0</span>
|
331
|
+
150: <span class="ruby-ivar">@processed_requests</span> = <span class="ruby-value">0</span>
|
332
|
+
151: <span class="ruby-ivar">@main_loop_running</span> = <span class="ruby-keyword kw">false</span>
|
333
|
+
152: <span class="ruby-keyword kw">end</span>
|
334
|
+
</pre>
|
335
|
+
</div>
|
336
|
+
</div>
|
337
|
+
</div>
|
338
|
+
<div class="sectiontitle">Public Instance methods</div>
|
339
|
+
<div class="method">
|
340
|
+
<div class="title">
|
341
|
+
<a name="M000121"></a><b>cleanup</b>()
|
342
|
+
</div>
|
343
|
+
<div class="description">
|
344
|
+
<p>
|
345
|
+
Clean up temporary stuff created by the request handler.
|
346
|
+
</p>
|
347
|
+
<p>
|
348
|
+
If the main loop was started by <a
|
349
|
+
href="AbstractRequestHandler.html#M000123">#main_loop</a>, then this method
|
350
|
+
may only be called after the main loop has exited.
|
351
|
+
</p>
|
352
|
+
<p>
|
353
|
+
If the main loop was started by <a
|
354
|
+
href="AbstractRequestHandler.html#M000124">#start_main_loop_thread</a>,
|
355
|
+
then this method may be called at any time, and it will stop the main loop
|
356
|
+
thread.
|
357
|
+
</p>
|
358
|
+
</div>
|
359
|
+
<div class="sourcecode">
|
360
|
+
<p class="source-link">[ <a href="javascript:toggleSource('M000121_source')" id="l_M000121_source">show source</a> ]</p>
|
361
|
+
<div id="M000121_source" class="dyn-source">
|
362
|
+
<pre>
|
363
|
+
<span class="ruby-comment cmt"># File lib/phusion_passenger/abstract_request_handler.rb, line 161</span>
|
364
|
+
161: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">cleanup</span>
|
365
|
+
162: <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@main_loop_thread</span>
|
366
|
+
163: <span class="ruby-ivar">@main_loop_thread_lock</span>.<span class="ruby-identifier">synchronize</span> <span class="ruby-keyword kw">do</span>
|
367
|
+
164: <span class="ruby-ivar">@graceful_termination_pipe</span>[<span class="ruby-value">1</span>].<span class="ruby-identifier">close</span> <span class="ruby-keyword kw">rescue</span> <span class="ruby-keyword kw">nil</span>
|
368
|
+
165: <span class="ruby-keyword kw">end</span>
|
369
|
+
166: <span class="ruby-ivar">@main_loop_thread</span>.<span class="ruby-identifier">join</span>
|
370
|
+
167: <span class="ruby-keyword kw">end</span>
|
371
|
+
168: <span class="ruby-ivar">@socket</span>.<span class="ruby-identifier">close</span> <span class="ruby-keyword kw">rescue</span> <span class="ruby-keyword kw">nil</span>
|
372
|
+
169: <span class="ruby-ivar">@owner_pipe</span>.<span class="ruby-identifier">close</span> <span class="ruby-keyword kw">rescue</span> <span class="ruby-keyword kw">nil</span>
|
373
|
+
170: <span class="ruby-constant">File</span>.<span class="ruby-identifier">unlink</span>(<span class="ruby-ivar">@socket_name</span>) <span class="ruby-keyword kw">rescue</span> <span class="ruby-keyword kw">nil</span>
|
374
|
+
171: <span class="ruby-keyword kw">end</span>
|
375
|
+
</pre>
|
376
|
+
</div>
|
377
|
+
</div>
|
378
|
+
</div>
|
379
|
+
<div class="method">
|
380
|
+
<div class="title">
|
381
|
+
<a name="M000123"></a><b>main_loop</b>()
|
382
|
+
</div>
|
383
|
+
<div class="description">
|
384
|
+
<p>
|
385
|
+
Enter the request handler‘s main loop.
|
386
|
+
</p>
|
387
|
+
</div>
|
388
|
+
<div class="sourcecode">
|
389
|
+
<p class="source-link">[ <a href="javascript:toggleSource('M000123_source')" id="l_M000123_source">show source</a> ]</p>
|
390
|
+
<div id="M000123_source" class="dyn-source">
|
391
|
+
<pre>
|
392
|
+
<span class="ruby-comment cmt"># File lib/phusion_passenger/abstract_request_handler.rb, line 179</span>
|
393
|
+
179: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">main_loop</span>
|
394
|
+
180: <span class="ruby-identifier">reset_signal_handlers</span>
|
395
|
+
181: <span class="ruby-keyword kw">begin</span>
|
396
|
+
182: <span class="ruby-ivar">@graceful_termination_pipe</span> = <span class="ruby-constant">IO</span>.<span class="ruby-identifier">pipe</span>
|
397
|
+
183: <span class="ruby-ivar">@graceful_termination_pipe</span>[<span class="ruby-value">0</span>].<span class="ruby-identifier">close_on_exec!</span>
|
398
|
+
184: <span class="ruby-ivar">@graceful_termination_pipe</span>[<span class="ruby-value">1</span>].<span class="ruby-identifier">close_on_exec!</span>
|
399
|
+
185:
|
400
|
+
186: <span class="ruby-ivar">@main_loop_thread_lock</span>.<span class="ruby-identifier">synchronize</span> <span class="ruby-keyword kw">do</span>
|
401
|
+
187: <span class="ruby-ivar">@main_loop_generation</span> <span class="ruby-operator">+=</span> <span class="ruby-value">1</span>
|
402
|
+
188: <span class="ruby-ivar">@main_loop_running</span> = <span class="ruby-keyword kw">true</span>
|
403
|
+
189: <span class="ruby-ivar">@main_loop_thread_cond</span>.<span class="ruby-identifier">broadcast</span>
|
404
|
+
190: <span class="ruby-keyword kw">end</span>
|
405
|
+
191:
|
406
|
+
192: <span class="ruby-identifier">install_useful_signal_handlers</span>
|
407
|
+
193:
|
408
|
+
194: <span class="ruby-keyword kw">while</span> <span class="ruby-keyword kw">true</span>
|
409
|
+
195: <span class="ruby-ivar">@iterations</span> <span class="ruby-operator">+=</span> <span class="ruby-value">1</span>
|
410
|
+
196: <span class="ruby-identifier">client</span> = <span class="ruby-identifier">accept_connection</span>
|
411
|
+
197: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">client</span>.<span class="ruby-identifier">nil?</span>
|
412
|
+
198: <span class="ruby-keyword kw">break</span>
|
413
|
+
199: <span class="ruby-keyword kw">end</span>
|
414
|
+
200: <span class="ruby-keyword kw">begin</span>
|
415
|
+
201: <span class="ruby-identifier">headers</span>, <span class="ruby-identifier">input</span> = <span class="ruby-identifier">parse_request</span>(<span class="ruby-identifier">client</span>)
|
416
|
+
202: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">headers</span>
|
417
|
+
203: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">headers</span>[<span class="ruby-constant">REQUEST_METHOD</span>] <span class="ruby-operator">==</span> <span class="ruby-constant">PING</span>
|
418
|
+
204: <span class="ruby-identifier">process_ping</span>(<span class="ruby-identifier">headers</span>, <span class="ruby-identifier">input</span>, <span class="ruby-identifier">client</span>)
|
419
|
+
205: <span class="ruby-keyword kw">else</span>
|
420
|
+
206: <span class="ruby-identifier">process_request</span>(<span class="ruby-identifier">headers</span>, <span class="ruby-identifier">input</span>, <span class="ruby-identifier">client</span>)
|
421
|
+
207: <span class="ruby-keyword kw">end</span>
|
422
|
+
208: <span class="ruby-keyword kw">end</span>
|
423
|
+
209: <span class="ruby-keyword kw">rescue</span> <span class="ruby-constant">IOError</span>, <span class="ruby-constant">SocketError</span>, <span class="ruby-constant">SystemCallError</span> =<span class="ruby-operator">></span> <span class="ruby-identifier">e</span>
|
424
|
+
210: <span class="ruby-identifier">print_exception</span>(<span class="ruby-value str">"Passenger RequestHandler"</span>, <span class="ruby-identifier">e</span>)
|
425
|
+
211: <span class="ruby-keyword kw">ensure</span>
|
426
|
+
212: <span class="ruby-comment cmt"># 'input' is the same as 'client' so we don't</span>
|
427
|
+
213: <span class="ruby-comment cmt"># need to close that.</span>
|
428
|
+
214: <span class="ruby-comment cmt"># The 'close_write' here prevents forked child</span>
|
429
|
+
215: <span class="ruby-comment cmt"># processes from unintentionally keeping the</span>
|
430
|
+
216: <span class="ruby-comment cmt"># connection open.</span>
|
431
|
+
217: <span class="ruby-identifier">client</span>.<span class="ruby-identifier">close_write</span> <span class="ruby-keyword kw">rescue</span> <span class="ruby-keyword kw">nil</span>
|
432
|
+
218: <span class="ruby-identifier">client</span>.<span class="ruby-identifier">close</span> <span class="ruby-keyword kw">rescue</span> <span class="ruby-keyword kw">nil</span>
|
433
|
+
219: <span class="ruby-keyword kw">end</span>
|
434
|
+
220: <span class="ruby-ivar">@processed_requests</span> <span class="ruby-operator">+=</span> <span class="ruby-value">1</span>
|
435
|
+
221: <span class="ruby-keyword kw">end</span>
|
436
|
+
222: <span class="ruby-keyword kw">rescue</span> <span class="ruby-constant">EOFError</span>
|
437
|
+
223: <span class="ruby-comment cmt"># Exit main loop.</span>
|
438
|
+
224: <span class="ruby-keyword kw">rescue</span> <span class="ruby-constant">Interrupt</span>
|
439
|
+
225: <span class="ruby-comment cmt"># Exit main loop.</span>
|
440
|
+
226: <span class="ruby-keyword kw">rescue</span> <span class="ruby-constant">SignalException</span> =<span class="ruby-operator">></span> <span class="ruby-identifier">signal</span>
|
441
|
+
227: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">signal</span>.<span class="ruby-identifier">message</span> <span class="ruby-operator">!=</span> <span class="ruby-constant">HARD_TERMINATION_SIGNAL</span> <span class="ruby-operator">&&</span>
|
442
|
+
228: <span class="ruby-identifier">signal</span>.<span class="ruby-identifier">message</span> <span class="ruby-operator">!=</span> <span class="ruby-constant">SOFT_TERMINATION_SIGNAL</span>
|
443
|
+
229: <span class="ruby-identifier">raise</span>
|
444
|
+
230: <span class="ruby-keyword kw">end</span>
|
445
|
+
231: <span class="ruby-keyword kw">ensure</span>
|
446
|
+
232: <span class="ruby-identifier">revert_signal_handlers</span>
|
447
|
+
233: <span class="ruby-ivar">@main_loop_thread_lock</span>.<span class="ruby-identifier">synchronize</span> <span class="ruby-keyword kw">do</span>
|
448
|
+
234: <span class="ruby-ivar">@graceful_termination_pipe</span>[<span class="ruby-value">0</span>].<span class="ruby-identifier">close</span> <span class="ruby-keyword kw">rescue</span> <span class="ruby-keyword kw">nil</span>
|
449
|
+
235: <span class="ruby-ivar">@graceful_termination_pipe</span>[<span class="ruby-value">1</span>].<span class="ruby-identifier">close</span> <span class="ruby-keyword kw">rescue</span> <span class="ruby-keyword kw">nil</span>
|
450
|
+
236: <span class="ruby-ivar">@main_loop_generation</span> <span class="ruby-operator">+=</span> <span class="ruby-value">1</span>
|
451
|
+
237: <span class="ruby-ivar">@main_loop_running</span> = <span class="ruby-keyword kw">false</span>
|
452
|
+
238: <span class="ruby-ivar">@main_loop_thread_cond</span>.<span class="ruby-identifier">broadcast</span>
|
453
|
+
239: <span class="ruby-keyword kw">end</span>
|
454
|
+
240: <span class="ruby-keyword kw">end</span>
|
455
|
+
241: <span class="ruby-keyword kw">end</span>
|
456
|
+
</pre>
|
457
|
+
</div>
|
458
|
+
</div>
|
459
|
+
</div>
|
460
|
+
<div class="method">
|
461
|
+
<div class="title">
|
462
|
+
<a name="M000122"></a><b>main_loop_running?</b>()
|
463
|
+
</div>
|
464
|
+
<div class="description">
|
465
|
+
<p>
|
466
|
+
Check whether the main loop‘s currently running.
|
467
|
+
</p>
|
468
|
+
</div>
|
469
|
+
<div class="sourcecode">
|
470
|
+
<p class="source-link">[ <a href="javascript:toggleSource('M000122_source')" id="l_M000122_source">show source</a> ]</p>
|
471
|
+
<div id="M000122_source" class="dyn-source">
|
472
|
+
<pre>
|
473
|
+
<span class="ruby-comment cmt"># File lib/phusion_passenger/abstract_request_handler.rb, line 174</span>
|
474
|
+
174: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">main_loop_running?</span>
|
475
|
+
175: <span class="ruby-keyword kw">return</span> <span class="ruby-ivar">@main_loop_running</span>
|
476
|
+
176: <span class="ruby-keyword kw">end</span>
|
477
|
+
</pre>
|
478
|
+
</div>
|
479
|
+
</div>
|
480
|
+
</div>
|
481
|
+
<div class="method">
|
482
|
+
<div class="title">
|
483
|
+
<a name="M000124"></a><b>start_main_loop_thread</b>()
|
484
|
+
</div>
|
485
|
+
<div class="description">
|
486
|
+
<p>
|
487
|
+
Start the main loop in a <a
|
488
|
+
href="AbstractRequestHandler.html#M000120">new</a> thread. This thread will
|
489
|
+
be stopped by <a href="AbstractRequestHandler.html#M000121">#cleanup</a>.
|
490
|
+
</p>
|
491
|
+
</div>
|
492
|
+
<div class="sourcecode">
|
493
|
+
<p class="source-link">[ <a href="javascript:toggleSource('M000124_source')" id="l_M000124_source">show source</a> ]</p>
|
494
|
+
<div id="M000124_source" class="dyn-source">
|
495
|
+
<pre>
|
496
|
+
<span class="ruby-comment cmt"># File lib/phusion_passenger/abstract_request_handler.rb, line 244</span>
|
497
|
+
244: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">start_main_loop_thread</span>
|
498
|
+
245: <span class="ruby-identifier">current_generation</span> = <span class="ruby-ivar">@main_loop_generation</span>
|
499
|
+
246: <span class="ruby-ivar">@main_loop_thread</span> = <span class="ruby-constant">Thread</span>.<span class="ruby-identifier">new</span> <span class="ruby-keyword kw">do</span>
|
500
|
+
247: <span class="ruby-identifier">main_loop</span>
|
501
|
+
248: <span class="ruby-keyword kw">end</span>
|
502
|
+
249: <span class="ruby-ivar">@main_loop_thread_lock</span>.<span class="ruby-identifier">synchronize</span> <span class="ruby-keyword kw">do</span>
|
503
|
+
250: <span class="ruby-keyword kw">while</span> <span class="ruby-ivar">@main_loop_generation</span> <span class="ruby-operator">==</span> <span class="ruby-identifier">current_generation</span>
|
504
|
+
251: <span class="ruby-ivar">@main_loop_thread_cond</span>.<span class="ruby-identifier">wait</span>(<span class="ruby-ivar">@main_loop_thread_lock</span>)
|
505
|
+
252: <span class="ruby-keyword kw">end</span>
|
506
|
+
253: <span class="ruby-keyword kw">end</span>
|
507
|
+
254: <span class="ruby-keyword kw">end</span>
|
508
|
+
</pre>
|
509
|
+
</div>
|
510
|
+
</div>
|
511
|
+
</div>
|
512
|
+
</div>
|
513
|
+
|
514
|
+
</div>
|
515
|
+
|
516
|
+
</body>
|
517
|
+
</html>
|