passenger 4.0.45 → 4.0.46
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.
- checksums.yaml +8 -8
- checksums.yaml.gz.asc +7 -7
- data.tar.gz.asc +7 -7
- data/.editorconfig +19 -0
- data/CHANGELOG +47 -0
- data/CONTRIBUTING.md +9 -1
- data/CONTRIBUTORS +4 -0
- data/Vagrantfile +7 -3
- data/build/agents.rb +1 -0
- data/build/misc.rb +6 -4
- data/dev/vagrant/bashrc +2 -0
- data/doc/Design and Architecture.txt +9 -7
- data/doc/Users guide Apache.idmap.txt +2 -0
- data/doc/Users guide Apache.txt +24 -4
- data/doc/Users guide Nginx.idmap.txt +4 -0
- data/doc/Users guide Nginx.txt +23 -4
- data/doc/images/code_walkthrough.jpg +0 -0
- data/doc/users_guide_snippets/installation.txt +38 -0
- data/ext/common/AgentsStarter.h +6 -1
- data/ext/common/ApplicationPool2/Common.h +17 -2
- data/ext/common/ApplicationPool2/DirectSpawner.h +5 -11
- data/ext/common/ApplicationPool2/DummySpawner.h +2 -4
- data/ext/common/ApplicationPool2/ErrorRenderer.h +119 -0
- data/ext/common/ApplicationPool2/Implementation.cpp +159 -11
- data/ext/common/ApplicationPool2/Options.h +16 -7
- data/ext/common/ApplicationPool2/Pool.h +28 -24
- data/ext/common/ApplicationPool2/Process.h +1 -9
- data/ext/common/ApplicationPool2/SmartSpawner.h +15 -18
- data/ext/common/ApplicationPool2/Spawner.h +18 -14
- data/ext/common/ApplicationPool2/SpawnerFactory.h +12 -30
- data/ext/common/Constants.h +1 -1
- data/ext/common/Exceptions.h +15 -2
- data/ext/common/UnionStation/Core.h +9 -0
- data/ext/common/Utils/JsonUtils.h +53 -0
- data/ext/common/Utils/ProcessMetricsCollector.h +1 -1
- data/ext/common/Utils/SpeedMeter.h +7 -3
- data/ext/common/Utils/SystemMetricsCollector.h +8 -6
- data/ext/common/agents/HelperAgent/Main.cpp +4 -4
- data/ext/common/agents/HelperAgent/RequestHandler.h +115 -56
- data/ext/nginx/ConfigurationCommands.c +1 -1
- data/ext/nginx/ConfigurationCommands.c.erb +6 -1
- data/ext/nginx/ContentHandler.c +2 -1
- data/ext/nginx/config +1 -1
- data/helper-scripts/node-loader.js +23 -0
- data/helper-scripts/wsgi-loader.py +12 -4
- data/lib/phusion_passenger.rb +1 -1
- data/lib/phusion_passenger/active_support3_extensions/init.rb +39 -78
- data/lib/phusion_passenger/constants.rb +3 -1
- data/lib/phusion_passenger/loader_shared_helpers.rb +10 -5
- data/lib/phusion_passenger/nginx/config_options.rb +3 -1
- data/lib/phusion_passenger/packaging.rb +1 -0
- data/lib/phusion_passenger/public_api.rb +108 -16
- data/lib/phusion_passenger/rack/thread_handler_extension.rb +1 -0
- data/lib/phusion_passenger/request_handler.rb +2 -2
- data/lib/phusion_passenger/request_handler/thread_handler.rb +28 -46
- data/lib/phusion_passenger/standalone/command.rb +8 -1
- data/lib/phusion_passenger/standalone/main.rb +0 -1
- data/lib/phusion_passenger/standalone/start_command.rb +4 -0
- data/lib/phusion_passenger/union_station/connection.rb +67 -0
- data/lib/phusion_passenger/{analytics_logger.rb → union_station/core.rb} +55 -256
- data/lib/phusion_passenger/union_station/transaction.rb +168 -0
- data/lib/phusion_passenger/utils.rb +4 -0
- data/lib/phusion_passenger/utils/lock.rb +62 -0
- data/resources/mime.types +1 -0
- data/resources/templates/error_layout.html.template +2 -0
- data/resources/templates/standalone/config.erb +1 -0
- data/test/cxx/ApplicationPool2/DirectSpawnerTest.cpp +5 -3
- data/test/cxx/ApplicationPool2/PoolTest.cpp +13 -3
- data/test/cxx/ApplicationPool2/SmartSpawnerTest.cpp +16 -13
- data/test/cxx/ApplicationPool2/SpawnerTestCases.cpp +6 -0
- data/test/cxx/FileBackedPipeTest.cpp +1 -1
- data/test/cxx/RequestHandlerTest.cpp +158 -2
- data/test/cxx/ServerInstanceDirTest.cpp +2 -0
- data/test/cxx/TestSupport.h +21 -2
- data/test/cxx/UtilsTest.cpp +1 -0
- data/test/ruby/classic_rails/loader_spec.rb +0 -1
- data/test/ruby/classic_rails/preloader_spec.rb +0 -1
- data/test/ruby/rails3.0/loader_spec.rb +2 -2
- data/test/ruby/rails3.0/preloader_spec.rb +2 -2
- data/test/ruby/rails3.1/loader_spec.rb +2 -2
- data/test/ruby/rails3.1/preloader_spec.rb +2 -2
- data/test/ruby/rails3.2/loader_spec.rb +2 -2
- data/test/ruby/rails3.2/preloader_spec.rb +2 -2
- data/test/ruby/rails4.0/loader_spec.rb +2 -2
- data/test/ruby/rails4.0/preloader_spec.rb +2 -2
- data/test/ruby/request_handler_spec.rb +8 -8
- data/test/ruby/shared/rails/{analytics_logging_extensions_sharedspec.rb → union_station_extensions_sharedspec.rb} +5 -4
- data/test/ruby/union_station_spec.rb +283 -0
- data/test/stub/wsgi/passenger_wsgi.py +41 -5
- metadata +12 -7
- metadata.gz.asc +7 -7
- data/helper-scripts/wsgi-preloader.py +0 -1
- data/lib/phusion_passenger/standalone/package_runtime_command.rb +0 -105
- data/test/ruby/analytics_logger_spec.rb +0 -283
@@ -2,7 +2,7 @@ require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
|
|
2
2
|
PhusionPassenger.require_passenger_lib 'request_handler'
|
3
3
|
PhusionPassenger.require_passenger_lib 'request_handler/thread_handler'
|
4
4
|
PhusionPassenger.require_passenger_lib 'rack/thread_handler_extension'
|
5
|
-
PhusionPassenger.require_passenger_lib '
|
5
|
+
PhusionPassenger.require_passenger_lib 'union_station/core'
|
6
6
|
PhusionPassenger.require_passenger_lib 'utils'
|
7
7
|
|
8
8
|
require 'fileutils'
|
@@ -512,7 +512,7 @@ describe RequestHandler do
|
|
512
512
|
end
|
513
513
|
end
|
514
514
|
|
515
|
-
describe "if
|
515
|
+
describe "if Union Station core is given" do
|
516
516
|
def preinitialize
|
517
517
|
if @agent_pid
|
518
518
|
Process.kill('KILL', @agent_pid)
|
@@ -523,9 +523,9 @@ describe RequestHandler do
|
|
523
523
|
@agent_pid, @socket_filename, @socket_address = spawn_logging_agent(@dump_file,
|
524
524
|
@logging_agent_password)
|
525
525
|
|
526
|
-
@
|
526
|
+
@union_station_core = UnionStation::Core.new(@socket_address, "logging",
|
527
527
|
"1234", "localhost")
|
528
|
-
@options = { "
|
528
|
+
@options = { "union_station_core" => @union_station_core }
|
529
529
|
end
|
530
530
|
|
531
531
|
after :each do
|
@@ -543,8 +543,8 @@ describe RequestHandler do
|
|
543
543
|
header_value = nil
|
544
544
|
thread_value = nil
|
545
545
|
@thread_handler.any_instance.should_receive(:process_request).and_return do |headers, connection, full_http_response|
|
546
|
-
header_value = headers[
|
547
|
-
thread_value = Thread.current[
|
546
|
+
header_value = headers[UNION_STATION_REQUEST_TRANSACTION]
|
547
|
+
thread_value = Thread.current[UNION_STATION_REQUEST_TRANSACTION]
|
548
548
|
end
|
549
549
|
@request_handler.start_main_loop_thread
|
550
550
|
client = connect
|
@@ -557,8 +557,8 @@ describe RequestHandler do
|
|
557
557
|
ensure
|
558
558
|
client.close
|
559
559
|
end
|
560
|
-
header_value.should be_kind_of(
|
561
|
-
thread_value.should be_kind_of(
|
560
|
+
header_value.should be_kind_of(UnionStation::Transaction)
|
561
|
+
thread_value.should be_kind_of(UnionStation::Transaction)
|
562
562
|
header_value.should == thread_value
|
563
563
|
end
|
564
564
|
|
@@ -1,12 +1,12 @@
|
|
1
1
|
require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper')
|
2
2
|
require 'socket'
|
3
3
|
require 'fileutils'
|
4
|
-
PhusionPassenger.require_passenger_lib '
|
4
|
+
PhusionPassenger.require_passenger_lib 'union_station/core'
|
5
5
|
PhusionPassenger.require_passenger_lib 'utils/tmpdir'
|
6
6
|
|
7
7
|
module PhusionPassenger
|
8
8
|
|
9
|
-
shared_examples_for "
|
9
|
+
shared_examples_for "Union Station extensions for Rails" do
|
10
10
|
before :each do
|
11
11
|
@logging_agent_password = "1234"
|
12
12
|
@dump_file = "#{Utils.passenger_tmpdir}/log.txt"
|
@@ -43,13 +43,13 @@ shared_examples_for "analytics logging extensions for Rails" do
|
|
43
43
|
return [data].pack('m').gsub("\n", "")
|
44
44
|
end
|
45
45
|
|
46
|
-
it "doesn't install
|
46
|
+
it "doesn't install Union Station extensions if analytics logging is turned off" do
|
47
47
|
@options.delete("analytics")
|
48
48
|
File.write("#{@stub.app_root}/app/controllers/foo_controller.rb", %Q{
|
49
49
|
class FooController < ActionController::Base
|
50
50
|
def index
|
51
51
|
File.open("out.txt", "w") do |f|
|
52
|
-
f.write(request.env["
|
52
|
+
f.write(request.env["UNION_STATION_REQUEST_TRANSACTION"].class.to_s)
|
53
53
|
end
|
54
54
|
render :nothing => true
|
55
55
|
end
|
@@ -305,6 +305,7 @@ shared_examples_for "analytics logging extensions for Rails" do
|
|
305
305
|
File.write("#{@stub.app_root}/app/controllers/foo_controller.rb", %Q{
|
306
306
|
class FooController < ActionController::Base
|
307
307
|
def index
|
308
|
+
STDERR.puts 'hi'
|
308
309
|
Rails.cache.write("key1", "foo")
|
309
310
|
Rails.cache.write("key2", "foo")
|
310
311
|
Rails.cache.write("key3", "foo")
|
@@ -0,0 +1,283 @@
|
|
1
|
+
require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
|
2
|
+
require 'stringio'
|
3
|
+
PhusionPassenger.require_passenger_lib 'union_station/core'
|
4
|
+
|
5
|
+
module PhusionPassenger
|
6
|
+
|
7
|
+
describe UnionStation::Core do
|
8
|
+
YESTERDAY = Time.utc(2010, 4, 11, 11, 56, 02)
|
9
|
+
TODAY = Time.utc(2010, 4, 11, 12, 56, 02)
|
10
|
+
TOMORROW = Time.utc(2010, 4, 11, 13, 56, 02)
|
11
|
+
|
12
|
+
before :each do
|
13
|
+
@username = "logging"
|
14
|
+
@password = "1234"
|
15
|
+
@dump_file = Utils.passenger_tmpdir + "/transaction.txt"
|
16
|
+
start_agent
|
17
|
+
@core = UnionStation::Core.new(@socket_address, @username, @password, "localhost")
|
18
|
+
@core2 = UnionStation::Core.new(@socket_address, @username, @password, "localhost")
|
19
|
+
end
|
20
|
+
|
21
|
+
after :each do
|
22
|
+
@core.close
|
23
|
+
@core2.close
|
24
|
+
if @agent_pid
|
25
|
+
Process.kill('KILL', @agent_pid)
|
26
|
+
Process.waitpid(@agent_pid)
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
30
|
+
def mock_time(time)
|
31
|
+
UnionStation::Core.stub(:current_time).and_return(time)
|
32
|
+
end
|
33
|
+
|
34
|
+
def start_agent
|
35
|
+
@agent_pid, @socket_filename, @socket_address = spawn_logging_agent(@dump_file, @password)
|
36
|
+
end
|
37
|
+
|
38
|
+
def kill_agent
|
39
|
+
if @agent_pid
|
40
|
+
Process.kill('KILL', @agent_pid)
|
41
|
+
Process.waitpid(@agent_pid)
|
42
|
+
File.unlink(@socket_filename)
|
43
|
+
@agent_pid = nil
|
44
|
+
end
|
45
|
+
end
|
46
|
+
|
47
|
+
specify "logging with #new_transaction works" do
|
48
|
+
mock_time(TODAY)
|
49
|
+
|
50
|
+
transaction = @core.new_transaction("foobar")
|
51
|
+
transaction.should_not be_null
|
52
|
+
begin
|
53
|
+
transaction.message("hello")
|
54
|
+
ensure
|
55
|
+
transaction.close(true)
|
56
|
+
end
|
57
|
+
|
58
|
+
File.read(@dump_file).should =~ /hello/
|
59
|
+
|
60
|
+
transaction = @core.new_transaction("foobar", :processes)
|
61
|
+
transaction.should_not be_null
|
62
|
+
begin
|
63
|
+
transaction.message("world")
|
64
|
+
ensure
|
65
|
+
transaction.close(true)
|
66
|
+
end
|
67
|
+
|
68
|
+
File.read(@dump_file).should =~ /world/
|
69
|
+
end
|
70
|
+
|
71
|
+
specify "#new_transaction reestablishes the connection if disconnected" do
|
72
|
+
mock_time(TODAY)
|
73
|
+
|
74
|
+
@core.new_transaction("foobar").close(true)
|
75
|
+
connection = @core.instance_variable_get(:"@connection")
|
76
|
+
connection.synchronize do
|
77
|
+
connection.channel.close
|
78
|
+
connection.channel = nil
|
79
|
+
end
|
80
|
+
|
81
|
+
transaction = @core.new_transaction("foobar")
|
82
|
+
begin
|
83
|
+
transaction.message("hello")
|
84
|
+
ensure
|
85
|
+
transaction.close(true)
|
86
|
+
end
|
87
|
+
|
88
|
+
File.read(@dump_file).should =~ /hello/
|
89
|
+
end
|
90
|
+
|
91
|
+
specify "#new_transaction does not reconnect to the server for a short period of time if connecting failed" do
|
92
|
+
@core.reconnect_timeout = 60
|
93
|
+
@core.max_connect_tries = 1
|
94
|
+
|
95
|
+
mock_time(TODAY)
|
96
|
+
kill_agent
|
97
|
+
@core.new_transaction("foobar").should be_null
|
98
|
+
|
99
|
+
mock_time(TODAY + 30)
|
100
|
+
start_agent
|
101
|
+
@core.new_transaction("foobar").should be_null
|
102
|
+
|
103
|
+
mock_time(TODAY + 61)
|
104
|
+
@core.new_transaction("foobar").should_not be_null
|
105
|
+
end
|
106
|
+
|
107
|
+
specify "logging with #continue_transaction works" do
|
108
|
+
mock_time(TODAY)
|
109
|
+
|
110
|
+
transaction = @core.new_transaction("foobar", :processes)
|
111
|
+
begin
|
112
|
+
transaction.message("hello")
|
113
|
+
transaction2 = @core2.continue_transaction(transaction.txn_id, "foobar", :processes)
|
114
|
+
transaction2.should_not be_null
|
115
|
+
transaction2.txn_id.should == transaction.txn_id
|
116
|
+
begin
|
117
|
+
transaction2.message("world")
|
118
|
+
ensure
|
119
|
+
transaction2.close(true)
|
120
|
+
end
|
121
|
+
ensure
|
122
|
+
transaction.close(true)
|
123
|
+
end
|
124
|
+
|
125
|
+
File.read(@dump_file).should =~ /#{Regexp.escape transaction.txn_id} .* hello$/
|
126
|
+
File.read(@dump_file).should =~ /#{Regexp.escape transaction.txn_id} .* world$/
|
127
|
+
end
|
128
|
+
|
129
|
+
specify "#continue_transaction reestablishes the connection if disconnected" do
|
130
|
+
mock_time(TODAY)
|
131
|
+
|
132
|
+
transaction = @core.new_transaction("foobar")
|
133
|
+
transaction.close(true)
|
134
|
+
transaction2 = @core2.continue_transaction(transaction.txn_id, "foobar")
|
135
|
+
transaction2.close(true)
|
136
|
+
|
137
|
+
connection = @core2.instance_variable_get(:"@connection")
|
138
|
+
connection.synchronize do
|
139
|
+
connection.channel.close
|
140
|
+
connection.channel = nil
|
141
|
+
end
|
142
|
+
|
143
|
+
transaction2 = @core2.continue_transaction(transaction.txn_id, "foobar")
|
144
|
+
begin
|
145
|
+
transaction2.message("hello")
|
146
|
+
ensure
|
147
|
+
transaction2.close(true)
|
148
|
+
end
|
149
|
+
|
150
|
+
File.read(@dump_file).should =~ /hello/
|
151
|
+
end
|
152
|
+
|
153
|
+
specify "#new_transaction and #continue_transaction eventually reestablish the connection to the logging server if the logging server crashed and was restarted" do
|
154
|
+
mock_time(TODAY)
|
155
|
+
|
156
|
+
transaction = @core.new_transaction("foobar")
|
157
|
+
@core2.continue_transaction(transaction.txn_id, "foobar").close
|
158
|
+
kill_agent
|
159
|
+
start_agent
|
160
|
+
|
161
|
+
transaction = @core.new_transaction("foobar")
|
162
|
+
transaction.should be_null
|
163
|
+
transaction2 = @core2.continue_transaction("1234-abcd", "foobar")
|
164
|
+
transaction2.should be_null
|
165
|
+
|
166
|
+
mock_time(TODAY + 60)
|
167
|
+
transaction = @core.new_transaction("foobar")
|
168
|
+
transaction2 = @core2.continue_transaction(transaction.txn_id, "foobar")
|
169
|
+
begin
|
170
|
+
transaction2.message("hello")
|
171
|
+
ensure
|
172
|
+
transaction2.close(true)
|
173
|
+
end
|
174
|
+
transaction.close(true)
|
175
|
+
|
176
|
+
File.read(@dump_file).should =~ /hello/
|
177
|
+
end
|
178
|
+
|
179
|
+
specify "#continue_transaction does not reconnect to the server for a short period of time if connecting failed" do
|
180
|
+
@core.reconnect_timeout = 60
|
181
|
+
@core.max_connect_tries = 1
|
182
|
+
@core2.reconnect_timeout = 60
|
183
|
+
@core2.max_connect_tries = 1
|
184
|
+
|
185
|
+
mock_time(TODAY)
|
186
|
+
transaction = @core.new_transaction("foobar")
|
187
|
+
@core2.continue_transaction(transaction.txn_id, "foobar")
|
188
|
+
kill_agent
|
189
|
+
@core2.continue_transaction(transaction.txn_id, "foobar").should be_null
|
190
|
+
|
191
|
+
mock_time(TODAY + 30)
|
192
|
+
start_agent
|
193
|
+
@core2.continue_transaction(transaction.txn_id, "foobar").should be_null
|
194
|
+
|
195
|
+
mock_time(TODAY + 61)
|
196
|
+
@core2.continue_transaction(transaction.txn_id, "foobar").should_not be_null
|
197
|
+
end
|
198
|
+
|
199
|
+
it "only creates null Transaction objects if no server address is given" do
|
200
|
+
core = UnionStation::Core.new(nil, nil, nil, nil)
|
201
|
+
begin
|
202
|
+
core.new_transaction("foobar").should be_null
|
203
|
+
ensure
|
204
|
+
core.close
|
205
|
+
end
|
206
|
+
end
|
207
|
+
|
208
|
+
specify "#clear_connection closes the connection" do
|
209
|
+
@core.new_transaction("foobar").close
|
210
|
+
@core.clear_connection
|
211
|
+
connection = @core.instance_variable_get(:"@connection")
|
212
|
+
connection.synchronize do
|
213
|
+
connection.channel.should be_nil
|
214
|
+
end
|
215
|
+
end
|
216
|
+
|
217
|
+
describe "transaction objects" do
|
218
|
+
it "becomes null once it is closed" do
|
219
|
+
transaction = @core.new_transaction("foobar")
|
220
|
+
transaction.close
|
221
|
+
transaction.should be_null
|
222
|
+
end
|
223
|
+
|
224
|
+
it "does nothing if it's null" do
|
225
|
+
logger = UnionStation::Core.new(nil, nil, nil, nil)
|
226
|
+
begin
|
227
|
+
transaction = logger.new_transaction("foobar")
|
228
|
+
transaction.message("hello")
|
229
|
+
transaction.close(true)
|
230
|
+
ensure
|
231
|
+
logger.close
|
232
|
+
end
|
233
|
+
|
234
|
+
File.exist?("#{@log_dir}/1").should be_false
|
235
|
+
end
|
236
|
+
|
237
|
+
describe "#begin_measure" do
|
238
|
+
it "sends a BEGIN message" do
|
239
|
+
transaction = @core.new_transaction("foobar")
|
240
|
+
begin
|
241
|
+
transaction.should_receive(:message).with(/^BEGIN: hello \(.+?,.+?,.+?\) $/)
|
242
|
+
transaction.begin_measure("hello")
|
243
|
+
ensure
|
244
|
+
transaction.close
|
245
|
+
end
|
246
|
+
end
|
247
|
+
|
248
|
+
it "adds extra information as base64" do
|
249
|
+
transaction = @core.new_transaction("foobar")
|
250
|
+
begin
|
251
|
+
transaction.should_receive(:message).with(/^BEGIN: hello \(.+?,.+?,.+?\) YWJjZA==$/)
|
252
|
+
transaction.begin_measure("hello", "abcd")
|
253
|
+
ensure
|
254
|
+
transaction.close
|
255
|
+
end
|
256
|
+
end
|
257
|
+
end
|
258
|
+
|
259
|
+
describe "#end_measure" do
|
260
|
+
it "sends an END message if error_countered=false" do
|
261
|
+
transaction = @core.new_transaction("foobar")
|
262
|
+
begin
|
263
|
+
transaction.should_receive(:message).with(/^END: hello \(.+?,.+?,.+?\)$/)
|
264
|
+
transaction.end_measure("hello")
|
265
|
+
ensure
|
266
|
+
transaction.close
|
267
|
+
end
|
268
|
+
end
|
269
|
+
|
270
|
+
it "sends a FAIL message if error_countered=true" do
|
271
|
+
transaction = @core.new_transaction("foobar")
|
272
|
+
begin
|
273
|
+
transaction.should_receive(:message).with(/^FAIL: hello \(.+?,.+?,.+?\)$/)
|
274
|
+
transaction.end_measure("hello", true)
|
275
|
+
ensure
|
276
|
+
transaction.close
|
277
|
+
end
|
278
|
+
end
|
279
|
+
end
|
280
|
+
end
|
281
|
+
end
|
282
|
+
|
283
|
+
end # module PhusionPassenger
|
@@ -49,10 +49,28 @@ def application(env, start_response):
|
|
49
49
|
second = params['second'][0]
|
50
50
|
body = "Method: %s\nFirst: %s\nSecond: %s\n" % (method, first, second)
|
51
51
|
elif path == '/chunked':
|
52
|
-
|
53
|
-
str("7\r\
|
52
|
+
def body():
|
53
|
+
yield str("7\r\nchunk1\n\r\n")
|
54
|
+
yield str("7\r\nchunk2\n\r\n")
|
55
|
+
yield str("7\r\nchunk3\n\r\n")
|
56
|
+
yield str("0\r\n\r\n")
|
57
|
+
sleep_time = float(env.get('HTTP_X_SLEEP_WHEN_DONE', 0))
|
58
|
+
time.sleep(sleep_time)
|
59
|
+
if env.get('HTTP_X_EXTRA_DATA') is not None:
|
60
|
+
status = False
|
61
|
+
try:
|
62
|
+
yield str("7\r\nchunk4\n\r\n")
|
63
|
+
status = True
|
64
|
+
finally:
|
65
|
+
filename = env.get('HTTP_X_TAIL_STATUS_FILE')
|
66
|
+
if filename is not None:
|
67
|
+
f = open(filename, "w")
|
68
|
+
try:
|
69
|
+
f.write(str(status))
|
70
|
+
finally:
|
71
|
+
f.close()
|
54
72
|
start_response(status, [('Content-Type', 'text/html'), ('Transfer-Encoding', 'chunked')])
|
55
|
-
return
|
73
|
+
return body()
|
56
74
|
elif path == '/pid':
|
57
75
|
body = os.getpid()
|
58
76
|
elif path.startswith('/env'):
|
@@ -133,13 +151,31 @@ def application(env, start_response):
|
|
133
151
|
body = 'ok'
|
134
152
|
elif path == '/blob':
|
135
153
|
size = int(env.get('HTTP_X_SIZE', 1024 * 1024 * 10))
|
154
|
+
headers = [('Content-Type', 'text/plain')]
|
155
|
+
if env.get('HTTP_X_CONTENT_LENGTH') is not None:
|
156
|
+
headers.append(('Content-Length', size))
|
136
157
|
def body():
|
137
158
|
written = 0
|
138
159
|
while written < size:
|
139
160
|
data = 'x' * min(1024 * 8, size - written)
|
140
161
|
yield(data)
|
141
162
|
written += len(data)
|
142
|
-
|
163
|
+
sleep_time = float(env.get('HTTP_X_SLEEP_WHEN_DONE', 0))
|
164
|
+
time.sleep(sleep_time)
|
165
|
+
if env.get('HTTP_X_EXTRA_DATA') is not None:
|
166
|
+
status = False
|
167
|
+
try:
|
168
|
+
yield str("tail")
|
169
|
+
status = True
|
170
|
+
finally:
|
171
|
+
filename = env.get('HTTP_X_TAIL_STATUS_FILE')
|
172
|
+
if filename is not None:
|
173
|
+
f = open(filename, "w")
|
174
|
+
try:
|
175
|
+
f.write(str(status))
|
176
|
+
finally:
|
177
|
+
f.close()
|
178
|
+
start_response(status, headers)
|
143
179
|
return body()
|
144
180
|
elif path == '/oobw':
|
145
181
|
start_response(status, [('Content-Type', 'text/plain'), ('X-Passenger-Request-OOB-Work', 'true')])
|
@@ -150,7 +186,7 @@ def application(env, start_response):
|
|
150
186
|
body = str('Invalid headers')
|
151
187
|
start_response(status, [('Content-Type', 'text/plain'), ('Content-Length', len(body))])
|
152
188
|
return [body]
|
153
|
-
socket = env['passenger.hijack']()
|
189
|
+
socket = env['passenger.hijack'](True)
|
154
190
|
io = socket.makefile()
|
155
191
|
socket.close()
|
156
192
|
try:
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: passenger
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 4.0.
|
4
|
+
version: 4.0.46
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Phusion - http://www.phusion.nl/
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-
|
11
|
+
date: 2014-07-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|
@@ -66,6 +66,7 @@ extensions:
|
|
66
66
|
- helper-scripts/download_binaries/extconf.rb
|
67
67
|
extra_rdoc_files: []
|
68
68
|
files:
|
69
|
+
- .editorconfig
|
69
70
|
- .gitignore
|
70
71
|
- .travis.yml
|
71
72
|
- CHANGELOG
|
@@ -165,6 +166,7 @@ files:
|
|
165
166
|
- doc/Users guide.html
|
166
167
|
- doc/Users guide.txt
|
167
168
|
- doc/images/by_sa.png
|
169
|
+
- doc/images/code_walkthrough.jpg
|
168
170
|
- doc/images/direct_spawning.png
|
169
171
|
- doc/images/direct_spawning.svg
|
170
172
|
- doc/images/glyphicons-halflings-white.png
|
@@ -2149,6 +2151,7 @@ files:
|
|
2149
2151
|
- ext/common/ApplicationPool2/ComponentInfo.h
|
2150
2152
|
- ext/common/ApplicationPool2/DirectSpawner.h
|
2151
2153
|
- ext/common/ApplicationPool2/DummySpawner.h
|
2154
|
+
- ext/common/ApplicationPool2/ErrorRenderer.h
|
2152
2155
|
- ext/common/ApplicationPool2/Group.h
|
2153
2156
|
- ext/common/ApplicationPool2/Implementation.cpp
|
2154
2157
|
- ext/common/ApplicationPool2/Options.h
|
@@ -2212,6 +2215,7 @@ files:
|
|
2212
2215
|
- ext/common/Utils/IOUtils.cpp
|
2213
2216
|
- ext/common/Utils/IOUtils.h
|
2214
2217
|
- ext/common/Utils/IniFile.h
|
2218
|
+
- ext/common/Utils/JsonUtils.h
|
2215
2219
|
- ext/common/Utils/LargeFiles.cpp
|
2216
2220
|
- ext/common/Utils/LargeFiles.h
|
2217
2221
|
- ext/common/Utils/Lock.h
|
@@ -2373,14 +2377,12 @@ files:
|
|
2373
2377
|
- helper-scripts/rack-loader.rb
|
2374
2378
|
- helper-scripts/rack-preloader.rb
|
2375
2379
|
- helper-scripts/wsgi-loader.py
|
2376
|
-
- helper-scripts/wsgi-preloader.py
|
2377
2380
|
- lib/phusion_passenger.rb
|
2378
2381
|
- lib/phusion_passenger/abstract_installer.rb
|
2379
2382
|
- lib/phusion_passenger/active_support3_extensions/init.rb
|
2380
2383
|
- lib/phusion_passenger/admin_tools.rb
|
2381
2384
|
- lib/phusion_passenger/admin_tools/memory_stats.rb
|
2382
2385
|
- lib/phusion_passenger/admin_tools/server_instance.rb
|
2383
|
-
- lib/phusion_passenger/analytics_logger.rb
|
2384
2386
|
- lib/phusion_passenger/apache2/config_options.rb
|
2385
2387
|
- lib/phusion_passenger/classic_rails/cgi_fixed.rb
|
2386
2388
|
- lib/phusion_passenger/classic_rails/thread_handler_extension.rb
|
@@ -2436,7 +2438,6 @@ files:
|
|
2436
2438
|
- lib/phusion_passenger/standalone/config_file.rb
|
2437
2439
|
- lib/phusion_passenger/standalone/help_command.rb
|
2438
2440
|
- lib/phusion_passenger/standalone/main.rb
|
2439
|
-
- lib/phusion_passenger/standalone/package_runtime_command.rb
|
2440
2441
|
- lib/phusion_passenger/standalone/runtime_installer.rb
|
2441
2442
|
- lib/phusion_passenger/standalone/runtime_locator.rb
|
2442
2443
|
- lib/phusion_passenger/standalone/start_command.rb
|
@@ -2444,12 +2445,16 @@ files:
|
|
2444
2445
|
- lib/phusion_passenger/standalone/stop_command.rb
|
2445
2446
|
- lib/phusion_passenger/standalone/utils.rb
|
2446
2447
|
- lib/phusion_passenger/standalone/version_command.rb
|
2448
|
+
- lib/phusion_passenger/union_station/connection.rb
|
2449
|
+
- lib/phusion_passenger/union_station/core.rb
|
2450
|
+
- lib/phusion_passenger/union_station/transaction.rb
|
2447
2451
|
- lib/phusion_passenger/utils.rb
|
2448
2452
|
- lib/phusion_passenger/utils/ansi_colors.rb
|
2449
2453
|
- lib/phusion_passenger/utils/download.rb
|
2450
2454
|
- lib/phusion_passenger/utils/file_system_watcher.rb
|
2451
2455
|
- lib/phusion_passenger/utils/hosts_file_parser.rb
|
2452
2456
|
- lib/phusion_passenger/utils/json.rb
|
2457
|
+
- lib/phusion_passenger/utils/lock.rb
|
2453
2458
|
- lib/phusion_passenger/utils/native_support_utils.rb
|
2454
2459
|
- lib/phusion_passenger/utils/tee_input.rb
|
2455
2460
|
- lib/phusion_passenger/utils/terminal_choice_menu.rb
|
@@ -2577,7 +2582,6 @@ files:
|
|
2577
2582
|
- test/oxt/spin_lock_test.cpp
|
2578
2583
|
- test/oxt/syscall_interruption_test.cpp
|
2579
2584
|
- test/ruby/admin_tools_spec.rb
|
2580
|
-
- test/ruby/analytics_logger_spec.rb
|
2581
2585
|
- test/ruby/classic_rails/loader_spec.rb
|
2582
2586
|
- test/ruby/classic_rails/preloader_spec.rb
|
2583
2587
|
- test/ruby/debug_logging_spec.rb
|
@@ -2594,11 +2598,12 @@ files:
|
|
2594
2598
|
- test/ruby/rails4.0/preloader_spec.rb
|
2595
2599
|
- test/ruby/request_handler_spec.rb
|
2596
2600
|
- test/ruby/shared/loader_sharedspec.rb
|
2597
|
-
- test/ruby/shared/rails/
|
2601
|
+
- test/ruby/shared/rails/union_station_extensions_sharedspec.rb
|
2598
2602
|
- test/ruby/shared/ruby_loader_sharedspec.rb
|
2599
2603
|
- test/ruby/spec_helper.rb
|
2600
2604
|
- test/ruby/standalone/runtime_installer_spec.rb
|
2601
2605
|
- test/ruby/standalone/runtime_locator_spec.rb
|
2606
|
+
- test/ruby/union_station_spec.rb
|
2602
2607
|
- test/ruby/utils/file_system_watcher_spec.rb
|
2603
2608
|
- test/ruby/utils/hosts_file_parser.rb
|
2604
2609
|
- test/ruby/utils/tee_input_spec.rb
|