rhebok 0.0.6 → 0.0.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/Changes +5 -0
- data/README.md +9 -1
- data/lib/rack/handler/rhebok.rb +28 -5
- data/lib/rhebok/version.rb +1 -1
- data/rhebok.gemspec +2 -2
- data/test/{spec_02_basic.rb → spec_01_basic.rb} +0 -0
- data/test/spec_03_unix.rb +46 -0
- metadata +11 -9
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6f7b4d1269e51f01608ce10b664cbac7a48ab183
|
4
|
+
data.tar.gz: 63d4f869951c560a78b4878744b939e8ee40004c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f1954f4c61f6f593af6d057d799d1c0568c7d978e21eb72fd0c90cba4effa0c4d12c6d2273e69dd2ebe87c9d29610b9af4c9a285175120ea5c41a5a95706d705
|
7
|
+
data.tar.gz: 9fe22db2f5b0e3f311b6321f28325d3f60dbba146c2d4873f338c165c13c4b582df97c693392bfc0aabbb17c3b38f3f25175e1ff1e5845e33ec26b79cf5c27e2
|
data/Changes
CHANGED
data/README.md
CHANGED
@@ -10,7 +10,7 @@ Rhebok supports following features.
|
|
10
10
|
- uses accept4(2) if OS support
|
11
11
|
- uses writev(2) for output responses
|
12
12
|
- prefork and graceful shutdown using prefork_engine
|
13
|
-
- hot deploy
|
13
|
+
- hot deploy using start_server
|
14
14
|
- only supports HTTP/1.0. But does not support Keepalive.
|
15
15
|
- supports OobGC
|
16
16
|
|
@@ -69,6 +69,14 @@ hostname or ip address to bind (default: 0.0.0.0)
|
|
69
69
|
|
70
70
|
port to bind (default: 9292)
|
71
71
|
|
72
|
+
### Path
|
73
|
+
|
74
|
+
path to listen using unix socket
|
75
|
+
|
76
|
+
### BackLog
|
77
|
+
|
78
|
+
specifies a listen backlog parameter
|
79
|
+
|
72
80
|
### MaxWorkers
|
73
81
|
|
74
82
|
number of worker processes (default: 10)
|
data/lib/rack/handler/rhebok.rb
CHANGED
@@ -25,6 +25,7 @@ module Rack
|
|
25
25
|
DEFAULT_OPTIONS = {
|
26
26
|
:Host => '0.0.0.0',
|
27
27
|
:Port => 9292,
|
28
|
+
:Path => nil,
|
28
29
|
:MaxWorkers => 10,
|
29
30
|
:Timeout => 300,
|
30
31
|
:MaxRequestPerChild => 1000,
|
@@ -34,6 +35,7 @@ module Rack
|
|
34
35
|
:OobGC => false,
|
35
36
|
:MaxGCPerRequest => 5,
|
36
37
|
:MinGCPerRequest => nil,
|
38
|
+
:BackLog => nil,
|
37
39
|
}
|
38
40
|
NULLIO = StringIO.new("").set_encoding('BINARY')
|
39
41
|
|
@@ -55,7 +57,6 @@ module Rack
|
|
55
57
|
options[:OobGC] = options[:OobGC].match(/^(true|yes|1)$/i) ? true : false
|
56
58
|
end
|
57
59
|
@options = DEFAULT_OPTIONS.merge(options)
|
58
|
-
p @options[:OobGC]
|
59
60
|
@server = nil
|
60
61
|
@_is_tcp = false
|
61
62
|
@_using_defer_accept = false
|
@@ -75,10 +76,32 @@ module Rack
|
|
75
76
|
end
|
76
77
|
|
77
78
|
if @server == nil
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
79
|
+
if @options[:Path] != nil
|
80
|
+
if ::File.socket?(@options[:Path])
|
81
|
+
puts "removing existing socket file:#{@options[:Path]}";
|
82
|
+
::File.unlink(@options[:Path])
|
83
|
+
end
|
84
|
+
begin
|
85
|
+
::File.unlink(@options[:Path])
|
86
|
+
rescue
|
87
|
+
#ignore
|
88
|
+
end
|
89
|
+
puts "Rhebok starts Listening on :unix:#{@options[:Path]} Pid:#{$$}"
|
90
|
+
oldmask = ::File.umask(0)
|
91
|
+
@server = UNIXServer.open(@options[:Path])
|
92
|
+
::File.umask(oldmask)
|
93
|
+
@_is_tcp = false
|
94
|
+
@options[:Host] = "0.0.0.0"
|
95
|
+
@options[:Port] = 0
|
96
|
+
else
|
97
|
+
puts "Rhebok starts Listening on #{@options[:Host]}:#{@options[:Port]} Pid:#{$$}"
|
98
|
+
@server = TCPServer.open(@options[:Host], @options[:Port])
|
99
|
+
@server.setsockopt(:SOCKET, :REUSEADDR, 1)
|
100
|
+
@_is_tcp = true
|
101
|
+
end
|
102
|
+
if @options[:BackLog] != nil
|
103
|
+
@server.listen(@options[:BackLog].to_i)
|
104
|
+
end
|
82
105
|
end
|
83
106
|
|
84
107
|
if RUBY_PLATFORM.match(/linux/) && @_is_tcp == true
|
data/lib/rhebok/version.rb
CHANGED
data/rhebok.gemspec
CHANGED
@@ -22,8 +22,8 @@ Gem::Specification.new do |spec|
|
|
22
22
|
spec.add_development_dependency "bundler", "~> 1.7"
|
23
23
|
spec.add_development_dependency "rake", "~> 10.0"
|
24
24
|
spec.add_development_dependency "bacon"
|
25
|
-
spec.add_dependency "rack", "
|
26
|
-
spec.add_dependency "prefork_engine", "
|
25
|
+
spec.add_dependency "rack", ">= 1.5.0"
|
26
|
+
spec.add_dependency "prefork_engine", ">= 0.0.4"
|
27
27
|
|
28
28
|
# get an array of submodule dirs by executing 'pwd' inside each submodule
|
29
29
|
`git submodule --quiet foreach pwd`.split($\).each do |submodule_path|
|
File without changes
|
@@ -0,0 +1,46 @@
|
|
1
|
+
require 'rack'
|
2
|
+
require File.expand_path('../testrequest', __FILE__)
|
3
|
+
require 'timeout'
|
4
|
+
require 'socket'
|
5
|
+
require 'rack/handler/rhebok'
|
6
|
+
|
7
|
+
describe Rhebok do
|
8
|
+
extend TestRequest::Helpers
|
9
|
+
begin
|
10
|
+
|
11
|
+
@path = "/tmp/app_spec_03_unix.sock"
|
12
|
+
@app = Rack::Lint.new(TestRequest.new)
|
13
|
+
@pid = fork
|
14
|
+
if @pid == nil
|
15
|
+
#child
|
16
|
+
Rack::Handler::Rhebok.run(@app, :Path=>@path, :MaxWorkers=>1)
|
17
|
+
exit!(true)
|
18
|
+
end
|
19
|
+
sleep 1
|
20
|
+
|
21
|
+
c = UNIXSocket.open(@path)
|
22
|
+
c.write("GET / HTTP/1.0\r\n\r\n");
|
23
|
+
outbuf = ""
|
24
|
+
c.read(nil,outbuf)
|
25
|
+
header,body = outbuf.split(/\r\n\r\n/,2)
|
26
|
+
response = YAML.load(body)
|
27
|
+
|
28
|
+
should "unix domain" do
|
29
|
+
header.should.not.be.nil
|
30
|
+
response["rack.version"].should.equal [1,1]
|
31
|
+
response["rack.url_scheme"].should.equal "http"
|
32
|
+
response["SERVER_NAME"].should.equal "0.0.0.0"
|
33
|
+
response["SERVER_PORT"].should.equal "0"
|
34
|
+
response["REMOTE_ADDR"].should.equal ""
|
35
|
+
response["REMOTE_PORT"].should.equal "0"
|
36
|
+
end
|
37
|
+
|
38
|
+
ensure
|
39
|
+
sleep 1
|
40
|
+
if @pid != nil
|
41
|
+
Process.kill(:TERM, @pid)
|
42
|
+
Process.wait()
|
43
|
+
end
|
44
|
+
end
|
45
|
+
|
46
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rhebok
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Masahiro Nagano
|
@@ -56,28 +56,28 @@ dependencies:
|
|
56
56
|
name: rack
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
|
-
- - "
|
59
|
+
- - ">="
|
60
60
|
- !ruby/object:Gem::Version
|
61
|
-
version: 1.5.
|
61
|
+
version: 1.5.0
|
62
62
|
type: :runtime
|
63
63
|
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
|
-
- - "
|
66
|
+
- - ">="
|
67
67
|
- !ruby/object:Gem::Version
|
68
|
-
version: 1.5.
|
68
|
+
version: 1.5.0
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: prefork_engine
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
72
72
|
requirements:
|
73
|
-
- - "
|
73
|
+
- - ">="
|
74
74
|
- !ruby/object:Gem::Version
|
75
75
|
version: 0.0.4
|
76
76
|
type: :runtime
|
77
77
|
prerelease: false
|
78
78
|
version_requirements: !ruby/object:Gem::Requirement
|
79
79
|
requirements:
|
80
|
-
- - "
|
80
|
+
- - ">="
|
81
81
|
- !ruby/object:Gem::Version
|
82
82
|
version: 0.0.4
|
83
83
|
description: High Performance and Optimized Preforked Rack Handler
|
@@ -111,8 +111,9 @@ files:
|
|
111
111
|
- lib/rhebok.rb
|
112
112
|
- lib/rhebok/version.rb
|
113
113
|
- rhebok.gemspec
|
114
|
-
- test/
|
114
|
+
- test/spec_01_basic.rb
|
115
115
|
- test/spec_02_server.rb
|
116
|
+
- test/spec_03_unix.rb
|
116
117
|
- test/testrequest.rb
|
117
118
|
homepage: https://github.com/kazeburo/rhebok
|
118
119
|
licenses:
|
@@ -139,6 +140,7 @@ signing_key:
|
|
139
140
|
specification_version: 4
|
140
141
|
summary: High Performance Preforked Rack Handler
|
141
142
|
test_files:
|
142
|
-
- test/
|
143
|
+
- test/spec_01_basic.rb
|
143
144
|
- test/spec_02_server.rb
|
145
|
+
- test/spec_03_unix.rb
|
144
146
|
- test/testrequest.rb
|