puma 0.8.2 → 0.9.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.
- data/Manifest.txt +6 -18
- data/Rakefile +86 -8
- data/bin/puma +1 -0
- data/bin/pumactl +12 -0
- data/lib/puma.rb +0 -3
- data/lib/puma/app/status.rb +37 -0
- data/lib/puma/cli.rb +161 -5
- data/lib/puma/const.rb +35 -2
- data/lib/puma/control_cli.rb +112 -0
- data/lib/puma/events.rb +18 -0
- data/lib/puma/null_io.rb +35 -0
- data/lib/puma/rack_patch.rb +4 -1
- data/lib/puma/server.rb +178 -76
- data/lib/puma/thread_pool.rb +51 -0
- data/puma.gemspec +5 -5
- data/test/ab_rs.rb +22 -0
- data/test/test_app_status.rb +69 -0
- data/test/test_cli.rb +91 -5
- data/test/test_http11.rb +1 -18
- data/test/test_persistent.rb +3 -3
- data/test/test_rack_server.rb +6 -0
- data/test/test_thread_pool.rb +24 -0
- metadata +31 -27
- data/.gemtest +0 -0
- data/examples/builder.rb +0 -29
- data/examples/camping/README +0 -3
- data/examples/camping/blog.rb +0 -294
- data/examples/camping/tepee.rb +0 -149
- data/examples/httpd.conf +0 -474
- data/examples/mime.yaml +0 -3
- data/examples/mongrel.conf +0 -9
- data/examples/monitrc +0 -57
- data/examples/random_thrash.rb +0 -19
- data/examples/simpletest.rb +0 -52
- data/examples/webrick_compare.rb +0 -20
- data/lib/puma/gems.rb +0 -20
- data/lib/puma/mime_types.yml +0 -616
- data/lib/puma/utils.rb +0 -44
- data/tasks/gem.rake +0 -24
- data/tasks/java.rake +0 -12
- data/tasks/native.rake +0 -36
- data/tasks/ragel.rake +0 -24
data/lib/puma/utils.rb
DELETED
@@ -1,44 +0,0 @@
|
|
1
|
-
module Puma
|
2
|
-
module Utils
|
3
|
-
# Performs URI escaping so that you can construct proper
|
4
|
-
# query strings faster. Use this rather than the cgi.rb
|
5
|
-
# version since it's faster. (Stolen from Camping).
|
6
|
-
def self.escape(s)
|
7
|
-
s.to_s.gsub(/([^ a-zA-Z0-9_.-]+)/n) {
|
8
|
-
'%'+$1.unpack('H2'*$1.size).join('%').upcase
|
9
|
-
}.tr(' ', '+')
|
10
|
-
end
|
11
|
-
|
12
|
-
|
13
|
-
# Unescapes a URI escaped string. (Stolen from Camping).
|
14
|
-
def self.unescape(s)
|
15
|
-
s.tr('+', ' ').gsub(/((?:%[0-9a-fA-F]{2})+)/n){
|
16
|
-
[$1.delete('%')].pack('H*')
|
17
|
-
}
|
18
|
-
end
|
19
|
-
|
20
|
-
# Parses a query string by breaking it up at the '&'
|
21
|
-
# and ';' characters. You can also use this to parse
|
22
|
-
# cookies by changing the characters used in the second
|
23
|
-
# parameter (which defaults to '&;'.
|
24
|
-
def self.query_parse(qs, d = '&;')
|
25
|
-
params = {}
|
26
|
-
|
27
|
-
qs.split(/[#{d}] */n).each do |p|
|
28
|
-
k, v = unescape(p).split('=', 2)
|
29
|
-
|
30
|
-
if cur = params[k]
|
31
|
-
if cur.kind_of? Array
|
32
|
-
params[k] << v
|
33
|
-
else
|
34
|
-
params[k] = [cur, v]
|
35
|
-
end
|
36
|
-
else
|
37
|
-
params[k] = v
|
38
|
-
end
|
39
|
-
end
|
40
|
-
|
41
|
-
return params
|
42
|
-
end
|
43
|
-
end
|
44
|
-
end
|
data/tasks/gem.rake
DELETED
@@ -1,24 +0,0 @@
|
|
1
|
-
require 'hoe'
|
2
|
-
|
3
|
-
HOE = Hoe.spec 'puma' do
|
4
|
-
self.rubyforge_name = 'puma'
|
5
|
-
self.readme_file = "README.md"
|
6
|
-
developer 'Evan Phoenix', 'evan@phx.io'
|
7
|
-
|
8
|
-
spec_extras[:extensions] = ["ext/puma_http11/extconf.rb"]
|
9
|
-
spec_extras[:executables] = ['puma']
|
10
|
-
|
11
|
-
dependency 'rack', '~> 1.2'
|
12
|
-
|
13
|
-
extra_dev_deps << ['rake-compiler', "~> 0.7.0"]
|
14
|
-
|
15
|
-
clean_globs.push('test_*.log', 'log')
|
16
|
-
end
|
17
|
-
|
18
|
-
file "#{HOE.spec.name}.gemspec" => ['Rakefile', 'tasks/gem.rake'] do |t|
|
19
|
-
puts "Generating #{t.name}"
|
20
|
-
File.open(t.name, 'w') { |f| f.puts HOE.spec.to_ruby }
|
21
|
-
end
|
22
|
-
|
23
|
-
desc "Generate or update the standalone gemspec file for the project"
|
24
|
-
task :gemspec => ["#{HOE.spec.name}.gemspec"]
|
data/tasks/java.rake
DELETED
@@ -1,12 +0,0 @@
|
|
1
|
-
if IS_JRUBY
|
2
|
-
|
3
|
-
require 'rake/javaextensiontask'
|
4
|
-
|
5
|
-
# build http11 java extension
|
6
|
-
Rake::JavaExtensionTask.new('puma_http11', HOE.spec) do |ext|
|
7
|
-
ext.java_compiling do |gs|
|
8
|
-
gs.dependencies.delete gs.dependencies.find { |d| d.name == 'daemons' }
|
9
|
-
end
|
10
|
-
end
|
11
|
-
|
12
|
-
end
|
data/tasks/native.rake
DELETED
@@ -1,36 +0,0 @@
|
|
1
|
-
unless IS_JRUBY
|
2
|
-
|
3
|
-
# use rake-compiler for building the extension
|
4
|
-
require 'rake/extensiontask'
|
5
|
-
|
6
|
-
# build http11 C extension
|
7
|
-
Rake::ExtensionTask.new('puma_http11', HOE.spec) do |ext|
|
8
|
-
# define target for extension (supporting fat binaries)
|
9
|
-
if RUBY_PLATFORM =~ /mingw|mswin/ then
|
10
|
-
RUBY_VERSION =~ /(\d+\.\d+)/
|
11
|
-
ext.lib_dir = "lib/#{$1}"
|
12
|
-
elsif ENV['CROSS']
|
13
|
-
# define cross-compilation tasks when not on Windows.
|
14
|
-
ext.cross_compile = true
|
15
|
-
ext.cross_platform = ['i386-mswin32', 'i386-mingw32']
|
16
|
-
|
17
|
-
ext.cross_compiling do |gs|
|
18
|
-
gs.dependencies.delete gs.dependencies.find { |d| d.name == 'daemons' }
|
19
|
-
end
|
20
|
-
end
|
21
|
-
|
22
|
-
# cleanup versioned library directory
|
23
|
-
CLEAN.include 'lib/{1.8,1.9}'
|
24
|
-
end
|
25
|
-
end
|
26
|
-
|
27
|
-
task :ext_clean do
|
28
|
-
sh "rm -rf lib/puma_http11.bundle"
|
29
|
-
sh "rm -rf lib/puma_http11.jar"
|
30
|
-
sh "rm -rf lib/puma_http11.so"
|
31
|
-
end
|
32
|
-
|
33
|
-
# ensure things are built prior testing
|
34
|
-
task :test => [:compile]
|
35
|
-
|
36
|
-
task :clean => :ext_clean
|
data/tasks/ragel.rake
DELETED
@@ -1,24 +0,0 @@
|
|
1
|
-
|
2
|
-
# the following tasks ease the build of C file from Ragel one
|
3
|
-
|
4
|
-
file 'ext/puma_http11/http11_parser.c' => ['ext/puma_http11/http11_parser.rl'] do |t|
|
5
|
-
begin
|
6
|
-
sh "ragel #{t.prerequisites.last} -C -G2 -o #{t.name}"
|
7
|
-
rescue
|
8
|
-
fail "Could not build wrapper using Ragel (it failed or not installed?)"
|
9
|
-
end
|
10
|
-
end
|
11
|
-
|
12
|
-
file 'ext/puma_http11/org/jruby/puma/Http11Parser.java' => ['ext/puma_http11/http11_parser.java.rl'] do |t|
|
13
|
-
begin
|
14
|
-
sh "ragel #{t.prerequisites.last} -J -G2 -o #{t.name}"
|
15
|
-
rescue
|
16
|
-
fail "Could not build wrapper using Ragel (it failed or not installed?)"
|
17
|
-
end
|
18
|
-
end
|
19
|
-
|
20
|
-
if IS_JRUBY
|
21
|
-
task :ragel => 'ext/puma_http11/org/jruby/puma/Http11Parser.java'
|
22
|
-
else
|
23
|
-
task :ragel => 'ext/puma_http11/http11_parser.c'
|
24
|
-
end
|