hayabusa 0.0.11 → 0.0.12
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile.lock +2 -2
- data/VERSION +1 -1
- data/hayabusa.gemspec +12 -20
- data/lib/hayabusa.rb +23 -3
- data/lib/hayabusa_cgi_session.rb +5 -91
- data/lib/hayabusa_cgi_tools.rb +6 -3
- data/lib/hayabusa_client_session.rb +151 -0
- data/lib/hayabusa_ext/threadding.rb +19 -2
- data/lib/hayabusa_fcgi.rb +2 -1
- data/lib/hayabusa_http_server.rb +22 -16
- data/lib/hayabusa_http_session.rb +4 -122
- data/lib/hayabusa_http_session_request.rb +1 -1
- data/lib/hayabusa_http_session_response.rb +2 -1
- data/pages/config_cgi.rb +19 -0
- data/pages/config_fcgi.rb +19 -0
- data/{tests/fcgi_test/multiple_threads.rhtml → pages/spec_multiple_threads.rhtml} +0 -0
- data/{tests/fcgi_test/sleeper.rhtml → pages/spec_sleeper.rhtml} +0 -0
- data/{tests/cgi_test/vars_get_test.rhtml → pages/spec_vars_get.rhtml} +0 -0
- data/{tests/cgi_test/vars_header_test.rhtml → pages/spec_vars_header.rhtml} +0 -0
- data/{tests/cgi_test/vars_post_test.rhtml → pages/spec_vars_post.rhtml} +0 -0
- data/{tests/cgi_test → pages}/threadded_content_test.rhtml +0 -0
- data/spec/fcgi_multiple_processes_spec.rb +3 -3
- data/spec/hayabusa_spec.rb +156 -47
- metadata +12 -20
- data/pages/spec_post.rhtml +0 -3
- data/spec/cgi_spec.rb +0 -49
- data/spec/custom_urls_spec.rb +0 -35
- data/spec/fcgi_spec.rb +0 -71
- data/tests/cgi_test/config_cgi.rb +0 -6
- data/tests/fcgi_test/config_fcgi.rb +0 -6
- data/tests/fcgi_test/index.rhtml +0 -3
- data/tests/fcgi_test/threadded_content_test.rhtml +0 -23
- data/tests/fcgi_test/vars_get_test.rhtml +0 -4
- data/tests/fcgi_test/vars_header_test.rhtml +0 -3
- data/tests/fcgi_test/vars_post_test.rhtml +0 -4
metadata
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
name: hayabusa
|
3
3
|
version: !ruby/object:Gem::Version
|
4
4
|
prerelease:
|
5
|
-
version: 0.0.
|
5
|
+
version: 0.0.12
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
8
8
|
- Kasper Johansen
|
@@ -10,7 +10,7 @@ autorequire:
|
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
12
|
|
13
|
-
date: 2012-09-
|
13
|
+
date: 2012-09-18 00:00:00 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: knjrbfw
|
@@ -169,6 +169,7 @@ files:
|
|
169
169
|
- lib/hayabusa.rb
|
170
170
|
- lib/hayabusa_cgi_session.rb
|
171
171
|
- lib/hayabusa_cgi_tools.rb
|
172
|
+
- lib/hayabusa_client_session.rb
|
172
173
|
- lib/hayabusa_custom_io.rb
|
173
174
|
- lib/hayabusa_database.rb
|
174
175
|
- lib/hayabusa_erb_handler.rb
|
@@ -204,6 +205,8 @@ files:
|
|
204
205
|
- pages/benchmark_print.rhtml
|
205
206
|
- pages/benchmark_simple.rhtml
|
206
207
|
- pages/benchmark_threadded_content.rhtml
|
208
|
+
- pages/config_cgi.rb
|
209
|
+
- pages/config_fcgi.rb
|
207
210
|
- pages/debug_database_connections.rhtml
|
208
211
|
- pages/debug_http_sessions.rhtml
|
209
212
|
- pages/debug_memory_usage.rhtml
|
@@ -211,30 +214,19 @@ files:
|
|
211
214
|
- pages/logs_latest.rhtml
|
212
215
|
- pages/logs_show.rhtml
|
213
216
|
- pages/spec.rhtml
|
214
|
-
- pages/
|
217
|
+
- pages/spec_multiple_threads.rhtml
|
218
|
+
- pages/spec_sleeper.rhtml
|
215
219
|
- pages/spec_test_multiple_clients.rhtml
|
216
220
|
- pages/spec_thread_joins.rhtml
|
217
221
|
- pages/spec_threadded_content.rhtml
|
222
|
+
- pages/spec_vars_get.rhtml
|
223
|
+
- pages/spec_vars_header.rhtml
|
224
|
+
- pages/spec_vars_post.rhtml
|
218
225
|
- pages/tests.rhtml
|
219
|
-
-
|
220
|
-
- spec/custom_urls_spec.rb
|
226
|
+
- pages/threadded_content_test.rhtml
|
221
227
|
- spec/fcgi_multiple_processes_spec.rb
|
222
|
-
- spec/fcgi_spec.rb
|
223
228
|
- spec/hayabusa_spec.rb
|
224
229
|
- spec/spec_helper.rb
|
225
|
-
- tests/cgi_test/config_cgi.rb
|
226
|
-
- tests/cgi_test/threadded_content_test.rhtml
|
227
|
-
- tests/cgi_test/vars_get_test.rhtml
|
228
|
-
- tests/cgi_test/vars_header_test.rhtml
|
229
|
-
- tests/cgi_test/vars_post_test.rhtml
|
230
|
-
- tests/fcgi_test/config_fcgi.rb
|
231
|
-
- tests/fcgi_test/index.rhtml
|
232
|
-
- tests/fcgi_test/multiple_threads.rhtml
|
233
|
-
- tests/fcgi_test/sleeper.rhtml
|
234
|
-
- tests/fcgi_test/threadded_content_test.rhtml
|
235
|
-
- tests/fcgi_test/vars_get_test.rhtml
|
236
|
-
- tests/fcgi_test/vars_header_test.rhtml
|
237
|
-
- tests/fcgi_test/vars_post_test.rhtml
|
238
230
|
homepage: http://github.com/kaspernj/hayabusa
|
239
231
|
licenses:
|
240
232
|
- MIT
|
@@ -248,7 +240,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
248
240
|
requirements:
|
249
241
|
- - ">="
|
250
242
|
- !ruby/object:Gem::Version
|
251
|
-
hash:
|
243
|
+
hash: -1021482697357542024
|
252
244
|
segments:
|
253
245
|
- 0
|
254
246
|
version: "0"
|
data/pages/spec_post.rhtml
DELETED
data/spec/cgi_spec.rb
DELETED
@@ -1,49 +0,0 @@
|
|
1
|
-
require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
|
2
|
-
|
3
|
-
describe "Hayabusa" do
|
4
|
-
it "should be able to start a sample-server" do
|
5
|
-
require "rubygems"
|
6
|
-
require "http2"
|
7
|
-
require "json"
|
8
|
-
|
9
|
-
Http2.new(:host => "localhost") do |http|
|
10
|
-
res = http.post(:url => "hayabusa_cgi_test/vars_post_test.rhtml", :post => {
|
11
|
-
"test_special_chars" => "1%23+-456",
|
12
|
-
"var" => {
|
13
|
-
0 => 1,
|
14
|
-
1 => 2,
|
15
|
-
3 => {
|
16
|
-
"kasper" => 5,
|
17
|
-
"arr" => ["a", "b", "c"]
|
18
|
-
}
|
19
|
-
}
|
20
|
-
})
|
21
|
-
|
22
|
-
begin
|
23
|
-
data = JSON.parse(res.body)
|
24
|
-
rescue JSON::GeneratorError
|
25
|
-
raise "Could not parse JSON from result: '#{res.body}'."
|
26
|
-
end
|
27
|
-
|
28
|
-
begin
|
29
|
-
raise "Expected hash to be a certain way: '#{data}'." if data["var"]["0"] != "1" or data["var"]["1"] != "2" or data["var"]["3"]["kasper"] != "5" or data["var"]["3"]["arr"]["0"] != "a" or data["var"]["3"]["arr"]["1"] != "b"
|
30
|
-
rescue => e
|
31
|
-
raise "Error when parsing result: '#{data}'."
|
32
|
-
end
|
33
|
-
|
34
|
-
raise "Expected 'test_special_chars' to be '1%23+-456' but it wasnt: '#{data["test_special_chars"]}'." if data["test_special_chars"] != "1%23+-456"
|
35
|
-
|
36
|
-
res = http.get("hayabusa_cgi_test/threadded_content_test.rhtml")
|
37
|
-
raise "Expected body to be '123456' but it was: '#{res.body}'." if res.body != "123456"
|
38
|
-
|
39
|
-
res = http.get("hayabusa_cgi_test/vars_get_test.rhtml?var[]=1&var[]=2&var[]=3&var[3][kasper]=5")
|
40
|
-
data = JSON.parse(res.body)
|
41
|
-
raise "Expected hash to be a certain way: '#{data}'." if data["var"]["0"] != "1" or data["var"]["1"] != "2" or data["var"]["3"]["kasper"] != "5"
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
res = http.get("hayabusa_cgi_test/vars_header_test.rhtml")
|
46
|
-
raise "Expected header 'testheader' to be 'TestValue' but it wasnt: '#{res.header("testheader")}'." if res.header("testheader") != "TestValue"
|
47
|
-
end
|
48
|
-
end
|
49
|
-
end
|
data/spec/custom_urls_spec.rb
DELETED
@@ -1,35 +0,0 @@
|
|
1
|
-
require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
|
2
|
-
|
3
|
-
describe "Hayabusa" do
|
4
|
-
it "should be able to start a sample-server" do
|
5
|
-
require "rubygems"
|
6
|
-
require "hayabusa"
|
7
|
-
require "knjrbfw"
|
8
|
-
require "sqlite3" if RUBY_ENGINE != "jruby"
|
9
|
-
|
10
|
-
db_path = "#{Knj::Os.tmpdir}/hayabusa_rspec.sqlite3"
|
11
|
-
File.unlink(db_path) if File.exists?(db_path)
|
12
|
-
|
13
|
-
db = Knj::Db.new(
|
14
|
-
:type => "sqlite3",
|
15
|
-
:path => db_path,
|
16
|
-
:return_keys => "symbols"
|
17
|
-
)
|
18
|
-
|
19
|
-
$appserver = Hayabusa.new(
|
20
|
-
:debug => false,
|
21
|
-
:title => "SpecTestCustomUrls",
|
22
|
-
:port => 1515,
|
23
|
-
:doc_root => "#{File.dirname(__FILE__)}/../lib/pages",
|
24
|
-
:locales_gettext_funcs => true,
|
25
|
-
:locale_default => "da_DK",
|
26
|
-
:db => db
|
27
|
-
)
|
28
|
-
|
29
|
-
$appserver.start
|
30
|
-
end
|
31
|
-
|
32
|
-
it "should be able to stop." do
|
33
|
-
$appserver.stop
|
34
|
-
end
|
35
|
-
end
|
data/spec/fcgi_spec.rb
DELETED
@@ -1,71 +0,0 @@
|
|
1
|
-
require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
|
2
|
-
|
3
|
-
describe "Hayabusa" do
|
4
|
-
it "should be able to start a sample-server" do
|
5
|
-
require "rubygems"
|
6
|
-
require "http2"
|
7
|
-
require "json"
|
8
|
-
|
9
|
-
ts = []
|
10
|
-
es = []
|
11
|
-
|
12
|
-
#Execute multiple threads to test FCGI-proxy and thread-safety.
|
13
|
-
1.upto(5) do
|
14
|
-
ts << Thread.new do
|
15
|
-
begin
|
16
|
-
Http2.new(:host => "localhost") do |http|
|
17
|
-
res = http.post(:url => "hayabusa_fcgi_test/vars_post_test.rhtml", :post => {
|
18
|
-
"test_special_chars" => "1%23+-456",
|
19
|
-
"var" => {
|
20
|
-
0 => 1,
|
21
|
-
1 => 2,
|
22
|
-
3 => {
|
23
|
-
"kasper" => 5,
|
24
|
-
"arr" => ["a", "b", "c"]
|
25
|
-
}
|
26
|
-
}
|
27
|
-
})
|
28
|
-
|
29
|
-
begin
|
30
|
-
data = JSON.parse(res.body)
|
31
|
-
rescue JSON::GeneratorError
|
32
|
-
raise "Could not parse JSON from result: '#{res.body}'."
|
33
|
-
end
|
34
|
-
|
35
|
-
begin
|
36
|
-
raise "Expected hash to be a certain way: '#{data}'." if data["var"]["0"] != "1" or data["var"]["1"] != "2" or data["var"]["3"]["kasper"] != "5" or data["var"]["3"]["arr"]["0"] != "a" or data["var"]["3"]["arr"]["1"] != "b"
|
37
|
-
rescue => e
|
38
|
-
raise "Error when parsing result: '#{data}'."
|
39
|
-
end
|
40
|
-
|
41
|
-
raise "Expected 'test_special_chars' to be '1%23+-456' but it wasnt: '#{data["test_special_chars"]}'." if data["test_special_chars"] != "1%23+-456"
|
42
|
-
|
43
|
-
res = http.get("hayabusa_fcgi_test/threadded_content_test.rhtml")
|
44
|
-
raise "Expected body to be '123456' but it was: '#{res.body}'." if res.body != "123456"
|
45
|
-
|
46
|
-
res = http.get("hayabusa_fcgi_test/vars_get_test.rhtml?var[]=1&var[]=2&var[]=3&var[3][kasper]=5")
|
47
|
-
data = JSON.parse(res.body)
|
48
|
-
raise "Expected hash to be a certain way: '#{data}'." if data["var"]["0"] != "1" or data["var"]["1"] != "2" or data["var"]["3"]["kasper"] != "5"
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
res = http.get("hayabusa_fcgi_test/vars_header_test.rhtml")
|
53
|
-
raise "Expected header 'testheader' to be 'TestValue' but it wasnt: '#{res.header("testheader")}'." if res.header("testheader") != "TestValue"
|
54
|
-
end
|
55
|
-
rescue => e
|
56
|
-
es << e
|
57
|
-
puts e.inspect
|
58
|
-
puts e.backtrace
|
59
|
-
end
|
60
|
-
end
|
61
|
-
end
|
62
|
-
|
63
|
-
ts.each do |t|
|
64
|
-
t.join
|
65
|
-
end
|
66
|
-
|
67
|
-
es.each do |e|
|
68
|
-
raise e
|
69
|
-
end
|
70
|
-
end
|
71
|
-
end
|
data/tests/fcgi_test/index.rhtml
DELETED
@@ -1,23 +0,0 @@
|
|
1
|
-
<%
|
2
|
-
print "1"
|
3
|
-
|
4
|
-
_hb.threadded_content do
|
5
|
-
print "2"
|
6
|
-
sleep 0.5
|
7
|
-
end
|
8
|
-
|
9
|
-
print "3"
|
10
|
-
|
11
|
-
_hb.threadded_content do
|
12
|
-
print "4"
|
13
|
-
|
14
|
-
_hb.threadded_content do
|
15
|
-
print "5"
|
16
|
-
sleep 0.2
|
17
|
-
end
|
18
|
-
|
19
|
-
sleep 0.3
|
20
|
-
end
|
21
|
-
|
22
|
-
print "6"
|
23
|
-
%>
|