puma 0.9.5-java → 1.0.0-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.

@@ -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
+ bjGNErVjmE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bTp/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
+ }
@@ -33,6 +33,8 @@ module Puma
33
33
  @restart = false
34
34
  @temp_status_path = nil
35
35
 
36
+ @listen_config = []
37
+
36
38
  setup_options
37
39
 
38
40
  generate_restart_data
@@ -64,6 +66,7 @@ module Puma
64
66
 
65
67
  if defined? Rubinius::OS_ARGV
66
68
  @restart_argv = Rubinius::OS_ARGV
69
+ @restart_arg0 = [@restart_argv.first]
67
70
  else
68
71
  require 'rubygems'
69
72
 
@@ -72,10 +75,12 @@ module Puma
72
75
  # picked up in PATH.
73
76
  #
74
77
  if File.exists?($0)
75
- @restart_argv = [Gem.ruby, $0] + ARGV
78
+ @restart_arg0 = [Gem.ruby, $0]
76
79
  else
77
- @restart_argv = [Gem.ruby, "-S", $0] + ARGV
80
+ @restart_arg0 = [Gem.ruby, "-S", $0]
78
81
  end
82
+
83
+ @restart_argv = @restart_arg0 + ARGV
79
84
  end
80
85
  end
81
86
 
@@ -89,6 +94,36 @@ module Puma
89
94
  end
90
95
  end
91
96
 
97
+ def hot_restart!
98
+ if IS_JRUBY
99
+ require 'puma/jruby_restart'
100
+ JRubyRestart.chdir_exec(@restart_dir, Gem.ruby, *@restart_argv)
101
+ else
102
+
103
+ path = File.join (ENV['TMPDIR'] || "/tmp"), "puma-hotrestart.#{$$}"
104
+
105
+ fork do
106
+ data = Marshal.dump(@listen_config)
107
+
108
+ serv = UNIXServer.new path
109
+ client = serv.accept
110
+
111
+ client << "#{data.bytesize}\n#{data}"
112
+
113
+ @ios.each do |x|
114
+ client.send_io x
115
+ end
116
+
117
+ client.read(1)
118
+ exit 0
119
+ end
120
+
121
+ Dir.chdir @restart_dir
122
+ argv = @restart_arg0 + ["--hot-restart", path]
123
+ Kernel.exec(*argv)
124
+ end
125
+ end
126
+
92
127
  # Write +str+ to +@stdout+
93
128
  #
94
129
  def log(str)
@@ -163,6 +198,33 @@ module Puma
163
198
  end
164
199
  end
165
200
 
201
+ o.on "--hot-restart PATH", "Used internally for performing a hot restart" do |arg|
202
+
203
+ sock = UNIXSocket.new arg
204
+ size = sock.gets.strip.to_i
205
+ data = sock.read size
206
+
207
+ @listen_config = Marshal.load data
208
+ ios = []
209
+
210
+ @listen_config.each do |c|
211
+ case c['type']
212
+ when "tcp"
213
+ ios << sock.recv_io(TCPServer)
214
+ when "unix"
215
+ ios << sock.recv_io(UNIXServer)
216
+ when "ssl"
217
+ ctx = OpenSSL::SSL::SSLContext.new
218
+ ctx.key = OpenSSL::PKey::RSA.new c['key']
219
+ ctx.cert = OpenSSL::X509::Certificate.new c['cert']
220
+
221
+ ctx.verify_mode = OpenSSL::SSL::VERIFY_NONE
222
+
223
+ tcp = sock.recv_io(TCPServer)
224
+ ios << OpenSSL::SSL::SSLServer.new(tcp, ctx)
225
+ end
226
+ end
227
+ end
166
228
  end
167
229
 
168
230
  @parser.banner = "puma <options> <rackup file>"
@@ -239,11 +301,23 @@ module Puma
239
301
  when "tcp"
240
302
  log "* Listening on #{str}"
241
303
  server.add_tcp_listener uri.host, uri.port
304
+
305
+ conf = { "type" => "tcp",
306
+ "host" => uri.host,
307
+ "port" => uri.port }
308
+
309
+ @listen_config << conf
310
+
242
311
  when "unix"
243
312
  log "* Listening on #{str}"
244
313
  path = "#{uri.host}#{uri.path}"
245
314
 
246
315
  server.add_unix_listener path
316
+
317
+ conf = { "type" => "unix",
318
+ "path" => path }
319
+
320
+ @listen_config << conf
247
321
  when "ssl"
248
322
  log "* Listening on #{str}"
249
323
  params = Rack::Utils.parse_query uri.query
@@ -265,6 +339,15 @@ module Puma
265
339
  ctx.verify_mode = OpenSSL::SSL::VERIFY_NONE
266
340
 
267
341
  server.add_ssl_listener uri.host, uri.port, ctx
342
+
343
+ conf = { "type" => "ssl",
344
+ "host" => uri.host,
345
+ "port" => uri.port,
346
+ "ssl_key" => params['key'],
347
+ "ssl_cert" => params['cert'] }
348
+
349
+ @listen_config << conf
350
+
268
351
  else
269
352
  error "Invalid URI: #{str}"
270
353
  end
@@ -304,10 +387,16 @@ module Puma
304
387
  @status = status
305
388
  end
306
389
 
390
+ hot_restart = false
391
+
392
+ Signal.trap "SIGUSR1" do
393
+ hot_restart = true
394
+ end
395
+
307
396
  log "Use Ctrl-C to stop"
308
397
 
309
398
  begin
310
- server.run.join
399
+ server.run.join(1) until hot_restart
311
400
  rescue Interrupt
312
401
  log " - Gracefully stopping, waiting for requests to finish"
313
402
  server.stop(true)
@@ -316,7 +405,10 @@ module Puma
316
405
 
317
406
  File.unlink @temp_status_path if @temp_status_path
318
407
 
319
- if @restart
408
+ if hot_restart
409
+ log "* Starting hot restart..."
410
+ hot_restart!
411
+ elsif @restart
320
412
  log "* Restarting..."
321
413
  restart!
322
414
  end
@@ -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
 
Binary file
@@ -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
@@ -0,0 +1,6 @@
1
+ require 'puma'
2
+ require 'test/unit'
3
+ require 'timeout'
4
+
5
+ class TestPumaServer < Test::Unit::TestCase
6
+ end
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: puma
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 0.9.5
5
+ version: 1.0.0
6
6
  platform: java
7
7
  authors:
8
8
  - Evan Phoenix
@@ -10,8 +10,7 @@ autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
12
 
13
- date: 2012-03-02 00:00:00 -08:00
14
- default_executable:
13
+ date: 2012-03-30 00:00:00 Z
15
14
  dependencies:
16
15
  - !ruby/object:Gem::Dependency
17
16
  name: rack
@@ -19,36 +18,44 @@ dependencies:
19
18
  requirement: &id001 !ruby/object:Gem::Requirement
20
19
  none: false
21
20
  requirements:
22
- - - ">="
21
+ - - ~>
23
22
  - !ruby/object:Gem::Version
24
23
  version: "1.2"
25
- - - <
26
- - !ruby/object:Gem::Version
27
- version: "2.0"
28
24
  type: :runtime
29
25
  version_requirements: *id001
30
26
  - !ruby/object:Gem::Dependency
31
- name: rake-compiler
27
+ name: rdoc
32
28
  prerelease: false
33
29
  requirement: &id002 !ruby/object:Gem::Requirement
34
30
  none: false
35
31
  requirements:
36
32
  - - ~>
37
33
  - !ruby/object:Gem::Version
38
- version: 0.8.0
34
+ version: "3.10"
39
35
  type: :development
40
36
  version_requirements: *id002
41
37
  - !ruby/object:Gem::Dependency
42
- name: hoe
38
+ name: rake-compiler
43
39
  prerelease: false
44
40
  requirement: &id003 !ruby/object:Gem::Requirement
45
41
  none: false
46
42
  requirements:
47
43
  - - ~>
48
44
  - !ruby/object:Gem::Version
49
- version: "2.12"
45
+ version: 0.8.0
50
46
  type: :development
51
47
  version_requirements: *id003
48
+ - !ruby/object:Gem::Dependency
49
+ name: hoe
50
+ prerelease: false
51
+ requirement: &id004 !ruby/object:Gem::Requirement
52
+ none: false
53
+ requirements:
54
+ - - ~>
55
+ - !ruby/object:Gem::Version
56
+ version: "3.0"
57
+ type: :development
58
+ version_requirements: *id004
52
59
  description: |-
53
60
  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.
54
61
 
@@ -56,7 +63,7 @@ description: |-
56
63
 
57
64
  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.
58
65
 
59
- 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).
66
+ 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).
60
67
  email:
61
68
  - evan@phx.io
62
69
  executables:
@@ -78,7 +85,16 @@ files:
78
85
  - TODO
79
86
  - bin/puma
80
87
  - bin/pumactl
88
+ - examples/CA/cacert.pem
89
+ - examples/CA/newcerts/cert_1.pem
90
+ - examples/CA/newcerts/cert_2.pem
91
+ - examples/CA/private/cakeypair.pem
92
+ - examples/CA/serial
81
93
  - examples/config.rb
94
+ - examples/puma/cert_puma.pem
95
+ - examples/puma/csr_puma.pem
96
+ - examples/puma/puma_keypair.pem
97
+ - examples/qc_config.rb
82
98
  - ext/puma_http11/PumaHttp11Service.java
83
99
  - ext/puma_http11/ext_help.h
84
100
  - ext/puma_http11/extconf.rb
@@ -93,6 +109,7 @@ files:
93
109
  - lib/puma.rb
94
110
  - lib/puma/app/status.rb
95
111
  - lib/puma/cli.rb
112
+ - lib/puma/compat.rb
96
113
  - lib/puma/configuration.rb
97
114
  - lib/puma/const.rb
98
115
  - lib/puma/control_cli.rb
@@ -124,8 +141,8 @@ files:
124
141
  - test/test_ws.rb
125
142
  - test/testhelp.rb
126
143
  - tools/trickletest.rb
144
+ - test/test_puma_server.rb
127
145
  - lib/puma/puma_http11.jar
128
- has_rdoc: true
129
146
  homepage:
130
147
  licenses: []
131
148
 
@@ -150,7 +167,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
150
167
  requirements: []
151
168
 
152
169
  rubyforge_project: puma
153
- rubygems_version: 1.5.1
170
+ rubygems_version: 1.8.15
154
171
  signing_key:
155
172
  specification_version: 3
156
173
  summary: Puma is a simple, fast, and highly concurrent HTTP 1.1 server for Ruby web applications
@@ -162,6 +179,7 @@ test_files:
162
179
  - test/test_http11.rb
163
180
  - test/test_integration.rb
164
181
  - test/test_persistent.rb
182
+ - test/test_puma_server.rb
165
183
  - test/test_rack_handler.rb
166
184
  - test/test_rack_server.rb
167
185
  - test/test_thread_pool.rb