puma 2.11.1-java → 2.11.2-java
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of puma might be problematic. Click here for more details.
- checksums.yaml +4 -4
- data/History.txt +23 -0
- data/Manifest.txt +1 -0
- data/lib/puma/cli.rb +269 -303
- data/lib/puma/cluster.rb +1 -0
- data/lib/puma/configuration.rb +62 -328
- data/lib/puma/const.rb +1 -1
- data/lib/puma/dsl.rb +280 -0
- data/lib/puma/puma_http11.jar +0 -0
- data/lib/puma/server.rb +24 -7
- data/puma.gemspec +1 -1
- data/test/test_cli.rb +12 -12
- data/test/test_config.rb +26 -0
- data/test/test_persistent.rb +2 -2
- data/test/test_puma_server.rb +113 -1
- data/test/test_unix_socket.rb +10 -10
- metadata +3 -2
data/test/test_config.rb
CHANGED
@@ -14,6 +14,17 @@ class TestConfigFile < Test::Unit::TestCase
|
|
14
14
|
assert_equal [200, {}, ["embedded app"]], app.call({})
|
15
15
|
end
|
16
16
|
|
17
|
+
def test_double_bind_port
|
18
|
+
port = rand(30_000..40_000).to_s
|
19
|
+
with_env("PORT" => port) do
|
20
|
+
opts = { :binds => ["tcp://#{Configuration::DefaultTCPHost}:#{port}"], :config_file => "test/config/app.rb"}
|
21
|
+
conf = Puma::Configuration.new opts
|
22
|
+
conf.load
|
23
|
+
|
24
|
+
assert_equal ["tcp://0.0.0.0:#{port}"], conf.options[:binds]
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
17
28
|
def test_lowleve_error_handler_DSL
|
18
29
|
opts = { :config_file => "test/config/app.rb" }
|
19
30
|
conf = Puma::Configuration.new opts
|
@@ -23,4 +34,19 @@ class TestConfigFile < Test::Unit::TestCase
|
|
23
34
|
|
24
35
|
assert_equal [200, {}, ["error page"]], app.call({})
|
25
36
|
end
|
37
|
+
|
38
|
+
private
|
39
|
+
|
40
|
+
def with_env(env = {})
|
41
|
+
original_env = {}
|
42
|
+
env.each do |k, v|
|
43
|
+
original_env[k] = ENV[k]
|
44
|
+
ENV[k] = v
|
45
|
+
end
|
46
|
+
yield
|
47
|
+
ensure
|
48
|
+
original_env.each do |k, v|
|
49
|
+
ENV[k] = v
|
50
|
+
end
|
51
|
+
end
|
26
52
|
end
|
data/test/test_persistent.rb
CHANGED
@@ -106,7 +106,7 @@ class TestPersistent < Test::Unit::TestCase
|
|
106
106
|
|
107
107
|
@client << @http10_request
|
108
108
|
|
109
|
-
assert_equal "HTTP/1.0 200 OK\r\nX-Header: Works\r\
|
109
|
+
assert_equal "HTTP/1.0 200 OK\r\nX-Header: Works\r\n\r\n", lines(3)
|
110
110
|
assert_equal "HelloChunked", @client.read
|
111
111
|
end
|
112
112
|
|
@@ -132,7 +132,7 @@ class TestPersistent < Test::Unit::TestCase
|
|
132
132
|
@client << @http10_request
|
133
133
|
sz = @body[0].size.to_s
|
134
134
|
|
135
|
-
assert_equal "HTTP/1.0 200 OK\r\nX-Header: Works\r\
|
135
|
+
assert_equal "HTTP/1.0 200 OK\r\nX-Header: Works\r\nContent-Length: #{sz}\r\n\r\n", lines(4)
|
136
136
|
assert_equal "Hello", @client.read(5)
|
137
137
|
end
|
138
138
|
|
data/test/test_puma_server.rb
CHANGED
@@ -216,7 +216,7 @@ class TestPumaServer < Test::Unit::TestCase
|
|
216
216
|
|
217
217
|
data = sock.read
|
218
218
|
|
219
|
-
assert_equal "HTTP/1.0 449 CUSTOM\r\
|
219
|
+
assert_equal "HTTP/1.0 449 CUSTOM\r\nContent-Length: 0\r\n\r\n", data
|
220
220
|
end
|
221
221
|
|
222
222
|
def test_custom_http_codes_11
|
@@ -285,4 +285,116 @@ class TestPumaServer < Test::Unit::TestCase
|
|
285
285
|
|
286
286
|
assert_equal "HTTP/1.1 408 Request Timeout\r\n", data
|
287
287
|
end
|
288
|
+
|
289
|
+
def test_http_11_keep_alive_with_body
|
290
|
+
@server.app = proc { |env| [200, {"Content-Type" => "plain/text"}, ["hello"]] }
|
291
|
+
|
292
|
+
@server.add_tcp_listener @host, @port
|
293
|
+
@server.run
|
294
|
+
|
295
|
+
sock = TCPSocket.new @host, @port
|
296
|
+
sock << "GET / HTTP/1.1\r\nConnection: Keep-Alive\r\n\r\n"
|
297
|
+
|
298
|
+
data = sock.read
|
299
|
+
|
300
|
+
assert_equal "HTTP/1.1 200 OK\r\nContent-Type: plain/text\r\nContent-Length: 5\r\n\r\nhello", data
|
301
|
+
end
|
302
|
+
|
303
|
+
def test_http_11_close_with_body
|
304
|
+
@server.app = proc { |env| [200, {"Content-Type" => "plain/text"}, ["hello"]] }
|
305
|
+
|
306
|
+
@server.add_tcp_listener @host, @port
|
307
|
+
@server.run
|
308
|
+
|
309
|
+
sock = TCPSocket.new @host, @port
|
310
|
+
sock << "GET / HTTP/1.1\r\nConnection: close\r\n\r\n"
|
311
|
+
|
312
|
+
data = sock.read
|
313
|
+
|
314
|
+
assert_equal "HTTP/1.1 200 OK\r\nContent-Type: plain/text\r\nConnection: close\r\nContent-Length: 5\r\n\r\nhello", data
|
315
|
+
end
|
316
|
+
|
317
|
+
def test_http_11_keep_alive_without_body
|
318
|
+
@server.app = proc { |env| [204, {}, []] }
|
319
|
+
|
320
|
+
@server.add_tcp_listener @host, @port
|
321
|
+
@server.run
|
322
|
+
|
323
|
+
sock = TCPSocket.new @host, @port
|
324
|
+
sock << "GET / HTTP/1.1\r\nConnection: Keep-Alive\r\n\r\n"
|
325
|
+
|
326
|
+
data = sock.read
|
327
|
+
|
328
|
+
assert_equal "HTTP/1.1 204 No Content\r\n\r\n", data
|
329
|
+
end
|
330
|
+
|
331
|
+
def test_http_11_close_without_body
|
332
|
+
@server.app = proc { |env| [204, {}, []] }
|
333
|
+
|
334
|
+
@server.add_tcp_listener @host, @port
|
335
|
+
@server.run
|
336
|
+
|
337
|
+
sock = TCPSocket.new @host, @port
|
338
|
+
sock << "GET / HTTP/1.1\r\nConnection: close\r\n\r\n"
|
339
|
+
|
340
|
+
data = sock.read
|
341
|
+
|
342
|
+
assert_equal "HTTP/1.1 204 No Content\r\nConnection: close\r\n\r\n", data
|
343
|
+
end
|
344
|
+
|
345
|
+
def test_http_10_keep_alive_with_body
|
346
|
+
@server.app = proc { |env| [200, {"Content-Type" => "plain/text"}, ["hello"]] }
|
347
|
+
|
348
|
+
@server.add_tcp_listener @host, @port
|
349
|
+
@server.run
|
350
|
+
|
351
|
+
sock = TCPSocket.new @host, @port
|
352
|
+
sock << "GET / HTTP/1.0\r\nConnection: Keep-Alive\r\n\r\n"
|
353
|
+
|
354
|
+
data = sock.read
|
355
|
+
|
356
|
+
assert_equal "HTTP/1.0 200 OK\r\nContent-Type: plain/text\r\nConnection: Keep-Alive\r\nContent-Length: 5\r\n\r\nhello", data
|
357
|
+
end
|
358
|
+
|
359
|
+
def test_http_10_close_with_body
|
360
|
+
@server.app = proc { |env| [200, {"Content-Type" => "plain/text"}, ["hello"]] }
|
361
|
+
|
362
|
+
@server.add_tcp_listener @host, @port
|
363
|
+
@server.run
|
364
|
+
|
365
|
+
sock = TCPSocket.new @host, @port
|
366
|
+
sock << "GET / HTTP/1.0\r\nConnection: close\r\n\r\n"
|
367
|
+
|
368
|
+
data = sock.read
|
369
|
+
|
370
|
+
assert_equal "HTTP/1.0 200 OK\r\nContent-Type: plain/text\r\nContent-Length: 5\r\n\r\nhello", data
|
371
|
+
end
|
372
|
+
|
373
|
+
def test_http_10_keep_alive_without_body
|
374
|
+
@server.app = proc { |env| [204, {}, []] }
|
375
|
+
|
376
|
+
@server.add_tcp_listener @host, @port
|
377
|
+
@server.run
|
378
|
+
|
379
|
+
sock = TCPSocket.new @host, @port
|
380
|
+
sock << "GET / HTTP/1.0\r\nConnection: Keep-Alive\r\n\r\n"
|
381
|
+
|
382
|
+
data = sock.read
|
383
|
+
|
384
|
+
assert_equal "HTTP/1.0 204 No Content\r\nConnection: Keep-Alive\r\n\r\n", data
|
385
|
+
end
|
386
|
+
|
387
|
+
def test_http_10_close_without_body
|
388
|
+
@server.app = proc { |env| [204, {}, []] }
|
389
|
+
|
390
|
+
@server.add_tcp_listener @host, @port
|
391
|
+
@server.run
|
392
|
+
|
393
|
+
sock = TCPSocket.new @host, @port
|
394
|
+
sock << "GET / HTTP/1.0\r\nConnection: close\r\n\r\n"
|
395
|
+
|
396
|
+
data = sock.read
|
397
|
+
|
398
|
+
assert_equal "HTTP/1.0 204 No Content\r\n\r\n", data
|
399
|
+
end
|
288
400
|
end
|
data/test/test_unix_socket.rb
CHANGED
@@ -8,31 +8,31 @@ require 'socket'
|
|
8
8
|
# (or Windows)
|
9
9
|
unless defined?(JRUBY_VERSION) || RbConfig::CONFIG["host_os"] =~ /mingw|mswin/
|
10
10
|
class TestPumaUnixSocket < Test::Unit::TestCase
|
11
|
-
|
11
|
+
|
12
12
|
App = lambda { |env| [200, {}, ["Works"]] }
|
13
|
-
|
13
|
+
|
14
14
|
Path = "test/puma.sock"
|
15
|
-
|
15
|
+
|
16
16
|
def setup
|
17
17
|
@server = Puma::Server.new App
|
18
18
|
@server.add_unix_listener Path
|
19
19
|
@server.run
|
20
20
|
end
|
21
|
-
|
21
|
+
|
22
22
|
def teardown
|
23
23
|
@server.stop(true)
|
24
24
|
File.unlink Path if File.exist? Path
|
25
25
|
end
|
26
|
-
|
26
|
+
|
27
27
|
def test_server
|
28
28
|
sock = UNIXSocket.new Path
|
29
|
-
|
29
|
+
|
30
30
|
sock << "GET / HTTP/1.0\r\nHost: blah.com\r\n\r\n"
|
31
|
-
|
32
|
-
expected = "HTTP/1.0 200 OK\r\
|
33
|
-
|
31
|
+
|
32
|
+
expected = "HTTP/1.0 200 OK\r\nContent-Length: 5\r\n\r\nWorks"
|
33
|
+
|
34
34
|
assert_equal expected, sock.read(expected.size)
|
35
|
-
|
35
|
+
|
36
36
|
sock.close
|
37
37
|
end
|
38
38
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: puma
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.11.
|
4
|
+
version: 2.11.2
|
5
5
|
platform: java
|
6
6
|
authors:
|
7
7
|
- Evan Phoenix
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-04-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
requirement: !ruby/object:Gem::Requirement
|
@@ -134,6 +134,7 @@ files:
|
|
134
134
|
- lib/puma/daemon_ext.rb
|
135
135
|
- lib/puma/delegation.rb
|
136
136
|
- lib/puma/detect.rb
|
137
|
+
- lib/puma/dsl.rb
|
137
138
|
- lib/puma/events.rb
|
138
139
|
- lib/puma/io_buffer.rb
|
139
140
|
- lib/puma/java_io_buffer.rb
|