passenger 2.2.1 → 2.2.2

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.

Files changed (216) hide show
  1. data/Rakefile +66 -79
  2. data/bin/passenger-install-nginx-module +1 -1
  3. data/bin/passenger-memory-stats +1 -1
  4. data/bin/passenger-spawn-server +8 -2
  5. data/doc/Users guide Apache.html +33 -49
  6. data/doc/Users guide Apache.txt +28 -27
  7. data/doc/Users guide Nginx.html +9 -19
  8. data/doc/Users guide Nginx.txt +8 -20
  9. data/doc/cxxapi/Bucket_8h-source.html +1 -1
  10. data/doc/cxxapi/Configuration_8h-source.html +297 -300
  11. data/doc/cxxapi/DirectoryMapper_8h-source.html +1 -1
  12. data/doc/cxxapi/Hooks_8h-source.html +1 -1
  13. data/doc/cxxapi/annotated.html +1 -1
  14. data/doc/cxxapi/classHooks-members.html +1 -1
  15. data/doc/cxxapi/classHooks.html +1 -1
  16. data/doc/cxxapi/classPassenger_1_1DirectoryMapper-members.html +1 -1
  17. data/doc/cxxapi/classPassenger_1_1DirectoryMapper.html +1 -1
  18. data/doc/cxxapi/classes.html +1 -1
  19. data/doc/cxxapi/definitions_8h-source.html +1 -1
  20. data/doc/cxxapi/files.html +1 -1
  21. data/doc/cxxapi/functions.html +1 -1
  22. data/doc/cxxapi/functions_func.html +1 -1
  23. data/doc/cxxapi/graph_legend.html +1 -1
  24. data/doc/cxxapi/group__Configuration.html +1 -23
  25. data/doc/cxxapi/group__Core.html +1 -1
  26. data/doc/cxxapi/group__Hooks.html +1 -1
  27. data/doc/cxxapi/group__Support.html +1 -1
  28. data/doc/cxxapi/main.html +1 -1
  29. data/doc/cxxapi/modules.html +1 -1
  30. data/doc/users_guide_snippets/rackup_specifications.txt +4 -2
  31. data/ext/apache2/Configuration.h +0 -3
  32. data/ext/apache2/Hooks.cpp +5 -3
  33. data/ext/common/ApplicationPoolServer.h +1 -0
  34. data/ext/common/ApplicationPoolServerExecutable.cpp +5 -2
  35. data/ext/common/SpawnManager.h +1 -0
  36. data/ext/common/Utils.cpp +22 -23
  37. data/ext/common/Utils.h +32 -21
  38. data/ext/common/Version.h +31 -0
  39. data/ext/nginx/ContentHandler.c +61 -8
  40. data/ext/nginx/HelperServer.cpp +3 -0
  41. data/ext/nginx/HttpStatusExtractor.h +185 -0
  42. data/ext/nginx/StaticContentHandler.c +18 -3
  43. data/ext/nginx/config +2 -1
  44. data/ext/nginx/ngx_http_passenger_module.c +21 -15
  45. data/ext/oxt/backtrace.cpp +4 -2
  46. data/ext/oxt/spin_lock.hpp +3 -3
  47. data/lib/phusion_passenger/abstract_request_handler.rb +5 -3
  48. data/lib/phusion_passenger/admin_tools/control_process.rb +6 -1
  49. data/lib/phusion_passenger/constants.rb +2 -2
  50. data/lib/phusion_passenger/rack/application_spawner.rb +2 -1
  51. data/lib/phusion_passenger/rack/request_handler.rb +45 -35
  52. data/lib/phusion_passenger/templates/nginx/config_snippets.txt.erb +1 -1
  53. data/lib/phusion_passenger/utils.rb +13 -3
  54. data/misc/rake/cplusplus.rb +7 -0
  55. data/test/ApplicationPoolServer_ApplicationPoolTest.cpp +2 -0
  56. data/test/ApplicationPoolTest.cpp +39 -62
  57. data/test/CxxTestMain.cpp +6 -6
  58. data/test/HttpStatusExtractorTest.cpp +17 -0
  59. data/test/StandardApplicationPoolTest.cpp +2 -0
  60. data/test/UtilsTest.cpp +17 -28
  61. data/test/ruby/abstract_request_handler_spec.rb +3 -7
  62. data/test/ruby/utils_spec.rb +18 -13
  63. data/test/ruby/wsgi/application_spawner_spec.rb +5 -9
  64. data/test/stub/railsapp/app/controllers/{bar_controller_1.rb → bar_controller.rb} +0 -0
  65. data/test/stub/railsapp/app/controllers/bar_controller_1.txt +5 -0
  66. data/test/stub/railsapp/app/controllers/{bar_controller_2.rb → bar_controller_2.txt} +0 -0
  67. data/test/support/Support.h +20 -0
  68. data/test/support/config.rb +13 -0
  69. data/vendor/README +4 -3
  70. data/vendor/{rack-0.9.1 → rack-1.0.0-git}/COPYING +1 -1
  71. data/vendor/{rack-0.9.1 → rack-1.0.0-git}/KNOWN-ISSUES +0 -0
  72. data/vendor/{rack-0.9.1 → rack-1.0.0-git}/README +54 -7
  73. data/vendor/rack-1.0.0-git/Rakefile +164 -0
  74. data/vendor/{rack-0.9.1 → rack-1.0.0-git}/lib/rack.rb +7 -3
  75. data/vendor/{rack-0.9.1 → rack-1.0.0-git}/lib/rack/adapter/camping.rb +0 -0
  76. data/vendor/rack-1.0.0-git/lib/rack/auth/abstract/handler.rb +37 -0
  77. data/vendor/{rack-0.9.1 → rack-1.0.0-git}/lib/rack/auth/abstract/request.rb +0 -0
  78. data/vendor/{rack-0.9.1 → rack-1.0.0-git}/lib/rack/auth/basic.rb +0 -0
  79. data/vendor/{rack-0.9.1 → rack-1.0.0-git}/lib/rack/auth/digest/md5.rb +1 -1
  80. data/vendor/{rack-0.9.1 → rack-1.0.0-git}/lib/rack/auth/digest/nonce.rb +0 -0
  81. data/vendor/{rack-0.9.1 → rack-1.0.0-git}/lib/rack/auth/digest/params.rb +0 -0
  82. data/vendor/{rack-0.9.1 → rack-1.0.0-git}/lib/rack/auth/digest/request.rb +2 -2
  83. data/vendor/rack-1.0.0-git/lib/rack/auth/openid.rb +480 -0
  84. data/vendor/{rack-0.9.1 → rack-1.0.0-git}/lib/rack/builder.rb +1 -5
  85. data/vendor/{rack-0.9.1 → rack-1.0.0-git}/lib/rack/cascade.rb +0 -0
  86. data/vendor/rack-1.0.0-git/lib/rack/chunked.rb +49 -0
  87. data/vendor/{rack-0.9.1 → rack-1.0.0-git}/lib/rack/commonlogger.rb +0 -0
  88. data/vendor/{rack-0.9.1 → rack-1.0.0-git}/lib/rack/conditionalget.rb +4 -0
  89. data/vendor/{rack-0.9.1 → rack-1.0.0-git}/lib/rack/content_length.rb +7 -3
  90. data/vendor/rack-1.0.0-git/lib/rack/content_type.rb +23 -0
  91. data/vendor/rack-1.0.0-git/lib/rack/deflater.rb +96 -0
  92. data/vendor/{rack-0.9.1 → rack-1.0.0-git}/lib/rack/directory.rb +5 -2
  93. data/vendor/{rack-0.9.1 → rack-1.0.0-git}/lib/rack/file.rb +4 -1
  94. data/vendor/{rack-0.9.1 → rack-1.0.0-git}/lib/rack/handler.rb +22 -1
  95. data/vendor/{rack-0.9.1 → rack-1.0.0-git}/lib/rack/handler/cgi.rb +7 -3
  96. data/vendor/{rack-0.9.1 → rack-1.0.0-git}/lib/rack/handler/evented_mongrel.rb +0 -0
  97. data/vendor/{rack-0.9.1 → rack-1.0.0-git}/lib/rack/handler/fastcgi.rb +26 -24
  98. data/vendor/{rack-0.9.1 → rack-1.0.0-git}/lib/rack/handler/lsws.rb +7 -4
  99. data/vendor/{rack-0.9.1 → rack-1.0.0-git}/lib/rack/handler/mongrel.rb +5 -3
  100. data/vendor/{rack-0.9.1 → rack-1.0.0-git}/lib/rack/handler/scgi.rb +5 -3
  101. data/vendor/{rack-0.9.1 → rack-1.0.0-git}/lib/rack/handler/swiftiplied_mongrel.rb +0 -0
  102. data/vendor/{rack-0.9.1 → rack-1.0.0-git}/lib/rack/handler/thin.rb +3 -0
  103. data/vendor/{rack-0.9.1 → rack-1.0.0-git}/lib/rack/handler/webrick.rb +11 -5
  104. data/vendor/{rack-0.9.1 → rack-1.0.0-git}/lib/rack/head.rb +0 -0
  105. data/vendor/{rack-0.9.1 → rack-1.0.0-git}/lib/rack/lint.rb +138 -66
  106. data/vendor/{rack-0.9.1 → rack-1.0.0-git}/lib/rack/lobster.rb +0 -0
  107. data/vendor/rack-1.0.0-git/lib/rack/lock.rb +16 -0
  108. data/vendor/{rack-0.9.1 → rack-1.0.0-git}/lib/rack/methodoverride.rb +0 -0
  109. data/vendor/{rack-0.9.1 → rack-1.0.0-git}/lib/rack/mime.rb +4 -4
  110. data/vendor/{rack-0.9.1 → rack-1.0.0-git}/lib/rack/mock.rb +42 -5
  111. data/vendor/{rack-0.9.1 → rack-1.0.0-git}/lib/rack/recursive.rb +0 -0
  112. data/vendor/rack-1.0.0-git/lib/rack/reloader.rb +106 -0
  113. data/vendor/{rack-0.9.1 → rack-1.0.0-git}/lib/rack/request.rb +46 -10
  114. data/vendor/{rack-0.9.1 → rack-1.0.0-git}/lib/rack/response.rb +15 -3
  115. data/vendor/rack-1.0.0-git/lib/rack/rewindable_input.rb +98 -0
  116. data/vendor/rack-1.0.0-git/lib/rack/session/abstract/id.rb +142 -0
  117. data/vendor/{rack-0.9.1 → rack-1.0.0-git}/lib/rack/session/cookie.rb +2 -0
  118. data/vendor/rack-1.0.0-git/lib/rack/session/memcache.rb +109 -0
  119. data/vendor/rack-1.0.0-git/lib/rack/session/pool.rb +100 -0
  120. data/vendor/{rack-0.9.1 → rack-1.0.0-git}/lib/rack/showexceptions.rb +2 -1
  121. data/vendor/{rack-0.9.1 → rack-1.0.0-git}/lib/rack/showstatus.rb +1 -1
  122. data/vendor/{rack-0.9.1 → rack-1.0.0-git}/lib/rack/static.rb +0 -0
  123. data/vendor/{rack-0.9.1 → rack-1.0.0-git}/lib/rack/urlmap.rb +12 -5
  124. data/vendor/{rack-0.9.1 → rack-1.0.0-git}/lib/rack/utils.rb +212 -65
  125. metadata +71 -170
  126. data/doc/rdoc/classes/ConditionVariable.html +0 -194
  127. data/doc/rdoc/classes/Exception.html +0 -120
  128. data/doc/rdoc/classes/GC.html +0 -113
  129. data/doc/rdoc/classes/IO.html +0 -169
  130. data/doc/rdoc/classes/PhusionPassenger.html +0 -238
  131. data/doc/rdoc/classes/PhusionPassenger/AbstractInstaller.html +0 -153
  132. data/doc/rdoc/classes/PhusionPassenger/AbstractRequestHandler.html +0 -506
  133. data/doc/rdoc/classes/PhusionPassenger/AbstractServer.html +0 -692
  134. data/doc/rdoc/classes/PhusionPassenger/AbstractServer/ServerAlreadyStarted.html +0 -97
  135. data/doc/rdoc/classes/PhusionPassenger/AbstractServer/ServerError.html +0 -96
  136. data/doc/rdoc/classes/PhusionPassenger/AbstractServer/ServerNotStarted.html +0 -97
  137. data/doc/rdoc/classes/PhusionPassenger/AbstractServer/UnknownMessage.html +0 -96
  138. data/doc/rdoc/classes/PhusionPassenger/AbstractServerCollection.html +0 -598
  139. data/doc/rdoc/classes/PhusionPassenger/AdminTools.html +0 -140
  140. data/doc/rdoc/classes/PhusionPassenger/AdminTools/ControlProcess.html +0 -264
  141. data/doc/rdoc/classes/PhusionPassenger/AdminTools/ControlProcess/Instance.html +0 -138
  142. data/doc/rdoc/classes/PhusionPassenger/AppInitError.html +0 -154
  143. data/doc/rdoc/classes/PhusionPassenger/Application.html +0 -283
  144. data/doc/rdoc/classes/PhusionPassenger/ConsoleTextTemplate.html +0 -172
  145. data/doc/rdoc/classes/PhusionPassenger/FrameworkInitError.html +0 -145
  146. data/doc/rdoc/classes/PhusionPassenger/HTMLTemplate.html +0 -175
  147. data/doc/rdoc/classes/PhusionPassenger/InitializationError.html +0 -141
  148. data/doc/rdoc/classes/PhusionPassenger/InvalidPath.html +0 -92
  149. data/doc/rdoc/classes/PhusionPassenger/MessageChannel.html +0 -489
  150. data/doc/rdoc/classes/PhusionPassenger/NativeSupport.html +0 -350
  151. data/doc/rdoc/classes/PhusionPassenger/Rack.html +0 -91
  152. data/doc/rdoc/classes/PhusionPassenger/Rack/ApplicationSpawner.html +0 -185
  153. data/doc/rdoc/classes/PhusionPassenger/Rack/RequestHandler.html +0 -184
  154. data/doc/rdoc/classes/PhusionPassenger/Railz.html +0 -95
  155. data/doc/rdoc/classes/PhusionPassenger/Railz/ApplicationSpawner.html +0 -419
  156. data/doc/rdoc/classes/PhusionPassenger/Railz/ApplicationSpawner/Error.html +0 -98
  157. data/doc/rdoc/classes/PhusionPassenger/Railz/CGIFixed.html +0 -200
  158. data/doc/rdoc/classes/PhusionPassenger/Railz/FrameworkSpawner.html +0 -443
  159. data/doc/rdoc/classes/PhusionPassenger/Railz/FrameworkSpawner/Error.html +0 -98
  160. data/doc/rdoc/classes/PhusionPassenger/Railz/RequestHandler.html +0 -154
  161. data/doc/rdoc/classes/PhusionPassenger/SpawnManager.html +0 -402
  162. data/doc/rdoc/classes/PhusionPassenger/UnknownError.html +0 -125
  163. data/doc/rdoc/classes/PhusionPassenger/Utils.html +0 -694
  164. data/doc/rdoc/classes/PhusionPassenger/VersionNotFound.html +0 -140
  165. data/doc/rdoc/classes/PhusionPassenger/WSGI.html +0 -89
  166. data/doc/rdoc/classes/PhusionPassenger/WSGI/ApplicationSpawner.html +0 -188
  167. data/doc/rdoc/classes/PlatformInfo.html +0 -831
  168. data/doc/rdoc/classes/RakeExtensions.html +0 -197
  169. data/doc/rdoc/classes/Signal.html +0 -134
  170. data/doc/rdoc/created.rid +0 -1
  171. data/doc/rdoc/files/DEVELOPERS_TXT.html +0 -240
  172. data/doc/rdoc/files/README.html +0 -157
  173. data/doc/rdoc/files/ext/phusion_passenger/native_support_c.html +0 -92
  174. data/doc/rdoc/files/lib/phusion_passenger/abstract_installer_rb.html +0 -129
  175. data/doc/rdoc/files/lib/phusion_passenger/abstract_request_handler_rb.html +0 -131
  176. data/doc/rdoc/files/lib/phusion_passenger/abstract_server_collection_rb.html +0 -126
  177. data/doc/rdoc/files/lib/phusion_passenger/abstract_server_rb.html +0 -130
  178. data/doc/rdoc/files/lib/phusion_passenger/admin_tools/control_process_rb.html +0 -129
  179. data/doc/rdoc/files/lib/phusion_passenger/admin_tools_rb.html +0 -122
  180. data/doc/rdoc/files/lib/phusion_passenger/application_rb.html +0 -127
  181. data/doc/rdoc/files/lib/phusion_passenger/console_text_template_rb.html +0 -126
  182. data/doc/rdoc/files/lib/phusion_passenger/constants_rb.html +0 -122
  183. data/doc/rdoc/files/lib/phusion_passenger/dependencies_rb.html +0 -134
  184. data/doc/rdoc/files/lib/phusion_passenger/events_rb.html +0 -122
  185. data/doc/rdoc/files/lib/phusion_passenger/exceptions_rb.html +0 -122
  186. data/doc/rdoc/files/lib/phusion_passenger/html_template_rb.html +0 -126
  187. data/doc/rdoc/files/lib/phusion_passenger/message_channel_rb.html +0 -122
  188. data/doc/rdoc/files/lib/phusion_passenger/packaging_rb.html +0 -122
  189. data/doc/rdoc/files/lib/phusion_passenger/platform_info_rb.html +0 -127
  190. data/doc/rdoc/files/lib/phusion_passenger/rack/application_spawner_rb.html +0 -133
  191. data/doc/rdoc/files/lib/phusion_passenger/rack/request_handler_rb.html +0 -126
  192. data/doc/rdoc/files/lib/phusion_passenger/railz/application_spawner_rb.html +0 -143
  193. data/doc/rdoc/files/lib/phusion_passenger/railz/cgi_fixed_rb.html +0 -126
  194. data/doc/rdoc/files/lib/phusion_passenger/railz/framework_spawner_rb.html +0 -145
  195. data/doc/rdoc/files/lib/phusion_passenger/railz/request_handler_rb.html +0 -127
  196. data/doc/rdoc/files/lib/phusion_passenger/simple_benchmarking_rb.html +0 -122
  197. data/doc/rdoc/files/lib/phusion_passenger/spawn_manager_rb.html +0 -161
  198. data/doc/rdoc/files/lib/phusion_passenger/utils_rb.html +0 -175
  199. data/doc/rdoc/files/lib/phusion_passenger/wsgi/application_spawner_rb.html +0 -129
  200. data/doc/rdoc/files/misc/rake/extensions_rb.html +0 -130
  201. data/doc/rdoc/fr_class_index.html +0 -90
  202. data/doc/rdoc/fr_file_index.html +0 -76
  203. data/doc/rdoc/fr_method_index.html +0 -195
  204. data/doc/rdoc/index.html +0 -26
  205. data/doc/rdoc/rdoc-style.css +0 -187
  206. data/vendor/rack-0.9.1/AUTHORS +0 -8
  207. data/vendor/rack-0.9.1/ChangeLog +0 -1423
  208. data/vendor/rack-0.9.1/Rakefile +0 -188
  209. data/vendor/rack-0.9.1/SPEC +0 -129
  210. data/vendor/rack-0.9.1/lib/rack/auth/abstract/handler.rb +0 -28
  211. data/vendor/rack-0.9.1/lib/rack/auth/openid.rb +0 -438
  212. data/vendor/rack-0.9.1/lib/rack/deflater.rb +0 -87
  213. data/vendor/rack-0.9.1/lib/rack/reloader.rb +0 -64
  214. data/vendor/rack-0.9.1/lib/rack/session/abstract/id.rb +0 -153
  215. data/vendor/rack-0.9.1/lib/rack/session/memcache.rb +0 -97
  216. data/vendor/rack-0.9.1/lib/rack/session/pool.rb +0 -73
@@ -1,184 +0,0 @@
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::Rack::RequestHandler</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::Rack::RequestHandler</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/rack/request_handler_rb.html">lib/phusion_passenger/rack/request_handler.rb</a>
61
- </td>
62
- </tr>
63
- <tr>
64
- <td>Parent:</td>
65
- <td>
66
- AbstractRequestHandler
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
- A request handler for <a href="../Rack.html">Rack</a> applications.
80
- </p>
81
- </div>
82
-
83
-
84
-
85
- <div class="sectiontitle">Methods</div>
86
- <ul>
87
- <li><a href="#M000056">new</a></li>
88
- <li><a href="#M000057">process_request</a></li>
89
- </ul>
90
-
91
-
92
-
93
-
94
-
95
-
96
- <div class="sectiontitle">Public Class methods</div>
97
- <div class="method">
98
- <div class="title">
99
- <a name="M000056"></a><b>new</b>(owner_pipe, app, options = {})
100
- </div>
101
- <div class="description">
102
- <p>
103
- <tt>app</tt> is the <a href="../Rack.html">Rack</a> application object.
104
- </p>
105
- </div>
106
- <div class="sourcecode">
107
- <p class="source-link">[ <a href="javascript:toggleSource('M000056_source')" id="l_M000056_source">show source</a> ]</p>
108
- <div id="M000056_source" class="dyn-source">
109
- <pre>
110
- <span class="ruby-comment cmt"># File lib/phusion_passenger/rack/request_handler.rb, line 50</span>
111
- 50: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">initialize</span>(<span class="ruby-identifier">owner_pipe</span>, <span class="ruby-identifier">app</span>, <span class="ruby-identifier">options</span> = {})
112
- 51: <span class="ruby-keyword kw">super</span>(<span class="ruby-identifier">owner_pipe</span>, <span class="ruby-identifier">options</span>)
113
- 52: <span class="ruby-ivar">@app</span> = <span class="ruby-identifier">app</span>
114
- 53: <span class="ruby-keyword kw">end</span>
115
- </pre>
116
- </div>
117
- </div>
118
- </div>
119
- <div class="sectiontitle">Protected Instance methods</div>
120
- <div class="method">
121
- <div class="title">
122
- <a name="M000057"></a><b>process_request</b>(env, input, output)
123
- </div>
124
- <div class="description">
125
- <p>
126
- Overrided method.
127
- </p>
128
- </div>
129
- <div class="sourcecode">
130
- <p class="source-link">[ <a href="javascript:toggleSource('M000057_source')" id="l_M000057_source">show source</a> ]</p>
131
- <div id="M000057_source" class="dyn-source">
132
- <pre>
133
- <span class="ruby-comment cmt"># File lib/phusion_passenger/rack/request_handler.rb, line 57</span>
134
- 57: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">process_request</span>(<span class="ruby-identifier">env</span>, <span class="ruby-identifier">input</span>, <span class="ruby-identifier">output</span>)
135
- 58: <span class="ruby-identifier">env</span>[<span class="ruby-constant">RACK_VERSION</span>] = <span class="ruby-constant">RACK_VERSION_VALUE</span>
136
- 59: <span class="ruby-identifier">env</span>[<span class="ruby-constant">RACK_INPUT</span>] = <span class="ruby-identifier">input</span>
137
- 60: <span class="ruby-identifier">env</span>[<span class="ruby-constant">RACK_ERRORS</span>] = <span class="ruby-constant">STDERR</span>
138
- 61: <span class="ruby-identifier">env</span>[<span class="ruby-constant">RACK_MULTITHREAD</span>] = <span class="ruby-keyword kw">false</span>
139
- 62: <span class="ruby-identifier">env</span>[<span class="ruby-constant">RACK_MULTIPROCESS</span>] = <span class="ruby-keyword kw">true</span>
140
- 63: <span class="ruby-identifier">env</span>[<span class="ruby-constant">RACK_RUN_ONCE</span>] = <span class="ruby-keyword kw">false</span>
141
- 64: <span class="ruby-identifier">env</span>[<span class="ruby-constant">SCRIPT_NAME</span>] <span class="ruby-operator">||=</span> <span class="ruby-value str">''</span>
142
- 65: <span class="ruby-keyword kw">if</span> <span class="ruby-constant">ENV</span>.<span class="ruby-identifier">has_key?</span>(<span class="ruby-constant">PATH_INFO</span>)
143
- 66: <span class="ruby-identifier">env</span>[<span class="ruby-constant">PATH_INFO</span>].<span class="ruby-identifier">sub!</span>(<span class="ruby-node">/^#{Regexp.escape(env[SCRIPT_NAME])}/</span>, <span class="ruby-value str">&quot;&quot;</span>)
144
- 67: <span class="ruby-keyword kw">end</span>
145
- 68: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">env</span>[<span class="ruby-constant">HTTPS</span>] <span class="ruby-operator">==</span> <span class="ruby-constant">YES</span> <span class="ruby-operator">||</span> <span class="ruby-identifier">env</span>[<span class="ruby-constant">HTTPS</span>] <span class="ruby-operator">==</span> <span class="ruby-constant">ON</span> <span class="ruby-operator">||</span> <span class="ruby-identifier">env</span>[<span class="ruby-constant">HTTPS</span>] <span class="ruby-operator">==</span> <span class="ruby-constant">ONE</span>
146
- 69: <span class="ruby-identifier">env</span>[<span class="ruby-constant">RACK_URL_SCHEME</span>] = <span class="ruby-constant">HTTPS_DOWNCASE</span>
147
- 70: <span class="ruby-keyword kw">else</span>
148
- 71: <span class="ruby-identifier">env</span>[<span class="ruby-constant">RACK_URL_SCHEME</span>] = <span class="ruby-constant">HTTP</span>
149
- 72: <span class="ruby-keyword kw">end</span>
150
- 73:
151
- 74: <span class="ruby-identifier">status</span>, <span class="ruby-identifier">headers</span>, <span class="ruby-identifier">body</span> = <span class="ruby-ivar">@app</span>.<span class="ruby-identifier">call</span>(<span class="ruby-identifier">env</span>)
152
- 75: <span class="ruby-keyword kw">begin</span>
153
- 76: <span class="ruby-identifier">output</span>.<span class="ruby-identifier">write</span>(<span class="ruby-node">&quot;Status: #{status}#{CRLF}&quot;</span>)
154
- 77: <span class="ruby-identifier">headers</span>[<span class="ruby-constant">X_POWERED_BY</span>] = <span class="ruby-constant">PASSENGER_HEADER</span>
155
- 78: <span class="ruby-identifier">headers</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">values</span><span class="ruby-operator">|</span>
156
- 79: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">values</span>.<span class="ruby-identifier">is_a?</span>(<span class="ruby-constant">String</span>)
157
- 80: <span class="ruby-identifier">values</span> = <span class="ruby-identifier">values</span>.<span class="ruby-identifier">split</span>(<span class="ruby-value str">&quot;\n&quot;</span>)
158
- 81: <span class="ruby-keyword kw">end</span>
159
- 82: <span class="ruby-identifier">values</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">value</span><span class="ruby-operator">|</span>
160
- 83: <span class="ruby-identifier">output</span>.<span class="ruby-identifier">write</span>(<span class="ruby-node">&quot;#{key}: #{value}#{CRLF}&quot;</span>)
161
- 84: <span class="ruby-keyword kw">end</span>
162
- 85: <span class="ruby-keyword kw">end</span>
163
- 86: <span class="ruby-identifier">output</span>.<span class="ruby-identifier">write</span>(<span class="ruby-constant">CRLF</span>)
164
- 87: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">body</span>.<span class="ruby-identifier">is_a?</span>(<span class="ruby-constant">String</span>)
165
- 88: <span class="ruby-identifier">output</span>.<span class="ruby-identifier">write</span>(<span class="ruby-identifier">body</span>)
166
- 89: <span class="ruby-keyword kw">elsif</span> <span class="ruby-identifier">body</span>
167
- 90: <span class="ruby-identifier">body</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">s</span><span class="ruby-operator">|</span>
168
- 91: <span class="ruby-identifier">output</span>.<span class="ruby-identifier">write</span>(<span class="ruby-identifier">s</span>)
169
- 92: <span class="ruby-keyword kw">end</span>
170
- 93: <span class="ruby-keyword kw">end</span>
171
- 94: <span class="ruby-keyword kw">ensure</span>
172
- 95: <span class="ruby-identifier">body</span>.<span class="ruby-identifier">close</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">body</span>.<span class="ruby-identifier">respond_to?</span>(<span class="ruby-identifier">:close</span>)
173
- 96: <span class="ruby-keyword kw">end</span>
174
- 97: <span class="ruby-keyword kw">end</span>
175
- </pre>
176
- </div>
177
- </div>
178
- </div>
179
- </div>
180
-
181
- </div>
182
-
183
- </body>
184
- </html>
@@ -1,95 +0,0 @@
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>Module: PhusionPassenger::Railz</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">Module</span><br />PhusionPassenger::Railz</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/railz/application_spawner_rb.html">lib/phusion_passenger/railz/application_spawner.rb</a>
61
- <a href="../../files/lib/phusion_passenger/railz/cgi_fixed_rb.html">lib/phusion_passenger/railz/cgi_fixed.rb</a>
62
- <a href="../../files/lib/phusion_passenger/railz/framework_spawner_rb.html">lib/phusion_passenger/railz/framework_spawner.rb</a>
63
- <a href="../../files/lib/phusion_passenger/railz/request_handler_rb.html">lib/phusion_passenger/railz/request_handler.rb</a>
64
- </td>
65
- </tr>
66
- </table>
67
- </td>
68
- </tr>
69
- </table>
70
- <!-- banner header -->
71
-
72
- <div id="bodyContent">
73
- <div id="content">
74
-
75
-
76
-
77
-
78
-
79
-
80
-
81
- <div class="sectiontitle">Classes and Modules</div>
82
- Class <a href="Railz/ApplicationSpawner.html" class="link">PhusionPassenger::Railz::ApplicationSpawner</a><br />
83
- Class <a href="Railz/CGIFixed.html" class="link">PhusionPassenger::Railz::CGIFixed</a><br />
84
- Class <a href="Railz/FrameworkSpawner.html" class="link">PhusionPassenger::Railz::FrameworkSpawner</a><br />
85
- Class <a href="Railz/RequestHandler.html" class="link">PhusionPassenger::Railz::RequestHandler</a><br />
86
-
87
-
88
-
89
-
90
- </div>
91
-
92
- </div>
93
-
94
- </body>
95
- </html>
@@ -1,419 +0,0 @@
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::Railz::ApplicationSpawner</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::Railz::ApplicationSpawner</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/railz/application_spawner_rb.html">lib/phusion_passenger/railz/application_spawner.rb</a>
61
- </td>
62
- </tr>
63
- <tr>
64
- <td>Parent:</td>
65
- <td>
66
- AbstractServer
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
- This class is capable of spawning instances of a single Ruby on Rails
80
- application. It does so by preloading as much of the application&#8216;s
81
- code as possible, then creating instances of the application using what is
82
- already preloaded. This makes it spawning application instances very fast,
83
- except for the first spawn.
84
- </p>
85
- <p>
86
- Use multiple instances of <a
87
- href="ApplicationSpawner.html">ApplicationSpawner</a> if you need to spawn
88
- multiple different Ruby on Rails applications.
89
- </p>
90
- <p>
91
- <b>Note</b>: <a href="ApplicationSpawner.html">ApplicationSpawner</a> may
92
- only be started asynchronously with <a
93
- href="../AbstractServer.html#M000126">AbstractServer#start</a>. Starting it
94
- synchronously with <a
95
- href="../AbstractServer.html#M000127">AbstractServer#start_synchronously</a>
96
- has not been tested.
97
- </p>
98
- </div>
99
-
100
-
101
-
102
- <div class="sectiontitle">Methods</div>
103
- <ul>
104
- <li><a href="#M000048">new</a></li>
105
- <li><a href="#M000049">spawn_application</a></li>
106
- <li><a href="#M000050">spawn_application!</a></li>
107
- <li><a href="#M000051">start</a></li>
108
- </ul>
109
-
110
- <div class="sectiontitle">Included Modules</div>
111
- <ul>
112
- <li><a href="../Utils.html">Utils</a></li>
113
- </ul>
114
-
115
-
116
- <div class="sectiontitle">Classes and Modules</div>
117
- Class <a href="ApplicationSpawner/Error.html" class="link">PhusionPassenger::Railz::ApplicationSpawner::Error</a><br />
118
-
119
-
120
- <div class="sectiontitle">Constants</div>
121
- <table border='0' cellpadding='5'>
122
- <tr valign='top'>
123
- <td class="attr-name">ROOT_UID</td>
124
- <td>=</td>
125
- <td class="attr-value">0</td>
126
- </tr>
127
- <tr valign='top'>
128
- <td>&nbsp;</td>
129
- <td colspan="2" class="attr-desc">
130
- The user ID of the root user.
131
-
132
- </td>
133
- </tr>
134
- <tr valign='top'>
135
- <td class="attr-name">ROOT_GID</td>
136
- <td>=</td>
137
- <td class="attr-value">0</td>
138
- </tr>
139
- <tr valign='top'>
140
- <td>&nbsp;</td>
141
- <td colspan="2" class="attr-desc">
142
- The group ID of the root user.
143
-
144
- </td>
145
- </tr>
146
- </table>
147
-
148
- <div class="sectiontitle">Attributes</div>
149
- <table border='0' cellpadding='5'>
150
- <tr valign='top'>
151
- <td class='attr-rw'>
152
- [R]
153
- </td>
154
- <td class='attr-name'>app_root</td>
155
- <td class='attr-desc'>
156
- The application root of this spawner.
157
-
158
- </td>
159
- </tr>
160
- </table>
161
-
162
- <div class="sectiontitle">Public Class methods</div>
163
- <div class="method">
164
- <div class="title">
165
- <a name="M000048"></a><b>new</b>(app_root, options = {})
166
- </div>
167
- <div class="description">
168
- <p>
169
- <tt>app_root</tt> is the root directory of this application, i.e. the
170
- directory that contains &#8216;app/&#8217;, &#8216;public/&#8217;, etc. If
171
- given an invalid directory, or a directory that doesn&#8216;t appear to be
172
- a Rails application root directory, then an <a
173
- href="../InvalidPath.html">InvalidPath</a> will be raised.
174
- </p>
175
- <p>
176
- Additional options are:
177
- </p>
178
- <ul>
179
- <li><tt>lower_privilege</tt> and <tt>lowest_user</tt>: If
180
- <tt>lower_privilege</tt> is true, then <a
181
- href="ApplicationSpawner.html">ApplicationSpawner</a> will attempt to
182
- switch to the user who owns the application&#8216;s
183
- <tt>config/environment.rb</tt>, and to the default group of that user.
184
-
185
- <p>
186
- If that user doesn&#8216;t exist on the system, or if that user is root,
187
- then <a href="ApplicationSpawner.html">ApplicationSpawner</a> will attempt
188
- to switch to the username given by <tt>lowest_user</tt> (and to the default
189
- group of that user). If <tt>lowest_user</tt> doesn&#8216;t exist either, or
190
- if switching user failed (because the current process does not have the
191
- privilege to do so), then <a
192
- href="ApplicationSpawner.html">ApplicationSpawner</a> will continue without
193
- reporting an error.
194
- </p>
195
- </li>
196
- <li><tt>environment</tt>: Allows one to specify the RAILS_ENV environment to
197
- use.
198
-
199
- </li>
200
- </ul>
201
- <p>
202
- All other options will be passed on to <a
203
- href="RequestHandler.html">RequestHandler</a>.
204
- </p>
205
- </div>
206
- <div class="sourcecode">
207
- <p class="source-link">[ <a href="javascript:toggleSource('M000048_source')" id="l_M000048_source">show source</a> ]</p>
208
- <div id="M000048_source" class="dyn-source">
209
- <pre>
210
- <span class="ruby-comment cmt"># File lib/phusion_passenger/railz/application_spawner.rb, line 88</span>
211
- 88: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">initialize</span>(<span class="ruby-identifier">app_root</span>, <span class="ruby-identifier">options</span> = {})
212
- 89: <span class="ruby-keyword kw">super</span>()
213
- 90: <span class="ruby-ivar">@app_root</span> = <span class="ruby-identifier">app_root</span>
214
- 91: <span class="ruby-ivar">@canonicalized_app_root</span> = <span class="ruby-identifier">canonicalize_path</span>(<span class="ruby-identifier">app_root</span>)
215
- 92: <span class="ruby-ivar">@options</span> = <span class="ruby-identifier">sanitize_spawn_options</span>(<span class="ruby-identifier">options</span>)
216
- 93: <span class="ruby-ivar">@lower_privilege</span> = <span class="ruby-ivar">@options</span>[<span class="ruby-value str">&quot;lower_privilege&quot;</span>]
217
- 94: <span class="ruby-ivar">@lowest_user</span> = <span class="ruby-ivar">@options</span>[<span class="ruby-value str">&quot;lowest_user&quot;</span>]
218
- 95: <span class="ruby-ivar">@environment</span> = <span class="ruby-ivar">@options</span>[<span class="ruby-value str">&quot;environment&quot;</span>]
219
- 96: <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">max_idle_time</span> = <span class="ruby-constant">DEFAULT_APP_SPAWNER_MAX_IDLE_TIME</span>
220
- 97: <span class="ruby-identifier">assert_valid_app_root</span>(<span class="ruby-ivar">@app_root</span>)
221
- 98: <span class="ruby-identifier">define_message_handler</span>(<span class="ruby-identifier">:spawn_application</span>, <span class="ruby-identifier">:handle_spawn_application</span>)
222
- 99: <span class="ruby-keyword kw">end</span>
223
- </pre>
224
- </div>
225
- </div>
226
- </div>
227
- <div class="sectiontitle">Public Instance methods</div>
228
- <div class="method">
229
- <div class="title">
230
- <a name="M000049"></a><b>spawn_application</b>()
231
- </div>
232
- <div class="description">
233
- <p>
234
- Spawn an instance of the RoR application. When successful, an <a
235
- href="../Application.html">Application</a> object will be returned, which
236
- represents the spawned RoR application.
237
- </p>
238
- <p>
239
- Raises:
240
- </p>
241
- <ul>
242
- <li><a
243
- href="../AbstractServer/ServerNotStarted.html">AbstractServer::ServerNotStarted</a>:
244
- The <a href="ApplicationSpawner.html">ApplicationSpawner</a> server
245
- hasn&#8216;t already been started.
246
-
247
- </li>
248
- <li><a href="ApplicationSpawner/Error.html">ApplicationSpawner::Error</a>: The
249
- <a href="ApplicationSpawner.html">ApplicationSpawner</a> server exited
250
- unexpectedly.
251
-
252
- </li>
253
- </ul>
254
- </div>
255
- <div class="sourcecode">
256
- <p class="source-link">[ <a href="javascript:toggleSource('M000049_source')" id="l_M000049_source">show source</a> ]</p>
257
- <div id="M000049_source" class="dyn-source">
258
- <pre>
259
- <span class="ruby-comment cmt"># File lib/phusion_passenger/railz/application_spawner.rb, line 107</span>
260
- 107: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">spawn_application</span>
261
- 108: <span class="ruby-identifier">server</span>.<span class="ruby-identifier">write</span>(<span class="ruby-value str">&quot;spawn_application&quot;</span>)
262
- 109: <span class="ruby-identifier">pid</span>, <span class="ruby-identifier">socket_name</span>, <span class="ruby-identifier">socket_type</span> = <span class="ruby-identifier">server</span>.<span class="ruby-identifier">read</span>
263
- 110: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">pid</span>.<span class="ruby-identifier">nil?</span>
264
- 111: <span class="ruby-identifier">raise</span> <span class="ruby-constant">IOError</span>, <span class="ruby-value str">&quot;Connection closed&quot;</span>
265
- 112: <span class="ruby-keyword kw">end</span>
266
- 113: <span class="ruby-identifier">owner_pipe</span> = <span class="ruby-identifier">server</span>.<span class="ruby-identifier">recv_io</span>
267
- 114: <span class="ruby-keyword kw">return</span> <span class="ruby-constant">Application</span>.<span class="ruby-identifier">new</span>(<span class="ruby-ivar">@app_root</span>, <span class="ruby-identifier">pid</span>, <span class="ruby-identifier">socket_name</span>,
268
- 115: <span class="ruby-identifier">socket_type</span>, <span class="ruby-identifier">owner_pipe</span>)
269
- 116: <span class="ruby-keyword kw">rescue</span> <span class="ruby-constant">SystemCallError</span>, <span class="ruby-constant">IOError</span>, <span class="ruby-constant">SocketError</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">e</span>
270
- 117: <span class="ruby-identifier">raise</span> <span class="ruby-constant">Error</span>, <span class="ruby-node">&quot;The application spawner server exited unexpectedly: #{e}&quot;</span>
271
- 118: <span class="ruby-keyword kw">end</span>
272
- </pre>
273
- </div>
274
- </div>
275
- </div>
276
- <div class="method">
277
- <div class="title">
278
- <a name="M000050"></a><b>spawn_application!</b>()
279
- </div>
280
- <div class="description">
281
- <p>
282
- Spawn an instance of the RoR application. When successful, an <a
283
- href="../Application.html">Application</a> object will be returned, which
284
- represents the spawned RoR application.
285
- </p>
286
- <p>
287
- Unlike <a href="ApplicationSpawner.html#M000049">spawn_application</a>,
288
- this method may be called even when the <a
289
- href="ApplicationSpawner.html">ApplicationSpawner</a> server isn&#8216;t
290
- started. This allows one to spawn a RoR application without preloading any
291
- source files.
292
- </p>
293
- <p>
294
- This method may only be called if no Rails framework has been loaded in the
295
- current Ruby VM.
296
- </p>
297
- <p>
298
- Raises:
299
- </p>
300
- <ul>
301
- <li><a href="../AppInitError.html">AppInitError</a>: The Ruby on Rails
302
- application raised an exception or called exit() during startup.
303
-
304
- </li>
305
- <li>SystemCallError, IOError, SocketError: Something went wrong.
306
-
307
- </li>
308
- </ul>
309
- </div>
310
- <div class="sourcecode">
311
- <p class="source-link">[ <a href="javascript:toggleSource('M000050_source')" id="l_M000050_source">show source</a> ]</p>
312
- <div id="M000050_source" class="dyn-source">
313
- <pre>
314
- <span class="ruby-comment cmt"># File lib/phusion_passenger/railz/application_spawner.rb, line 134</span>
315
- 134: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">spawn_application!</span>
316
- 135: <span class="ruby-identifier">a</span>, <span class="ruby-identifier">b</span> = <span class="ruby-constant">UNIXSocket</span>.<span class="ruby-identifier">pair</span>
317
- 136: <span class="ruby-identifier">pid</span> = <span class="ruby-identifier">safe_fork</span>(<span class="ruby-value str">'application'</span>, <span class="ruby-keyword kw">true</span>) <span class="ruby-keyword kw">do</span>
318
- 137: <span class="ruby-keyword kw">begin</span>
319
- 138: <span class="ruby-identifier">a</span>.<span class="ruby-identifier">close</span>
320
- 139:
321
- 140: <span class="ruby-identifier">file_descriptors_to_leave_open</span> = [<span class="ruby-value">0</span>, <span class="ruby-value">1</span>, <span class="ruby-value">2</span>, <span class="ruby-identifier">b</span>.<span class="ruby-identifier">fileno</span>]
322
- 141: <span class="ruby-constant">NativeSupport</span>.<span class="ruby-identifier">close_all_file_descriptors</span>(<span class="ruby-identifier">file_descriptors_to_leave_open</span>)
323
- 142: <span class="ruby-identifier">close_all_io_objects_for_fds</span>(<span class="ruby-identifier">file_descriptors_to_leave_open</span>)
324
- 143:
325
- 144: <span class="ruby-identifier">channel</span> = <span class="ruby-constant">MessageChannel</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">b</span>)
326
- 145: <span class="ruby-identifier">success</span> = <span class="ruby-identifier">report_app_init_status</span>(<span class="ruby-identifier">channel</span>) <span class="ruby-keyword kw">do</span>
327
- 146: <span class="ruby-constant">ENV</span>[<span class="ruby-value str">'RAILS_ENV'</span>] = <span class="ruby-ivar">@environment</span>
328
- 147: <span class="ruby-constant">Dir</span>.<span class="ruby-identifier">chdir</span>(<span class="ruby-ivar">@app_root</span>)
329
- 148: <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@lower_privilege</span>
330
- 149: <span class="ruby-identifier">lower_privilege</span>(<span class="ruby-value str">'config/environment.rb'</span>, <span class="ruby-ivar">@lowest_user</span>)
331
- 150: <span class="ruby-keyword kw">end</span>
332
- 151:
333
- 152: <span class="ruby-comment cmt"># require Rails' environment, using the same path as the original rails dispatcher,</span>
334
- 153: <span class="ruby-comment cmt"># which normally does: require File.dirname(__FILE__) + &quot;/../config/environment&quot;</span>
335
- 154: <span class="ruby-comment cmt"># thus avoiding the possibility of including the same file twice.</span>
336
- 155: <span class="ruby-identifier">require</span> <span class="ruby-value str">'public/../config/environment'</span>
337
- 156:
338
- 157: <span class="ruby-identifier">require</span> <span class="ruby-value str">'dispatcher'</span>
339
- 158: <span class="ruby-keyword kw">end</span>
340
- 159: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">success</span>
341
- 160: <span class="ruby-identifier">start_request_handler</span>(<span class="ruby-identifier">channel</span>, <span class="ruby-keyword kw">false</span>)
342
- 161: <span class="ruby-keyword kw">end</span>
343
- 162: <span class="ruby-keyword kw">rescue</span> <span class="ruby-constant">SignalException</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">e</span>
344
- 163: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">e</span>.<span class="ruby-identifier">message</span> <span class="ruby-operator">!=</span> <span class="ruby-constant">AbstractRequestHandler</span><span class="ruby-operator">::</span><span class="ruby-constant">HARD_TERMINATION_SIGNAL</span> <span class="ruby-operator">&amp;&amp;</span>
345
- 164: <span class="ruby-identifier">e</span>.<span class="ruby-identifier">message</span> <span class="ruby-operator">!=</span> <span class="ruby-constant">AbstractRequestHandler</span><span class="ruby-operator">::</span><span class="ruby-constant">SOFT_TERMINATION_SIGNAL</span>
346
- 165: <span class="ruby-identifier">raise</span>
347
- 166: <span class="ruby-keyword kw">end</span>
348
- 167: <span class="ruby-keyword kw">end</span>
349
- 168: <span class="ruby-keyword kw">end</span>
350
- 169: <span class="ruby-identifier">b</span>.<span class="ruby-identifier">close</span>
351
- 170: <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>
352
- 171:
353
- 172: <span class="ruby-identifier">channel</span> = <span class="ruby-constant">MessageChannel</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">a</span>)
354
- 173: <span class="ruby-identifier">unmarshal_and_raise_errors</span>(<span class="ruby-identifier">channel</span>)
355
- 174:
356
- 175: <span class="ruby-comment cmt"># No exception was raised, so spawning succeeded.</span>
357
- 176: <span class="ruby-identifier">pid</span>, <span class="ruby-identifier">socket_name</span>, <span class="ruby-identifier">socket_type</span> = <span class="ruby-identifier">channel</span>.<span class="ruby-identifier">read</span>
358
- 177: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">pid</span>.<span class="ruby-identifier">nil?</span>
359
- 178: <span class="ruby-identifier">raise</span> <span class="ruby-constant">IOError</span>, <span class="ruby-value str">&quot;Connection closed&quot;</span>
360
- 179: <span class="ruby-keyword kw">end</span>
361
- 180: <span class="ruby-identifier">owner_pipe</span> = <span class="ruby-identifier">channel</span>.<span class="ruby-identifier">recv_io</span>
362
- 181: <span class="ruby-keyword kw">return</span> <span class="ruby-constant">Application</span>.<span class="ruby-identifier">new</span>(<span class="ruby-ivar">@app_root</span>, <span class="ruby-identifier">pid</span>, <span class="ruby-identifier">socket_name</span>,
363
- 182: <span class="ruby-identifier">socket_type</span>, <span class="ruby-identifier">owner_pipe</span>)
364
- 183: <span class="ruby-keyword kw">end</span>
365
- </pre>
366
- </div>
367
- </div>
368
- </div>
369
- <div class="method">
370
- <div class="title">
371
- <a name="M000051"></a><b>start</b>()
372
- </div>
373
- <div class="description">
374
- <p>
375
- Overrided from <a
376
- href="../AbstractServer.html#M000126">AbstractServer#start</a>.
377
- </p>
378
- <p>
379
- May raise these additional exceptions:
380
- </p>
381
- <ul>
382
- <li><a href="../AppInitError.html">AppInitError</a>: The Ruby on Rails
383
- application raised an exception or called exit() during startup.
384
-
385
- </li>
386
- <li><a href="ApplicationSpawner/Error.html">ApplicationSpawner::Error</a>: The
387
- <a href="ApplicationSpawner.html">ApplicationSpawner</a> server exited
388
- unexpectedly.
389
-
390
- </li>
391
- </ul>
392
- </div>
393
- <div class="sourcecode">
394
- <p class="source-link">[ <a href="javascript:toggleSource('M000051_source')" id="l_M000051_source">show source</a> ]</p>
395
- <div id="M000051_source" class="dyn-source">
396
- <pre>
397
- <span class="ruby-comment cmt"># File lib/phusion_passenger/railz/application_spawner.rb, line 191</span>
398
- 191: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">start</span>
399
- 192: <span class="ruby-keyword kw">super</span>
400
- 193: <span class="ruby-keyword kw">begin</span>
401
- 194: <span class="ruby-identifier">unmarshal_and_raise_errors</span>(<span class="ruby-identifier">server</span>)
402
- 195: <span class="ruby-keyword kw">rescue</span> <span class="ruby-constant">IOError</span>, <span class="ruby-constant">SystemCallError</span>, <span class="ruby-constant">SocketError</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">e</span>
403
- 196: <span class="ruby-identifier">stop</span>
404
- 197: <span class="ruby-identifier">raise</span> <span class="ruby-constant">Error</span>, <span class="ruby-node">&quot;The application spawner server exited unexpectedly: #{e}&quot;</span>
405
- 198: <span class="ruby-keyword kw">rescue</span>
406
- 199: <span class="ruby-identifier">stop</span>
407
- 200: <span class="ruby-identifier">raise</span>
408
- 201: <span class="ruby-keyword kw">end</span>
409
- 202: <span class="ruby-keyword kw">end</span>
410
- </pre>
411
- </div>
412
- </div>
413
- </div>
414
- </div>
415
-
416
- </div>
417
-
418
- </body>
419
- </html>