puma 0.9.5 → 1.0.0

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.

@@ -8,7 +8,16 @@ Rakefile
8
8
  TODO
9
9
  bin/puma
10
10
  bin/pumactl
11
+ examples/CA/cacert.pem
12
+ examples/CA/newcerts/cert_1.pem
13
+ examples/CA/newcerts/cert_2.pem
14
+ examples/CA/private/cakeypair.pem
15
+ examples/CA/serial
11
16
  examples/config.rb
17
+ examples/puma/cert_puma.pem
18
+ examples/puma/csr_puma.pem
19
+ examples/puma/puma_keypair.pem
20
+ examples/qc_config.rb
12
21
  ext/puma_http11/PumaHttp11Service.java
13
22
  ext/puma_http11/ext_help.h
14
23
  ext/puma_http11/extconf.rb
@@ -23,6 +32,7 @@ ext/puma_http11/puma_http11.c
23
32
  lib/puma.rb
24
33
  lib/puma/app/status.rb
25
34
  lib/puma/cli.rb
35
+ lib/puma/compat.rb
26
36
  lib/puma/configuration.rb
27
37
  lib/puma/const.rb
28
38
  lib/puma/control_cli.rb
data/README.md CHANGED
@@ -8,7 +8,7 @@ Under the hood, Puma processes requests using a C-optimized Ragel extension (inh
8
8
 
9
9
  With 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.
10
10
 
11
- On 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
+ On 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).
12
12
 
13
13
  ## Quick Start
14
14
 
data/Rakefile CHANGED
@@ -4,6 +4,8 @@ require "rake/javaextensiontask"
4
4
 
5
5
  IS_JRUBY = defined?(RUBY_ENGINE) ? RUBY_ENGINE == "jruby" : false
6
6
 
7
+ Hoe.plugin :git
8
+
7
9
  HOE = Hoe.spec "puma" do
8
10
  self.rubyforge_name = 'puma'
9
11
  self.readme_file = "README.md"
@@ -15,7 +17,7 @@ HOE = Hoe.spec "puma" do
15
17
 
16
18
  require_ruby_version ">= 1.8.7"
17
19
 
18
- dependency "rack", [">= 1.2", "< 2.0"]
20
+ dependency "rack", "~> 1.2"
19
21
 
20
22
  extra_dev_deps << ["rake-compiler", "~> 0.8.0"]
21
23
  end
@@ -0,0 +1,23 @@
1
+ -----BEGIN CERTIFICATE-----
2
+ MIIDxzCCAq+gAwIBAgIBADANBgkqhkiG9w0BAQUFADA5MQswCQYDVQQGEwJVUzEO
3
+ MAwGA1UECgwFbG9jYWwxDTALBgNVBAsMBGFlcm8xCzAJBgNVBAMMAkNBMB4XDTEy
4
+ MDExNDAwMTcyN1oXDTE3MDExMjAwMTcyN1owOTELMAkGA1UEBhMCVVMxDjAMBgNV
5
+ BAoMBWxvY2FsMQ0wCwYDVQQLDARhZXJvMQswCQYDVQQDDAJDQTCCASIwDQYJKoZI
6
+ hvcNAQEBBQADggEPADCCAQoCggEBAN8bteVsrQxfKHzYuwP1vjH2r6qavPK/agCK
7
+ bbPXZmWfUUGjL4ZT4jmnz/B6QNBBKTE/zWcuLXvyRR2FUCi8c5itUvraJVIuBPT/
8
+ lvAZfbyIMpdHG1RPwA6jgTTXm7hnfZc0lCzsFRLk106XrjKeIkZOWffnVLNS2dyH
9
+ X51/yZAS8wFyfx58gabC3hvzJLWw/fDSB/qQsOjp5XCCrP30ILPads/P2dEFNZ1M
10
+ bjGNErVjmEWEor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/jJNt4dGZLsNfj9RejVDd32i/L
10
+ P7wCpoPDaaVcoF2HgvCs39qatyVg6ecu0QJBALN4q+q9nDMGTuNpWU5D2EWjyrqJ
11
+ mCF66R6NcASQxJlWwxQ4zfBHFIvgOD4Nk5VqHZqet5MIN2d6AipOu4/+x50CQHDp
12
+ jf+rd1GHBcXGf8MwnUXWCjvEnEhi/lw+mLVivsRx8QRG4rfIy9monX949Flj8DaU
13
+ 87IPj422kG9s1QeP2nECQQCkg+RUcoQm7SiM8OXuXNeHQlvQNp65geFRxzKAXxT/
14
+ +1Mbtwnd3AXXZBekFDDpE9U3ZQjahoe7oc1oUBuw5hXL
15
+ -----END RSA PRIVATE KEY-----
@@ -0,0 +1,13 @@
1
+ full_hostname = `hostname`.strip
2
+ domainname = full_hostname.split('.')[1..-1].join('.')
3
+ hostname = full_hostname.split('.')[0]
4
+
5
+ CA[:hostname] = hostname
6
+ CA[:domainname] = domainname
7
+ CA[:CA_dir] = File.join Dir.pwd, "CA"
8
+ CA[:password] = 'puma'
9
+
10
+ CERTS << {
11
+ :type => 'server',
12
+ :hostname => 'puma'
13
+ }
@@ -0,0 +1,7 @@
1
+ # Provides code to work properly on 1.8 and 1.9
2
+
3
+ class String
4
+ unless method_defined? :bytesize
5
+ alias_method :bytesize, :size
6
+ end
7
+ end
@@ -75,7 +75,7 @@ module Puma
75
75
 
76
76
  PATH_INFO = 'PATH_INFO'.freeze
77
77
 
78
- PUMA_VERSION = VERSION = "0.9.5".freeze
78
+ PUMA_VERSION = VERSION = "1.0.0".freeze
79
79
 
80
80
  PUMA_TMP_BASE = "puma".freeze
81
81
 
@@ -5,6 +5,7 @@ require 'puma/thread_pool'
5
5
  require 'puma/const'
6
6
  require 'puma/events'
7
7
  require 'puma/null_io'
8
+ require 'puma/compat'
8
9
 
9
10
  require 'puma/puma_http11'
10
11
 
@@ -234,9 +235,9 @@ module Puma
234
235
  return
235
236
  end
236
237
 
237
- nparsed += parser.body.size if cl
238
+ nparsed += parser.body.bytesize if cl
238
239
 
239
- if data.size > nparsed
240
+ if data.bytesize > nparsed
240
241
  data.slice!(0, nparsed)
241
242
  parser.reset
242
243
  env = @proto_env.dup
@@ -292,7 +293,7 @@ module Puma
292
293
  if host = env[HTTP_HOST]
293
294
  if colon = host.index(":")
294
295
  env[SERVER_NAME] = host[0, colon]
295
- env[SERVER_PORT] = host[colon+1, host.size]
296
+ env[SERVER_PORT] = host[colon+1, host.bytesize]
296
297
  else
297
298
  env[SERVER_NAME] = host
298
299
  env[SERVER_PORT] = PORT_80
@@ -370,7 +371,7 @@ module Puma
370
371
  no_body = false
371
372
 
372
373
  if res_body.kind_of? Array and res_body.size == 1
373
- content_length = res_body[0].size
374
+ content_length = res_body[0].bytesize
374
375
  end
375
376
 
376
377
  cork_socket client
@@ -463,7 +464,7 @@ module Puma
463
464
 
464
465
  res_body.each do |part|
465
466
  if chunked
466
- client.write part.size.to_s(16)
467
+ client.write part.bytesize.to_s(16)
467
468
  client.write line_ending
468
469
  client.write part
469
470
  client.write line_ending
@@ -501,7 +502,7 @@ module Puma
501
502
  def read_body(env, client, body, cl)
502
503
  content_length = cl.to_i
503
504
 
504
- remain = content_length - body.size
505
+ remain = content_length - body.bytesize
505
506
 
506
507
  return StringIO.new(body) if remain <= 0
507
508
 
@@ -30,7 +30,14 @@ module Rack
30
30
  server.max_threads = Integer(max)
31
31
  yield server if block_given?
32
32
 
33
- server.run.join
33
+ begin
34
+ server.run.join
35
+ rescue Interrupt
36
+ puts "* Gracefully stopping, waiting for requests to finish"
37
+ server.stop(true)
38
+ puts "* Goodbye!"
39
+ end
40
+
34
41
  end
35
42
 
36
43
  def self.valid_options
@@ -2,22 +2,22 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = "puma"
5
- s.version = "0.9.5"
5
+ s.version = "1.0.0"
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-03-03"
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)."
9
+ s.date = "2012-03-29"
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/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/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_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 = ["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_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.rdoc_options = ["--main", "README.md"]
17
17
  s.require_paths = ["lib"]
18
18
  s.required_ruby_version = Gem::Requirement.new(">= 1.8.7")
19
19
  s.rubyforge_project = "puma"
20
- s.rubygems_version = "1.8.17"
20
+ s.rubygems_version = "1.8.18"
21
21
  s.summary = "Puma is a simple, fast, and highly concurrent HTTP 1.1 server for Ruby web applications"
22
22
  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_persistent.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"]
23
23
 
@@ -25,20 +25,20 @@ Gem::Specification.new do |s|
25
25
  s.specification_version = 3
26
26
 
27
27
  if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
28
- s.add_runtime_dependency(%q<rack>, ["< 2.0", ">= 1.2"])
28
+ s.add_runtime_dependency(%q<rack>, ["~> 1.2"])
29
29
  s.add_development_dependency(%q<rake-compiler>, ["~> 0.8.0"])
30
30
  s.add_development_dependency(%q<rdoc>, ["~> 3.10"])
31
- s.add_development_dependency(%q<hoe>, ["~> 2.12"])
31
+ s.add_development_dependency(%q<hoe>, ["~> 2.14"])
32
32
  else
33
- s.add_dependency(%q<rack>, ["< 2.0", ">= 1.2"])
33
+ s.add_dependency(%q<rack>, ["~> 1.2"])
34
34
  s.add_dependency(%q<rake-compiler>, ["~> 0.8.0"])
35
35
  s.add_dependency(%q<rdoc>, ["~> 3.10"])
36
- s.add_dependency(%q<hoe>, ["~> 2.12"])
36
+ s.add_dependency(%q<hoe>, ["~> 2.14"])
37
37
  end
38
38
  else
39
- s.add_dependency(%q<rack>, ["< 2.0", ">= 1.2"])
39
+ s.add_dependency(%q<rack>, ["~> 1.2"])
40
40
  s.add_dependency(%q<rake-compiler>, ["~> 0.8.0"])
41
41
  s.add_dependency(%q<rdoc>, ["~> 3.10"])
42
- s.add_dependency(%q<hoe>, ["~> 2.12"])
42
+ s.add_dependency(%q<hoe>, ["~> 2.14"])
43
43
  end
44
44
  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: 49
4
+ hash: 23
5
5
  prerelease:
6
6
  segments:
7
+ - 1
7
8
  - 0
8
- - 9
9
- - 5
10
- version: 0.9.5
9
+ - 0
10
+ version: 1.0.0
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-03-03 00:00:00 Z
18
+ date: 2012-03-29 00:00:00 Z
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency
21
21
  name: rack
@@ -23,20 +23,13 @@ dependencies:
23
23
  requirement: &id001 !ruby/object:Gem::Requirement
24
24
  none: false
25
25
  requirements:
26
- - - ">="
26
+ - - ~>
27
27
  - !ruby/object:Gem::Version
28
28
  hash: 11
29
29
  segments:
30
30
  - 1
31
31
  - 2
32
32
  version: "1.2"
33
- - - <
34
- - !ruby/object:Gem::Version
35
- hash: 3
36
- segments:
37
- - 2
38
- - 0
39
- version: "2.0"
40
33
  type: :runtime
41
34
  version_requirements: *id001
42
35
  - !ruby/object:Gem::Dependency
@@ -78,11 +71,11 @@ dependencies:
78
71
  requirements:
79
72
  - - ~>
80
73
  - !ruby/object:Gem::Version
81
- hash: 27
74
+ hash: 31
82
75
  segments:
83
76
  - 2
84
- - 12
85
- version: "2.12"
77
+ - 14
78
+ version: "2.14"
86
79
  type: :development
87
80
  version_requirements: *id004
88
81
  description: |-
@@ -92,7 +85,7 @@ description: |-
92
85
 
93
86
  With 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.
94
87
 
95
- On 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).
88
+ On 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).
96
89
  email:
97
90
  - evan@phx.io
98
91
  executables:
@@ -114,7 +107,16 @@ files:
114
107
  - TODO
115
108
  - bin/puma
116
109
  - bin/pumactl
110
+ - examples/CA/cacert.pem
111
+ - examples/CA/newcerts/cert_1.pem
112
+ - examples/CA/newcerts/cert_2.pem
113
+ - examples/CA/private/cakeypair.pem
114
+ - examples/CA/serial
117
115
  - examples/config.rb
116
+ - examples/puma/cert_puma.pem
117
+ - examples/puma/csr_puma.pem
118
+ - examples/puma/puma_keypair.pem
119
+ - examples/qc_config.rb
118
120
  - ext/puma_http11/PumaHttp11Service.java
119
121
  - ext/puma_http11/ext_help.h
120
122
  - ext/puma_http11/extconf.rb
@@ -129,6 +131,7 @@ files:
129
131
  - lib/puma.rb
130
132
  - lib/puma/app/status.rb
131
133
  - lib/puma/cli.rb
134
+ - lib/puma/compat.rb
132
135
  - lib/puma/configuration.rb
133
136
  - lib/puma/const.rb
134
137
  - lib/puma/control_cli.rb
@@ -192,7 +195,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
192
195
  requirements: []
193
196
 
194
197
  rubyforge_project: puma
195
- rubygems_version: 1.8.17
198
+ rubygems_version: 1.8.18
196
199
  signing_key:
197
200
  specification_version: 3
198
201
  summary: Puma is a simple, fast, and highly concurrent HTTP 1.1 server for Ruby web applications