puma 1.3.0 → 1.3.1
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.
- data/History.txt +6 -0
- data/lib/puma/app/status.rb +1 -1
- data/lib/puma/const.rb +1 -1
- data/lib/puma/server.rb +5 -2
- data/puma.gemspec +10 -10
- data/test/test_puma_server.rb +24 -1
- metadata +20 -20
data/History.txt
CHANGED
data/lib/puma/app/status.rb
CHANGED
@@ -49,7 +49,7 @@ module Puma
|
|
49
49
|
|
50
50
|
private
|
51
51
|
def rack_response(status, body, content_type='application/json')
|
52
|
-
[status, { 'Content-Type' => content_type, 'Content-Length' => body.
|
52
|
+
[status, { 'Content-Type' => content_type, 'Content-Length' => body.bytesize.to_s }, [body]]
|
53
53
|
end
|
54
54
|
end
|
55
55
|
end
|
data/lib/puma/const.rb
CHANGED
data/lib/puma/server.rb
CHANGED
@@ -573,11 +573,14 @@ module Puma
|
|
573
573
|
if remain > MAX_BODY
|
574
574
|
stream = Tempfile.new(Const::PUMA_TMP_BASE)
|
575
575
|
stream.binmode
|
576
|
-
stream.write body
|
577
576
|
else
|
578
|
-
|
577
|
+
# The body[0,0] trick is to get an empty string in the same
|
578
|
+
# encoding as body.
|
579
|
+
stream = StringIO.new body[0,0]
|
579
580
|
end
|
580
581
|
|
582
|
+
stream.write body
|
583
|
+
|
581
584
|
# Read an odd sized chunk so we can read even sized ones
|
582
585
|
# after this
|
583
586
|
chunk = client.readpartial(remain % CHUNK_SIZE)
|
data/puma.gemspec
CHANGED
@@ -2,23 +2,23 @@
|
|
2
2
|
|
3
3
|
Gem::Specification.new do |s|
|
4
4
|
s.name = "puma"
|
5
|
-
s.version = "1.3.
|
5
|
+
s.version = "1.3.1"
|
6
6
|
|
7
7
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
8
8
|
s.authors = ["Evan Phoenix"]
|
9
|
-
s.date = "2012-05-
|
9
|
+
s.date = "2012-05-16"
|
10
10
|
s.description = "Puma is a simple, fast, and highly concurrent HTTP 1.1 server for Ruby web applications. It can be used with any application that supports Rack, and is considered the replacement for Webrick and Mongrel. It was designed to be the go-to server for [Rubinius](http://rubini.us), but also works well with JRuby and MRI. Puma is intended for use in both development and production environments.\n\nUnder the hood, Puma processes requests using a C-optimized Ragel extension (inherited from Mongrel) that provides fast, accurate HTTP 1.1 protocol parsing in a portable way. Puma then serves the request in a thread from an internal thread pool (which you can control). This allows Puma to provide real concurrency for your web application!\n\nWith Rubinius 2.0, Puma will utilize all cores on your CPU with real threads, meaning you won't have to spawn multiple processes to increase throughput. You can expect to see a similar benefit from JRuby.\n\nOn MRI, there is a Global Interpreter Lock (GIL) that ensures only one thread can be run at a time. But if you're doing a lot of blocking IO (such as HTTP calls to external APIs like Twitter), Puma still improves MRI's throughput by allowing blocking IO to be run concurrently (EventMachine-based servers such as Thin turn off this ability, requiring you to use special libraries). Your mileage may vary. In order to get the best throughput, it is highly recommended that you use a Ruby implementation with real threads like [Rubinius](http://rubini.us) or [JRuby](http://jruby.org)."
|
11
11
|
s.email = ["evan@phx.io"]
|
12
12
|
s.executables = ["puma", "pumactl"]
|
13
13
|
s.extensions = ["ext/puma_http11/extconf.rb"]
|
14
14
|
s.extra_rdoc_files = ["History.txt", "Manifest.txt"]
|
15
|
-
s.files = ["COPYING", "Gemfile", "History.txt", "LICENSE", "Manifest.txt", "README.md", "Rakefile", "TODO", "bin/puma", "bin/pumactl", "examples/CA/cacert.pem", "examples/CA/newcerts/cert_1.pem", "examples/CA/newcerts/cert_2.pem", "examples/CA/private/cakeypair.pem", "examples/CA/serial", "examples/config.rb", "examples/puma/cert_puma.pem", "examples/puma/csr_puma.pem", "examples/puma/puma_keypair.pem", "examples/qc_config.rb", "ext/puma_http11/PumaHttp11Service.java", "ext/puma_http11/ext_help.h", "ext/puma_http11/extconf.rb", "ext/puma_http11/http11_parser.c", "ext/puma_http11/http11_parser.h", "ext/puma_http11/http11_parser.java.rl", "ext/puma_http11/http11_parser.rl", "ext/puma_http11/http11_parser_common.rl", "ext/puma_http11/org/jruby/puma/Http11.java", "ext/puma_http11/org/jruby/puma/Http11Parser.java", "ext/puma_http11/puma_http11.c", "lib/puma.rb", "lib/puma/app/status.rb", "lib/puma/cli.rb", "lib/puma/compat.rb", "lib/puma/configuration.rb", "lib/puma/const.rb", "lib/puma/control_cli.rb", "lib/puma/events.rb", "lib/puma/jruby_restart.rb", "lib/puma/null_io.rb", "lib/puma/rack_patch.rb", "lib/puma/server.rb", "lib/puma/thread_pool.rb", "lib/rack/handler/puma.rb", "puma.gemspec", "test/ab_rs.rb", "test/config/app.rb", "test/hello.ru", "test/lobster.ru", "test/mime.yaml", "test/slow.ru", "test/test_app_status.rb", "test/test_cli.rb", "test/test_config.rb", "test/test_http10.rb", "test/test_http11.rb", "test/test_integration.rb", "test/test_persistent.rb", "test/test_puma_server.rb", "test/test_rack_handler.rb", "test/test_rack_server.rb", "test/test_thread_pool.rb", "test/test_unix_socket.rb", "test/test_ws.rb", "test/testhelp.rb", "tools/trickletest.rb"
|
15
|
+
s.files = [".travis.yml", "COPYING", "Gemfile", "History.txt", "LICENSE", "Manifest.txt", "README.md", "Rakefile", "TODO", "bin/puma", "bin/pumactl", "examples/CA/cacert.pem", "examples/CA/newcerts/cert_1.pem", "examples/CA/newcerts/cert_2.pem", "examples/CA/private/cakeypair.pem", "examples/CA/serial", "examples/config.rb", "examples/puma/cert_puma.pem", "examples/puma/csr_puma.pem", "examples/puma/puma_keypair.pem", "examples/qc_config.rb", "ext/puma_http11/PumaHttp11Service.java", "ext/puma_http11/ext_help.h", "ext/puma_http11/extconf.rb", "ext/puma_http11/http11_parser.c", "ext/puma_http11/http11_parser.h", "ext/puma_http11/http11_parser.java.rl", "ext/puma_http11/http11_parser.rl", "ext/puma_http11/http11_parser_common.rl", "ext/puma_http11/org/jruby/puma/Http11.java", "ext/puma_http11/org/jruby/puma/Http11Parser.java", "ext/puma_http11/puma_http11.c", "lib/puma.rb", "lib/puma/app/status.rb", "lib/puma/cli.rb", "lib/puma/compat.rb", "lib/puma/configuration.rb", "lib/puma/const.rb", "lib/puma/control_cli.rb", "lib/puma/events.rb", "lib/puma/jruby_restart.rb", "lib/puma/null_io.rb", "lib/puma/rack_patch.rb", "lib/puma/server.rb", "lib/puma/thread_pool.rb", "lib/rack/handler/puma.rb", "puma.gemspec", "test/ab_rs.rb", "test/config/app.rb", "test/hello.ru", "test/lobster.ru", "test/mime.yaml", "test/slow.ru", "test/test_app_status.rb", "test/test_cli.rb", "test/test_config.rb", "test/test_http10.rb", "test/test_http11.rb", "test/test_integration.rb", "test/test_null_io.rb", "test/test_persistent.rb", "test/test_puma_server.rb", "test/test_rack_handler.rb", "test/test_rack_server.rb", "test/test_thread_pool.rb", "test/test_unix_socket.rb", "test/test_ws.rb", "test/testhelp.rb", "tools/trickletest.rb"]
|
16
16
|
s.homepage = "http://puma.io"
|
17
17
|
s.rdoc_options = ["--main", "README.md"]
|
18
18
|
s.require_paths = ["lib"]
|
19
19
|
s.required_ruby_version = Gem::Requirement.new(">= 1.8.7")
|
20
20
|
s.rubyforge_project = "puma"
|
21
|
-
s.rubygems_version = "1.8.
|
21
|
+
s.rubygems_version = "1.8.18"
|
22
22
|
s.summary = "Puma is a simple, fast, and highly concurrent HTTP 1.1 server for Ruby web applications"
|
23
23
|
s.test_files = ["test/test_app_status.rb", "test/test_cli.rb", "test/test_config.rb", "test/test_http10.rb", "test/test_http11.rb", "test/test_integration.rb", "test/test_null_io.rb", "test/test_persistent.rb", "test/test_puma_server.rb", "test/test_rack_handler.rb", "test/test_rack_server.rb", "test/test_thread_pool.rb", "test/test_unix_socket.rb", "test/test_ws.rb"]
|
24
24
|
|
@@ -27,19 +27,19 @@ Gem::Specification.new do |s|
|
|
27
27
|
|
28
28
|
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
29
29
|
s.add_runtime_dependency(%q<rack>, ["~> 1.2"])
|
30
|
-
s.add_development_dependency(%q<rake-compiler>, ["~> 0.8.0"])
|
31
30
|
s.add_development_dependency(%q<rdoc>, ["~> 3.10"])
|
32
|
-
s.add_development_dependency(%q<
|
31
|
+
s.add_development_dependency(%q<rake-compiler>, ["~> 0.8.0"])
|
32
|
+
s.add_development_dependency(%q<hoe>, ["~> 3.0"])
|
33
33
|
else
|
34
34
|
s.add_dependency(%q<rack>, ["~> 1.2"])
|
35
|
-
s.add_dependency(%q<rake-compiler>, ["~> 0.8.0"])
|
36
35
|
s.add_dependency(%q<rdoc>, ["~> 3.10"])
|
37
|
-
s.add_dependency(%q<
|
36
|
+
s.add_dependency(%q<rake-compiler>, ["~> 0.8.0"])
|
37
|
+
s.add_dependency(%q<hoe>, ["~> 3.0"])
|
38
38
|
end
|
39
39
|
else
|
40
40
|
s.add_dependency(%q<rack>, ["~> 1.2"])
|
41
|
-
s.add_dependency(%q<rake-compiler>, ["~> 0.8.0"])
|
42
41
|
s.add_dependency(%q<rdoc>, ["~> 3.10"])
|
43
|
-
s.add_dependency(%q<
|
42
|
+
s.add_dependency(%q<rake-compiler>, ["~> 0.8.0"])
|
43
|
+
s.add_dependency(%q<hoe>, ["~> 3.0"])
|
44
44
|
end
|
45
45
|
end
|
data/test/test_puma_server.rb
CHANGED
@@ -23,7 +23,7 @@ class TestPumaServer < Test::Unit::TestCase
|
|
23
23
|
end
|
24
24
|
|
25
25
|
def teardown
|
26
|
-
@server.stop
|
26
|
+
@server.stop(true)
|
27
27
|
end
|
28
28
|
|
29
29
|
def test_url_scheme_for_https
|
@@ -53,4 +53,27 @@ class TestPumaServer < Test::Unit::TestCase
|
|
53
53
|
|
54
54
|
assert_equal "https", body
|
55
55
|
end
|
56
|
+
|
57
|
+
def test_proper_stringio_body
|
58
|
+
data = nil
|
59
|
+
|
60
|
+
@server.app = proc do |env|
|
61
|
+
data = env['rack.input'].read
|
62
|
+
[200, {}, ["ok"]]
|
63
|
+
end
|
64
|
+
|
65
|
+
@server.add_tcp_listener @host, @port
|
66
|
+
@server.run
|
67
|
+
|
68
|
+
fifteen = "1" * 15
|
69
|
+
|
70
|
+
sock = TCPSocket.new @host, @port
|
71
|
+
sock << "PUT / HTTP/1.0\r\nContent-Length: 30\r\n\r\n#{fifteen}"
|
72
|
+
sleep 0.1 # important so that the previous data is sent as a packet
|
73
|
+
sock << fifteen
|
74
|
+
|
75
|
+
sock.read
|
76
|
+
|
77
|
+
assert_equal "#{fifteen}#{fifteen}", data
|
78
|
+
end
|
56
79
|
end
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: puma
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 25
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 1
|
8
8
|
- 3
|
9
|
-
-
|
10
|
-
version: 1.3.
|
9
|
+
- 1
|
10
|
+
version: 1.3.1
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Evan Phoenix
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2012-05-
|
18
|
+
date: 2012-05-16 00:00:00 Z
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|
21
21
|
name: rack
|
@@ -33,34 +33,34 @@ dependencies:
|
|
33
33
|
type: :runtime
|
34
34
|
version_requirements: *id001
|
35
35
|
- !ruby/object:Gem::Dependency
|
36
|
-
name:
|
36
|
+
name: rdoc
|
37
37
|
prerelease: false
|
38
38
|
requirement: &id002 !ruby/object:Gem::Requirement
|
39
39
|
none: false
|
40
40
|
requirements:
|
41
41
|
- - ~>
|
42
42
|
- !ruby/object:Gem::Version
|
43
|
-
hash:
|
43
|
+
hash: 19
|
44
44
|
segments:
|
45
|
-
-
|
46
|
-
-
|
47
|
-
|
48
|
-
version: 0.8.0
|
45
|
+
- 3
|
46
|
+
- 10
|
47
|
+
version: "3.10"
|
49
48
|
type: :development
|
50
49
|
version_requirements: *id002
|
51
50
|
- !ruby/object:Gem::Dependency
|
52
|
-
name:
|
51
|
+
name: rake-compiler
|
53
52
|
prerelease: false
|
54
53
|
requirement: &id003 !ruby/object:Gem::Requirement
|
55
54
|
none: false
|
56
55
|
requirements:
|
57
56
|
- - ~>
|
58
57
|
- !ruby/object:Gem::Version
|
59
|
-
hash:
|
58
|
+
hash: 63
|
60
59
|
segments:
|
61
|
-
-
|
62
|
-
-
|
63
|
-
|
60
|
+
- 0
|
61
|
+
- 8
|
62
|
+
- 0
|
63
|
+
version: 0.8.0
|
64
64
|
type: :development
|
65
65
|
version_requirements: *id003
|
66
66
|
- !ruby/object:Gem::Dependency
|
@@ -71,11 +71,11 @@ dependencies:
|
|
71
71
|
requirements:
|
72
72
|
- - ~>
|
73
73
|
- !ruby/object:Gem::Version
|
74
|
-
hash:
|
74
|
+
hash: 7
|
75
75
|
segments:
|
76
|
-
-
|
77
|
-
-
|
78
|
-
version: "
|
76
|
+
- 3
|
77
|
+
- 0
|
78
|
+
version: "3.0"
|
79
79
|
type: :development
|
80
80
|
version_requirements: *id004
|
81
81
|
description: |-
|
@@ -198,7 +198,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
198
198
|
requirements: []
|
199
199
|
|
200
200
|
rubyforge_project: puma
|
201
|
-
rubygems_version: 1.8.
|
201
|
+
rubygems_version: 1.8.18
|
202
202
|
signing_key:
|
203
203
|
specification_version: 3
|
204
204
|
summary: Puma is a simple, fast, and highly concurrent HTTP 1.1 server for Ruby web applications
|