passenger 1.0.1 → 1.0.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 (123) hide show
  1. data/LICENSE +3 -1
  2. data/Rakefile +17 -12
  3. data/bin/passenger-config +22 -0
  4. data/bin/passenger-install-apache2-module +2 -31
  5. data/bin/passenger-make-enterprisey +66 -0
  6. data/bin/passenger-memory-stats +192 -0
  7. data/doc/Users guide.html +150 -66
  8. data/doc/Users guide.txt +141 -51
  9. data/doc/cxxapi/ApplicationPoolClientServer_8h-source.html +1 -1
  10. data/doc/cxxapi/ApplicationPoolServer_8h-source.html +545 -0
  11. data/doc/cxxapi/ApplicationPool_8h-source.html +1 -1
  12. data/doc/cxxapi/Application_8h-source.html +1 -1
  13. data/doc/cxxapi/Configuration_8h-source.html +2 -2
  14. data/doc/cxxapi/DummySpawnManager_8h-source.html +1 -1
  15. data/doc/cxxapi/Exceptions_8h-source.html +1 -1
  16. data/doc/cxxapi/Hooks_8h-source.html +1 -1
  17. data/doc/cxxapi/Logging_8h-source.html +1 -1
  18. data/doc/cxxapi/MessageChannel_8h-source.html +210 -205
  19. data/doc/cxxapi/SpawnManager_8h-source.html +1 -1
  20. data/doc/cxxapi/StandardApplicationPool_8h-source.html +1 -1
  21. data/doc/cxxapi/Utils_8h-source.html +1 -1
  22. data/doc/cxxapi/annotated.html +1 -1
  23. data/doc/cxxapi/classClient-members.html +30 -0
  24. data/doc/cxxapi/classClient.html +112 -0
  25. data/doc/cxxapi/classPassenger_1_1Application-members.html +1 -1
  26. data/doc/cxxapi/classPassenger_1_1Application.html +1 -1
  27. data/doc/cxxapi/classPassenger_1_1ApplicationPool-members.html +1 -1
  28. data/doc/cxxapi/classPassenger_1_1ApplicationPool.html +1 -1
  29. data/doc/cxxapi/classPassenger_1_1ApplicationPoolServer-members.html +1 -1
  30. data/doc/cxxapi/classPassenger_1_1ApplicationPoolServer.html +1 -1
  31. data/doc/cxxapi/classPassenger_1_1Application_1_1Session-members.html +1 -1
  32. data/doc/cxxapi/classPassenger_1_1Application_1_1Session.html +1 -1
  33. data/doc/cxxapi/classPassenger_1_1ConfigurationException-members.html +28 -0
  34. data/doc/cxxapi/classPassenger_1_1ConfigurationException.html +41 -0
  35. data/doc/cxxapi/classPassenger_1_1DummySpawnManager-members.html +1 -1
  36. data/doc/cxxapi/classPassenger_1_1DummySpawnManager.html +1 -1
  37. data/doc/cxxapi/classPassenger_1_1FileNotFoundException-members.html +1 -1
  38. data/doc/cxxapi/classPassenger_1_1FileNotFoundException.html +1 -1
  39. data/doc/cxxapi/classPassenger_1_1IOException-members.html +1 -1
  40. data/doc/cxxapi/classPassenger_1_1IOException.html +1 -1
  41. data/doc/cxxapi/classPassenger_1_1MessageChannel-members.html +1 -1
  42. data/doc/cxxapi/classPassenger_1_1MessageChannel.html +1 -1
  43. data/doc/cxxapi/classPassenger_1_1SpawnException-members.html +1 -1
  44. data/doc/cxxapi/classPassenger_1_1SpawnException.html +1 -1
  45. data/doc/cxxapi/classPassenger_1_1SpawnManager-members.html +1 -1
  46. data/doc/cxxapi/classPassenger_1_1SpawnManager.html +1 -1
  47. data/doc/cxxapi/classPassenger_1_1StandardApplicationPool-members.html +1 -1
  48. data/doc/cxxapi/classPassenger_1_1StandardApplicationPool.html +1 -1
  49. data/doc/cxxapi/classPassenger_1_1SystemException-members.html +1 -1
  50. data/doc/cxxapi/classPassenger_1_1SystemException.html +1 -1
  51. data/doc/cxxapi/definitions_8h-source.html +1 -1
  52. data/doc/cxxapi/files.html +1 -1
  53. data/doc/cxxapi/functions.html +1 -1
  54. data/doc/cxxapi/functions_func.html +1 -1
  55. data/doc/cxxapi/functions_type.html +1 -1
  56. data/doc/cxxapi/graph_legend.html +1 -1
  57. data/doc/cxxapi/graph_legend.png +0 -0
  58. data/doc/cxxapi/group__Configuration.html +3 -3
  59. data/doc/cxxapi/group__Configuration.png +0 -0
  60. data/doc/cxxapi/group__Core.html +1 -1
  61. data/doc/cxxapi/group__Core.png +0 -0
  62. data/doc/cxxapi/group__Exceptions.html +1 -1
  63. data/doc/cxxapi/group__Hooks.html +1 -1
  64. data/doc/cxxapi/group__Hooks.png +0 -0
  65. data/doc/cxxapi/group__Support.html +1 -1
  66. data/doc/cxxapi/hierarchy.html +1 -1
  67. data/doc/cxxapi/inherit__graph__0.png +0 -0
  68. data/doc/cxxapi/inherit__graph__1.png +0 -0
  69. data/doc/cxxapi/inherit__graph__10.map +1 -0
  70. data/doc/cxxapi/inherit__graph__10.md5 +1 -0
  71. data/doc/cxxapi/inherit__graph__10.png +0 -0
  72. data/doc/cxxapi/inherit__graph__2.png +0 -0
  73. data/doc/cxxapi/inherit__graph__3.png +0 -0
  74. data/doc/cxxapi/inherit__graph__4.png +0 -0
  75. data/doc/cxxapi/inherit__graph__5.png +0 -0
  76. data/doc/cxxapi/inherit__graph__6.png +0 -0
  77. data/doc/cxxapi/inherit__graph__7.png +0 -0
  78. data/doc/cxxapi/inherit__graph__8.png +0 -0
  79. data/doc/cxxapi/inherit__graph__9.png +0 -0
  80. data/doc/cxxapi/inherits.html +1 -1
  81. data/doc/cxxapi/main.html +1 -1
  82. data/doc/cxxapi/modules.html +1 -1
  83. data/doc/cxxapi/structPassenger_1_1AnythingToString-members.html +1 -1
  84. data/doc/cxxapi/structPassenger_1_1AnythingToString.html +1 -1
  85. data/doc/cxxapi/structPassenger_1_1AnythingToString_3_01vector_3_01string_01_4_01_4-members.html +1 -1
  86. data/doc/cxxapi/structPassenger_1_1AnythingToString_3_01vector_3_01string_01_4_01_4.html +1 -1
  87. data/doc/rdoc/classes/Passenger/RequestHandler.html +84 -74
  88. data/doc/rdoc/classes/Passenger/SpawnManager.html +54 -49
  89. data/doc/rdoc/classes/PlatformInfo.html +25 -12
  90. data/doc/rdoc/created.rid +1 -1
  91. data/doc/rdoc/files/DEVELOPERS_TXT.html +1 -1
  92. data/doc/rdoc/files/ext/passenger/native_support_c.html +1 -1
  93. data/doc/rdoc/files/lib/passenger/abstract_server_rb.html +1 -1
  94. data/doc/rdoc/files/lib/passenger/application_spawner_rb.html +1 -1
  95. data/doc/rdoc/files/lib/passenger/dependencies_rb.html +1 -1
  96. data/doc/rdoc/files/lib/passenger/framework_spawner_rb.html +1 -1
  97. data/doc/rdoc/files/lib/passenger/platform_info_rb.html +1 -1
  98. data/doc/rdoc/files/lib/passenger/request_handler_rb.html +1 -1
  99. data/doc/rdoc/files/lib/passenger/spawn_manager_rb.html +1 -1
  100. data/ext/apache2/Configuration.h +1 -1
  101. data/ext/apache2/Hooks.cpp +68 -16
  102. data/ext/apache2/Logging.cpp +1 -1
  103. data/ext/apache2/MessageChannel.h +48 -43
  104. data/ext/passenger/native_support.c +46 -43
  105. data/lib/passenger/application_spawner.rb +37 -4
  106. data/lib/passenger/dependencies.rb +5 -1
  107. data/lib/passenger/framework_spawner.rb +2 -0
  108. data/lib/passenger/platform_info.rb +32 -17
  109. data/lib/passenger/request_handler.rb +10 -1
  110. data/lib/passenger/spawn_manager.rb +14 -8
  111. data/lib/passenger/templates/error_layout.html.erb +2 -2
  112. data/test/CxxTestMain.cpp +1 -0
  113. data/test/MessageChannelTest.cpp +3 -1
  114. data/test/application_spawner_spec.rb +2 -0
  115. data/test/framework_spawner_spec.rb +2 -0
  116. data/test/integration_tests.rb +1 -0
  117. data/test/spawn_manager_spec.rb +2 -0
  118. data/test/spawner_privilege_lowering_spec.rb +1 -0
  119. data/test/stub/minimal-railsapp/vendor/rails/actionpack/lib/action_controller.rb +4 -0
  120. data/test/stub/minimal-railsapp/vendor/rails/activerecord/lib/active_record.rb +7 -0
  121. data/test/stub/rails_apps/foobar/config/environments/test.rb +22 -0
  122. metadata +28 -22
  123. data/lib/passenger/templates/osx_broken_apache_warning.txt.erb +0 -23
@@ -184,19 +184,19 @@ href="SpawnManager.html">SpawnManager</a> is no longer needed.
184
184
  <p class="source-link">[ <a href="javascript:toggleSource('M000048_source')" id="l_M000048_source">show source</a> ]</p>
185
185
  <div id="M000048_source" class="dyn-source">
186
186
  <pre>
187
- <span class="ruby-comment cmt"># File lib/passenger/spawn_manager.rb, line 160</span>
188
- 160: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">cleanup</span>
189
- 161: <span class="ruby-ivar">@lock</span>.<span class="ruby-identifier">synchronize</span> <span class="ruby-keyword kw">do</span>
190
- 162: <span class="ruby-ivar">@cond</span>.<span class="ruby-identifier">signal</span>
191
- 163: <span class="ruby-keyword kw">end</span>
192
- 164: <span class="ruby-ivar">@cleaner_thread</span>.<span class="ruby-identifier">join</span>
193
- 165: <span class="ruby-ivar">@lock</span>.<span class="ruby-identifier">synchronize</span> <span class="ruby-keyword kw">do</span>
194
- 166: <span class="ruby-ivar">@spawners</span>.<span class="ruby-identifier">each_value</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">spawner</span><span class="ruby-operator">|</span>
195
- 167: <span class="ruby-identifier">spawner</span>.<span class="ruby-identifier">stop</span>
196
- 168: <span class="ruby-keyword kw">end</span>
197
- 169: <span class="ruby-ivar">@spawners</span>.<span class="ruby-identifier">clear</span>
198
- 170: <span class="ruby-keyword kw">end</span>
199
- 171: <span class="ruby-keyword kw">end</span>
187
+ <span class="ruby-comment cmt"># File lib/passenger/spawn_manager.rb, line 165</span>
188
+ 165: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">cleanup</span>
189
+ 166: <span class="ruby-ivar">@lock</span>.<span class="ruby-identifier">synchronize</span> <span class="ruby-keyword kw">do</span>
190
+ 167: <span class="ruby-ivar">@cond</span>.<span class="ruby-identifier">signal</span>
191
+ 168: <span class="ruby-keyword kw">end</span>
192
+ 169: <span class="ruby-ivar">@cleaner_thread</span>.<span class="ruby-identifier">join</span>
193
+ 170: <span class="ruby-ivar">@lock</span>.<span class="ruby-identifier">synchronize</span> <span class="ruby-keyword kw">do</span>
194
+ 171: <span class="ruby-ivar">@spawners</span>.<span class="ruby-identifier">each_value</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">spawner</span><span class="ruby-operator">|</span>
195
+ 172: <span class="ruby-identifier">spawner</span>.<span class="ruby-identifier">stop</span>
196
+ 173: <span class="ruby-keyword kw">end</span>
197
+ 174: <span class="ruby-ivar">@spawners</span>.<span class="ruby-identifier">clear</span>
198
+ 175: <span class="ruby-keyword kw">end</span>
199
+ 176: <span class="ruby-keyword kw">end</span>
200
200
  </pre>
201
201
  </div>
202
202
  </div>
@@ -228,32 +228,32 @@ Raises AbstractServer::SpawnError if something went wrong.
228
228
  <p class="source-link">[ <a href="javascript:toggleSource('M000047_source')" id="l_M000047_source">show source</a> ]</p>
229
229
  <div id="M000047_source" class="dyn-source">
230
230
  <pre>
231
- <span class="ruby-comment cmt"># File lib/passenger/spawn_manager.rb, line 133</span>
232
- 133: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">reload</span>(<span class="ruby-identifier">app_root</span> = <span class="ruby-keyword kw">nil</span>)
233
- 134: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">app_root</span>
234
- 135: <span class="ruby-keyword kw">begin</span>
235
- 136: <span class="ruby-identifier">app_root</span> = <span class="ruby-identifier">normalize_path</span>(<span class="ruby-identifier">app_root</span>)
236
- 137: <span class="ruby-keyword kw">rescue</span> <span class="ruby-constant">ArgumentError</span>
237
- 138: <span class="ruby-keyword kw">end</span>
238
- 139: <span class="ruby-keyword kw">end</span>
239
- 140: <span class="ruby-ivar">@lock</span>.<span class="ruby-identifier">synchronize</span> <span class="ruby-keyword kw">do</span>
240
- 141: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">app_root</span>
241
- 142: <span class="ruby-comment cmt"># Delete associated ApplicationSpawner.</span>
242
- 143: <span class="ruby-identifier">key</span> = <span class="ruby-node">&quot;app:#{app_root}&quot;</span>
243
- 144: <span class="ruby-identifier">spawner</span> = <span class="ruby-ivar">@spawners</span>[<span class="ruby-identifier">key</span>]
244
- 145: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">spawner</span>
245
- 146: <span class="ruby-identifier">spawner</span>.<span class="ruby-identifier">stop</span>
246
- 147: <span class="ruby-ivar">@spawners</span>.<span class="ruby-identifier">delete</span>(<span class="ruby-identifier">key</span>)
247
- 148: <span class="ruby-keyword kw">end</span>
248
- 149: <span class="ruby-keyword kw">end</span>
249
- 150: <span class="ruby-ivar">@spawners</span>.<span class="ruby-identifier">each_value</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">spawner</span><span class="ruby-operator">|</span>
250
- 151: <span class="ruby-comment cmt"># Reload FrameworkSpawners.</span>
251
- 152: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">spawner</span>.<span class="ruby-identifier">respond_to?</span>(<span class="ruby-identifier">:reload</span>)
252
- 153: <span class="ruby-identifier">spawner</span>.<span class="ruby-identifier">reload</span>(<span class="ruby-identifier">app_root</span>)
253
- 154: <span class="ruby-keyword kw">end</span>
254
- 155: <span class="ruby-keyword kw">end</span>
255
- 156: <span class="ruby-keyword kw">end</span>
256
- 157: <span class="ruby-keyword kw">end</span>
231
+ <span class="ruby-comment cmt"># File lib/passenger/spawn_manager.rb, line 138</span>
232
+ 138: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">reload</span>(<span class="ruby-identifier">app_root</span> = <span class="ruby-keyword kw">nil</span>)
233
+ 139: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">app_root</span>
234
+ 140: <span class="ruby-keyword kw">begin</span>
235
+ 141: <span class="ruby-identifier">app_root</span> = <span class="ruby-identifier">normalize_path</span>(<span class="ruby-identifier">app_root</span>)
236
+ 142: <span class="ruby-keyword kw">rescue</span> <span class="ruby-constant">ArgumentError</span>
237
+ 143: <span class="ruby-keyword kw">end</span>
238
+ 144: <span class="ruby-keyword kw">end</span>
239
+ 145: <span class="ruby-ivar">@lock</span>.<span class="ruby-identifier">synchronize</span> <span class="ruby-keyword kw">do</span>
240
+ 146: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">app_root</span>
241
+ 147: <span class="ruby-comment cmt"># Delete associated ApplicationSpawner.</span>
242
+ 148: <span class="ruby-identifier">key</span> = <span class="ruby-node">&quot;app:#{app_root}&quot;</span>
243
+ 149: <span class="ruby-identifier">spawner</span> = <span class="ruby-ivar">@spawners</span>[<span class="ruby-identifier">key</span>]
244
+ 150: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">spawner</span>
245
+ 151: <span class="ruby-identifier">spawner</span>.<span class="ruby-identifier">stop</span>
246
+ 152: <span class="ruby-ivar">@spawners</span>.<span class="ruby-identifier">delete</span>(<span class="ruby-identifier">key</span>)
247
+ 153: <span class="ruby-keyword kw">end</span>
248
+ 154: <span class="ruby-keyword kw">end</span>
249
+ 155: <span class="ruby-ivar">@spawners</span>.<span class="ruby-identifier">each_value</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">spawner</span><span class="ruby-operator">|</span>
250
+ 156: <span class="ruby-comment cmt"># Reload FrameworkSpawners.</span>
251
+ 157: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">spawner</span>.<span class="ruby-identifier">respond_to?</span>(<span class="ruby-identifier">:reload</span>)
252
+ 158: <span class="ruby-identifier">spawner</span>.<span class="ruby-identifier">reload</span>(<span class="ruby-identifier">app_root</span>)
253
+ 159: <span class="ruby-keyword kw">end</span>
254
+ 160: <span class="ruby-keyword kw">end</span>
255
+ 161: <span class="ruby-keyword kw">end</span>
256
+ 162: <span class="ruby-keyword kw">end</span>
257
257
  </pre>
258
258
  </div>
259
259
  </div>
@@ -351,16 +351,21 @@ exception or called exit() during startup.
351
351
  106: <span class="ruby-identifier">spawner</span>.<span class="ruby-identifier">start</span>
352
352
  107: <span class="ruby-ivar">@spawners</span>[<span class="ruby-identifier">key</span>] = <span class="ruby-identifier">spawner</span>
353
353
  108: <span class="ruby-keyword kw">end</span>
354
- 109: <span class="ruby-keyword kw">end</span>
355
- 110:
356
- 111: <span class="ruby-identifier">spawner</span>.<span class="ruby-identifier">time</span> = <span class="ruby-constant">Time</span>.<span class="ruby-identifier">now</span>
357
- 112: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">spawner</span>.<span class="ruby-identifier">is_a?</span>(<span class="ruby-constant">FrameworkSpawner</span>)
358
- 113: <span class="ruby-keyword kw">return</span> <span class="ruby-identifier">spawner</span>.<span class="ruby-identifier">spawn_application</span>(<span class="ruby-identifier">app_root</span>, <span class="ruby-identifier">lower_privilege</span>,
359
- 114: <span class="ruby-identifier">lowest_user</span>)
360
- 115: <span class="ruby-keyword kw">else</span>
361
- 116: <span class="ruby-keyword kw">return</span> <span class="ruby-identifier">spawner</span>.<span class="ruby-identifier">spawn_application</span>
362
- 117: <span class="ruby-keyword kw">end</span>
363
- 118: <span class="ruby-keyword kw">end</span>
354
+ 109: <span class="ruby-identifier">spawner</span>.<span class="ruby-identifier">time</span> = <span class="ruby-constant">Time</span>.<span class="ruby-identifier">now</span>
355
+ 110: <span class="ruby-keyword kw">begin</span>
356
+ 111: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">spawner</span>.<span class="ruby-identifier">is_a?</span>(<span class="ruby-constant">FrameworkSpawner</span>)
357
+ 112: <span class="ruby-keyword kw">return</span> <span class="ruby-identifier">spawner</span>.<span class="ruby-identifier">spawn_application</span>(<span class="ruby-identifier">app_root</span>, <span class="ruby-identifier">lower_privilege</span>,
358
+ 113: <span class="ruby-identifier">lowest_user</span>)
359
+ 114: <span class="ruby-keyword kw">else</span>
360
+ 115: <span class="ruby-keyword kw">return</span> <span class="ruby-identifier">spawner</span>.<span class="ruby-identifier">spawn_application</span>
361
+ 116: <span class="ruby-keyword kw">end</span>
362
+ 117: <span class="ruby-keyword kw">rescue</span> <span class="ruby-constant">AbstractServer</span><span class="ruby-operator">::</span><span class="ruby-constant">ServerError</span>
363
+ 118: <span class="ruby-identifier">spawner</span>.<span class="ruby-identifier">stop</span>
364
+ 119: <span class="ruby-ivar">@spawners</span>.<span class="ruby-identifier">delete</span>(<span class="ruby-identifier">key</span>)
365
+ 120: <span class="ruby-identifier">raise</span>
366
+ 121: <span class="ruby-keyword kw">end</span>
367
+ 122: <span class="ruby-keyword kw">end</span>
368
+ 123: <span class="ruby-keyword kw">end</span>
364
369
  </pre>
365
370
  </div>
366
371
  </div>
@@ -177,6 +177,19 @@ The absolute path to the &#8216;apachectl&#8217; or
177
177
  The absolute path to the Apache binary (that is, &#8216;httpd&#8217;,
178
178
  &#8216;httpd2&#8217;, &#8216;apache&#8217; or &#8216;apache2&#8217;).
179
179
 
180
+ </td>
181
+ </tr>
182
+ <tr valign='top'>
183
+ <td class="attr-name">APR_CONFIG</td>
184
+ <td>=</td>
185
+ <td class="attr-value">find_apr_config</td>
186
+ </tr>
187
+ <tr valign='top'>
188
+ <td>&nbsp;</td>
189
+ <td colspan="2" class="attr-desc">
190
+ The absolute path to the &#8216;apr-config&#8217; or
191
+ &#8216;apr-1-config&#8217; executable.
192
+
180
193
  </td>
181
194
  </tr>
182
195
  <tr valign='top'>
@@ -192,9 +205,9 @@ The C compiler flags that are necessary to compile an Apache module.
192
205
  </td>
193
206
  </tr>
194
207
  <tr valign='top'>
195
- <td class="attr-name">APR1_LIBS</td>
208
+ <td class="attr-name">APR_LIBS</td>
196
209
  <td>=</td>
197
- <td class="attr-value">determine_apr1_info</td>
210
+ <td class="attr-value">determine_apr_info</td>
198
211
  </tr>
199
212
  <tr valign='top'>
200
213
  <td class="attr-name">MULTI_ARCH_FLAGS</td>
@@ -257,16 +270,16 @@ always behave correctly, for some weird reason.
257
270
  <p class="source-link">[ <a href="javascript:toggleSource('M000007_source')" id="l_M000007_source">show source</a> ]</p>
258
271
  <div id="M000007_source" class="dyn-source">
259
272
  <pre>
260
- <span class="ruby-comment cmt"># File lib/passenger/platform_info.rb, line 209</span>
261
- 209: <span class="ruby-keyword kw">def</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">find_command</span>(<span class="ruby-identifier">name</span>)
262
- 210: <span class="ruby-constant">ENV</span>[<span class="ruby-value str">'PATH'</span>].<span class="ruby-identifier">split</span>(<span class="ruby-constant">File</span><span class="ruby-operator">::</span><span class="ruby-constant">PATH_SEPARATOR</span>).<span class="ruby-identifier">detect</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">directory</span><span class="ruby-operator">|</span>
263
- 211: <span class="ruby-identifier">path</span> = <span class="ruby-constant">File</span>.<span class="ruby-identifier">join</span>(<span class="ruby-identifier">directory</span>, <span class="ruby-identifier">name</span>.<span class="ruby-identifier">to_s</span>)
264
- 212: <span class="ruby-keyword kw">if</span> <span class="ruby-constant">File</span>.<span class="ruby-identifier">executable?</span>(<span class="ruby-identifier">path</span>)
265
- 213: <span class="ruby-keyword kw">return</span> <span class="ruby-identifier">path</span>
266
- 214: <span class="ruby-keyword kw">end</span>
267
- 215: <span class="ruby-keyword kw">end</span>
268
- 216: <span class="ruby-keyword kw">return</span> <span class="ruby-keyword kw">nil</span>
269
- 217: <span class="ruby-keyword kw">end</span>
273
+ <span class="ruby-comment cmt"># File lib/passenger/platform_info.rb, line 222</span>
274
+ 222: <span class="ruby-keyword kw">def</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">find_command</span>(<span class="ruby-identifier">name</span>)
275
+ 223: <span class="ruby-constant">ENV</span>[<span class="ruby-value str">'PATH'</span>].<span class="ruby-identifier">split</span>(<span class="ruby-constant">File</span><span class="ruby-operator">::</span><span class="ruby-constant">PATH_SEPARATOR</span>).<span class="ruby-identifier">detect</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">directory</span><span class="ruby-operator">|</span>
276
+ 224: <span class="ruby-identifier">path</span> = <span class="ruby-constant">File</span>.<span class="ruby-identifier">join</span>(<span class="ruby-identifier">directory</span>, <span class="ruby-identifier">name</span>.<span class="ruby-identifier">to_s</span>)
277
+ 225: <span class="ruby-keyword kw">if</span> <span class="ruby-constant">File</span>.<span class="ruby-identifier">executable?</span>(<span class="ruby-identifier">path</span>)
278
+ 226: <span class="ruby-keyword kw">return</span> <span class="ruby-identifier">path</span>
279
+ 227: <span class="ruby-keyword kw">end</span>
280
+ 228: <span class="ruby-keyword kw">end</span>
281
+ 229: <span class="ruby-keyword kw">return</span> <span class="ruby-keyword kw">nil</span>
282
+ 230: <span class="ruby-keyword kw">end</span>
270
283
  </pre>
271
284
  </div>
272
285
  </div>
@@ -1 +1 @@
1
- Fri, 11 Apr 2008 18:15:58 +0200
1
+ Tue, 29 Apr 2008 15:25:26 +0200
@@ -63,7 +63,7 @@
63
63
  </tr>
64
64
  <tr>
65
65
  <td>Modified:</td>
66
- <td>Wed Mar 19 03:01:37 +0100 2008</td>
66
+ <td>Mon Apr 28 11:44:32 +0200 2008</td>
67
67
  </tr>
68
68
  </table>
69
69
  </td></tr>
@@ -63,7 +63,7 @@
63
63
  </tr>
64
64
  <tr>
65
65
  <td>Modified:</td>
66
- <td>Thu Apr 03 17:44:37 +0200 2008</td>
66
+ <td>Mon Apr 28 23:34:04 +0200 2008</td>
67
67
  </tr>
68
68
  </table>
69
69
  </td></tr>
@@ -63,7 +63,7 @@
63
63
  </tr>
64
64
  <tr>
65
65
  <td>Modified:</td>
66
- <td>Thu Apr 03 17:46:22 +0200 2008</td>
66
+ <td>Tue Apr 15 10:49:37 +0200 2008</td>
67
67
  </tr>
68
68
  </table>
69
69
  </td></tr>
@@ -63,7 +63,7 @@
63
63
  </tr>
64
64
  <tr>
65
65
  <td>Modified:</td>
66
- <td>Thu Apr 03 17:46:23 +0200 2008</td>
66
+ <td>Mon Apr 28 23:34:04 +0200 2008</td>
67
67
  </tr>
68
68
  </table>
69
69
  </td></tr>
@@ -63,7 +63,7 @@
63
63
  </tr>
64
64
  <tr>
65
65
  <td>Modified:</td>
66
- <td>Thu Apr 03 19:27:29 +0200 2008</td>
66
+ <td>Mon Apr 28 23:34:04 +0200 2008</td>
67
67
  </tr>
68
68
  </table>
69
69
  </td></tr>
@@ -63,7 +63,7 @@
63
63
  </tr>
64
64
  <tr>
65
65
  <td>Modified:</td>
66
- <td>Thu Apr 03 17:46:23 +0200 2008</td>
66
+ <td>Mon Apr 28 23:34:04 +0200 2008</td>
67
67
  </tr>
68
68
  </table>
69
69
  </td></tr>
@@ -63,7 +63,7 @@
63
63
  </tr>
64
64
  <tr>
65
65
  <td>Modified:</td>
66
- <td>Thu Apr 03 17:46:23 +0200 2008</td>
66
+ <td>Mon Apr 28 23:34:04 +0200 2008</td>
67
67
  </tr>
68
68
  </table>
69
69
  </td></tr>
@@ -63,7 +63,7 @@
63
63
  </tr>
64
64
  <tr>
65
65
  <td>Modified:</td>
66
- <td>Mon Apr 07 16:27:09 +0200 2008</td>
66
+ <td>Mon Apr 28 23:34:04 +0200 2008</td>
67
67
  </tr>
68
68
  </table>
69
69
  </td></tr>
@@ -63,7 +63,7 @@
63
63
  </tr>
64
64
  <tr>
65
65
  <td>Modified:</td>
66
- <td>Thu Apr 03 17:46:23 +0200 2008</td>
66
+ <td>Mon Apr 28 23:34:04 +0200 2008</td>
67
67
  </tr>
68
68
  </table>
69
69
  </td></tr>
@@ -29,7 +29,7 @@
29
29
  */
30
30
 
31
31
  /** Module version number. */
32
- #define PASSENGER_VERSION "1.0.1"
32
+ #define PASSENGER_VERSION "1.0.2"
33
33
 
34
34
  #ifdef __cplusplus
35
35
  #include <set>
@@ -259,6 +259,33 @@ private:
259
259
  buffer.append(hdrs[i].val);
260
260
  buffer.append(1, '\0');
261
261
  }
262
+
263
+ /*
264
+ * If the last header value is an empty string, then the buffer
265
+ * will end with "\0\0". For example, if 'SSLOptions +ExportCertData'
266
+ * is set, and there's no client certificate, and 'SSL_CLIENT_CERT'
267
+ * is the last header, then the buffer will end with:
268
+ *
269
+ * "SSL_CLIENT_CERT\0\0"
270
+ *
271
+ * The data in the buffer will be processed by the RequestHandler class,
272
+ * which is implemented in Ruby. But it uses Hash[*data.split("\0")] to
273
+ * unserialize the data. Unfortunately String#split will not transform
274
+ * the trailing "\0\0" into an empty string:
275
+ *
276
+ * "SSL_CLIENT_CERT\0\0".split("\0")
277
+ * # => desired result: ["SSL_CLIENT_CERT", ""]
278
+ * # => actual result: ["SSL_CLIENT_CERT"]
279
+ *
280
+ * When that happens, Hash[..] will raise an ArgumentError because
281
+ * data.split("\0") does not return an array with a length that is a
282
+ * multiple of 2.
283
+ *
284
+ * So here, we add a dummy header to prevent situations like that from
285
+ * happening.
286
+ */
287
+ buffer.append("_\0_\0", 4);
288
+
262
289
  session->sendHeaders(buffer);
263
290
  return APR_SUCCESS;
264
291
  }
@@ -329,7 +356,7 @@ public:
329
356
  applicationPool->setMax(config->maxPoolSize);
330
357
  applicationPool->setMaxIdleTime(config->poolIdleTime);
331
358
  } catch (const exception &e) {
332
- fprintf(stderr, "*** Cannot initialize Passenger: %s", e.what());
359
+ fprintf(stderr, "*** Cannot initialize Passenger: %s\n", e.what());
333
360
  fflush(stderr);
334
361
  abort();
335
362
  }
@@ -351,9 +378,12 @@ public:
351
378
  } else if (!verifyRailsDir(railsDir)) {
352
379
  ap_set_content_type(r, "text/html; charset=UTF-8");
353
380
  ap_rputs("<h1>Passenger error #2</h1>\n", r);
354
- ap_rputs("Passenger thinks that the Rails application's \"public\" directory is \"", r);
381
+ ap_rputs("Passenger thought that the Rails application's \"public\" directory is \"", r);
355
382
  ap_rputs(ap_escape_html(r->pool, railsDir.c_str()), r);
356
- ap_rputs("\", but it doesn't seem to be valid.", r);
383
+ ap_rputs("\". But upon further inspection, it doesn't seem to be a valid Rails ", r);
384
+ ap_rputs("\"public\" folder. It is possible that Apache doesn't have read ", r);
385
+ ap_rputs("permissions to your Rails application's folder. Please check your ", r);
386
+ ap_rputs("file permissions.", r);
357
387
  return OK;
358
388
  }
359
389
 
@@ -423,9 +453,10 @@ public:
423
453
  mapToStorage(request_rec *r) {
424
454
  DirConfig *config = getDirConfig(r);
425
455
  bool forwardToRails;
456
+ const char *baseURI;
426
457
 
427
- if (determineRailsBaseURI(r, config) == NULL
428
- || fileExists(r->filename)) {
458
+ baseURI = determineRailsBaseURI(r, config);
459
+ if (baseURI == NULL || fileExists(r->filename)) {
429
460
  /*
430
461
  * fileExists():
431
462
  * If the file already exists, serve it directly.
@@ -487,6 +518,12 @@ public:
487
518
  * interfere.
488
519
  */
489
520
  return OK;
521
+ } else if (strcmp(r->uri, baseURI) == 0) {
522
+ /* But we ignore RailsAllowModRewrite for the base URI of
523
+ * the Rails application. Otherwise, Apache will show a
524
+ * directory listing. This fixes issue #11.
525
+ */
526
+ return OK;
490
527
  } else {
491
528
  return DECLINED;
492
529
  }
@@ -518,24 +555,36 @@ destroy_hooks(void *arg) {
518
555
  static int
519
556
  init_module(apr_pool_t *pconf, apr_pool_t *plog, apr_pool_t *ptemp, server_rec *s) {
520
557
  /*
558
+ * The Apache initialization process has the following properties:
559
+ *
521
560
  * 1. Apache on Unix calls the post_config hook twice, once before detach() and once
522
561
  * after. On Windows it never calls detach().
523
562
  * 2. When Apache is compiled to use DSO modules, the modules are unloaded between the
524
563
  * two post_config hook calls.
525
- * 3. On Unix, if the -X commandline option is given, detach() will not be called.
564
+ * 3. On Unix, if the -X commandline option is given (the 'DEBUG' config is set),
565
+ * detach() will not be called.
566
+ *
567
+ * The Passenger initialization process is pretty expensive because a spawn server has
568
+ * to be started, so we'll want to avoid initializing twice because of property #2.
526
569
  *
527
- * Because of these 3 issues (and especially #2), we only want to intialize the second
528
- * time the post_config hook is called.
570
+ * The most straightforward solution is to initialize Passenger the second time
571
+ * post_config is called. But unfortunately, that doesn't work if the Passenger
572
+ * module is loaded after a graceful restart. There also doesn't seem to be any
573
+ * good hooks that we can use to avoid double initialization.
574
+ *
575
+ * So as a hack, we check whether Apache has already been daemonized, by checking
576
+ * whether ppid() returns 1. This doesn't work with Apache 2.0.x though: ppid()
577
+ * doesn't return 1. So Apache 2.0.x users will just have to live with the double
578
+ * initialization overhead.
529
579
  */
530
- void *firstInitCall = NULL;
531
- apr_pool_t *processPool = s->process->pool;
580
+ bool passengerShouldBeInitialized;
532
581
 
533
- apr_pool_userdata_get(&firstInitCall, "mod_passenger", processPool);
534
- if (firstInitCall == NULL) {
535
- apr_pool_userdata_set((const void *) 1, "mod_passenger",
536
- apr_pool_cleanup_null, processPool);
537
- return OK;
538
- } else {
582
+ #if (AP_SERVER_MAJORVERSION_NUMBER == 2 && AP_SERVER_MINORVERSION_NUMBER >= 2) || AP_SERVER_MAJORVERSION_NUMBER > 2
583
+ passengerShouldBeInitialized = getppid() == 1 || ap_exists_config_define("DEBUG");
584
+ #else
585
+ passengerShouldBeInitialized = true;
586
+ #endif
587
+ if (passengerShouldBeInitialized) {
539
588
  try {
540
589
  hooks = new Hooks(pconf, plog, ptemp, s);
541
590
  apr_pool_cleanup_register(pconf, NULL,
@@ -586,6 +635,8 @@ init_module(apr_pool_t *pconf, apr_pool_t *plog, apr_pool_t *ptemp, server_rec *
586
635
  hooks = NULL;
587
636
  return DECLINED;
588
637
  }
638
+ } else {
639
+ return OK;
589
640
  }
590
641
  }
591
642
 
@@ -628,3 +679,4 @@ passenger_register_hooks(apr_pool_t *p) {
628
679
  /**
629
680
  * @}
630
681
  */
682
+
@@ -21,7 +21,7 @@
21
21
 
22
22
  namespace Passenger {
23
23
 
24
- int _debugLevel = 3;
24
+ int _debugLevel = 2;
25
25
  ostream *_logStream = &cerr;
26
26
  ostream *_debugStream = &cerr;
27
27
 
@@ -256,31 +256,33 @@ public:
256
256
  * @see readFileDescriptor()
257
257
  */
258
258
  void writeFileDescriptor(int fileDescriptor) {
259
- struct msghdr msg;
260
- struct iovec vec[1];
261
- char buf[1];
262
259
  struct {
263
- struct cmsghdr hdr;
260
+ struct cmsghdr header;
264
261
  int fd;
265
- } cmsg;
266
-
262
+ } control;
263
+
264
+ control.header.cmsg_len = sizeof(control);
265
+ control.header.cmsg_level = SOL_SOCKET;
266
+ control.header.cmsg_type = SCM_RIGHTS;
267
+ control.fd = fileDescriptor;
268
+
269
+ struct msghdr msg;
270
+ struct iovec vec;
271
+ char dummy[1];
272
+
267
273
  msg.msg_name = NULL;
268
274
  msg.msg_namelen = 0;
269
-
270
- /* Linux and Solaris doesn't work if msg_iov is NULL. */
271
- buf[0] = '\0';
272
- vec[0].iov_base = buf;
273
- vec[0].iov_len = 1;
274
- msg.msg_iov = vec;
275
+
276
+ /* Linux and Solaris require msg_iov to be non-NULL.. */
277
+ dummy[0] = '\0';
278
+ vec.iov_base = dummy;
279
+ vec.iov_len = sizeof(dummy);
280
+ msg.msg_iov = &vec;
275
281
  msg.msg_iovlen = 1;
276
-
277
- msg.msg_control = (caddr_t)&cmsg;
278
- msg.msg_controllen = CMSG_SPACE(sizeof(int));
279
- msg.msg_flags = 0;
280
- cmsg.hdr.cmsg_len = CMSG_LEN(sizeof(int));
281
- cmsg.hdr.cmsg_level = SOL_SOCKET;
282
- cmsg.hdr.cmsg_type = SCM_RIGHTS;
283
- cmsg.fd = fileDescriptor;
282
+
283
+ msg.msg_control = (caddr_t) &control;
284
+ msg.msg_controllen = sizeof(control);
285
+ msg.msg_flags = 0;
284
286
 
285
287
  if (sendmsg(fd, &msg, 0) == -1) {
286
288
  throw SystemException("Cannot send file descriptor with sendmsg()", errno);
@@ -420,41 +422,44 @@ public:
420
422
  * file descriptor.
421
423
  */
422
424
  int readFileDescriptor() {
423
- struct msghdr msg;
424
- struct iovec vec[2];
425
- char buf[1];
426
425
  struct {
427
- struct cmsghdr hdr;
426
+ struct cmsghdr header;
428
427
  int fd;
429
- } cmsg;
428
+ } control;
430
429
 
431
- msg.msg_name = NULL;
430
+ control.header.cmsg_len = sizeof(control);
431
+ control.header.cmsg_level = SOL_SOCKET;
432
+ control.header.cmsg_type = SCM_RIGHTS;
433
+ control.fd = -1;
434
+
435
+ struct msghdr msg;
436
+ struct iovec vec;
437
+ char dummy[1];
438
+
439
+ msg.msg_name = NULL;
432
440
  msg.msg_namelen = 0;
433
-
434
- vec[0].iov_base = buf;
435
- vec[0].iov_len = sizeof(buf);
436
- msg.msg_iov = vec;
441
+
442
+ dummy[0] = '\0';
443
+ vec.iov_base = dummy;
444
+ vec.iov_len = sizeof(dummy);
445
+ msg.msg_iov = &vec;
437
446
  msg.msg_iovlen = 1;
438
447
 
439
- msg.msg_control = (caddr_t)&cmsg;
440
- msg.msg_controllen = CMSG_SPACE(sizeof(int));
441
- msg.msg_flags = 0;
442
- cmsg.hdr.cmsg_len = CMSG_LEN(sizeof(int));
443
- cmsg.hdr.cmsg_level = SOL_SOCKET;
444
- cmsg.hdr.cmsg_type = SCM_RIGHTS;
445
- cmsg.fd = -1;
448
+ msg.msg_control = (caddr_t) &control;
449
+ msg.msg_controllen = sizeof(control);
450
+ msg.msg_flags = 0;
446
451
 
447
452
  if (recvmsg(fd, &msg, 0) == -1) {
448
453
  throw SystemException("Cannot read file descriptor with recvmsg()", errno);
449
454
  }
450
-
451
- if (msg.msg_controllen != CMSG_SPACE(sizeof(int))
452
- || cmsg.hdr.cmsg_len != CMSG_SPACE(0) + sizeof(int)
453
- || cmsg.hdr.cmsg_level != SOL_SOCKET
454
- || cmsg.hdr.cmsg_type != SCM_RIGHTS) {
455
+
456
+ if (msg.msg_controllen != sizeof(control)
457
+ || control.header.cmsg_len != sizeof(control)
458
+ || control.header.cmsg_level != SOL_SOCKET
459
+ || control.header.cmsg_type != SCM_RIGHTS) {
455
460
  throw IOException("No valid file descriptor received.");
456
461
  }
457
- return cmsg.fd;
462
+ return control.fd;
458
463
  }
459
464
  };
460
465