hayabusa 0.0.29 → 0.0.30

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 60e88035481dc2afdc4ee23c24f2c44a1b504890c62b1e228b2e813f9d3b15a7
4
- data.tar.gz: ff6b3e9c203f94ce49c7e1cc431b3c89a09410ee8a0f2c45a7eb2ac41964fe4c
3
+ metadata.gz: 7470e0f4114b3ebfde5c0835a3fdf5e215e3fb1e56673fe2ee3ad928ecbbe322
4
+ data.tar.gz: 58fb40764ab163d4e5dff4316bbe1e6bcdb1e23654030b52b96dc2f3c0ae9e6b
5
5
  SHA512:
6
- metadata.gz: e5205de4cf85d3a269e393d972a18e430afeb6c201e441ccd4e95589d5eeb2eac12e8b1cdeeed5f298657eb9aaf9314e13d0244a3aca5de0e8ac941e771513aa
7
- data.tar.gz: 83addfb1405a664473579b8f9abbea6b7e4e3d4bc101bda50acc35a193298be340cd8a324964f8f2d4a59dff1a39148f1a81f9fb74b7c22e11fb837a06c39a73
6
+ metadata.gz: 2dbf3369957abd438053ee92429646a03bc6377823586482ff594905596c6762f0948209bbd08319583b01a8e82200d0433e548219a412dfab87378329508290
7
+ data.tar.gz: 84ad8ab3f40cde0a2572f028875f29943a8af3c9b628f44e4987d69eac4424fa4cf131d64f99d3999e12b156652313b5478f14b2b12688cdfd87213cb1298c13
File without changes
@@ -0,0 +1,14 @@
1
+ <%
2
+ 0.upto(100) do
3
+ print "Test 1<br />\n"
4
+ print "Test 2<br />\n"
5
+ print "Test 3<br />\n"
6
+ print "Test 4<br />\n"
7
+ print "Test 5<br />\n"
8
+ print "Test 6<br />\n"
9
+ print "Test 7<br />\n"
10
+ print "Test 8<br />\n"
11
+ print "Test 9<br />\n"
12
+ print "Test 10<br />\n"
13
+ end
14
+ %>
@@ -0,0 +1,3 @@
1
+ <%
2
+ Php4r.print_r([_get, _post, _meta])
3
+ %>
@@ -0,0 +1,21 @@
1
+ <%
2
+ print "1"
3
+
4
+ _hb.threadded_content do
5
+ sleep 0.1
6
+ print "2"
7
+ end
8
+
9
+ _hb.threadded_content do
10
+ print "3"
11
+ end
12
+
13
+ print "4"
14
+
15
+ _hb.threadded_content do
16
+ sleep 0.1
17
+ print "5"
18
+ end
19
+
20
+ print "6"
21
+ %>
@@ -0,0 +1,22 @@
1
+ require "rubygems"
2
+ require "rmagick"
3
+
4
+ Hayabusa::CGI_CONF = {
5
+ :hayabusa => {
6
+ :title => "Cgi_test",
7
+ :doc_root => File.realpath(File.dirname(__FILE__)),
8
+ :handlers_extra => [{
9
+ :regex => /^\/Kasper$/,
10
+ :callback => proc{|data|
11
+ data[:httpsession].page_path = nil
12
+
13
+ eruby = data[:httpsession].eruby
14
+ eruby.connect(:on_error) do |e|
15
+ _hb.handle_error(e)
16
+ end
17
+
18
+ eruby.import("#{File.dirname(__FILE__)}/../pages/spec.rhtml")
19
+ }
20
+ }]
21
+ }
22
+ }
@@ -0,0 +1,22 @@
1
+ require "rubygems"
2
+ require "rmagick"
3
+
4
+ Hayabusa::FCGI_CONF = {
5
+ :hayabusa => {
6
+ :title => "Fcgi_test",
7
+ :doc_root => File.realpath(File.dirname(__FILE__)),
8
+ :handlers_extra => [{
9
+ :regex => /^\/Kasper$/,
10
+ :callback => proc{|data|
11
+ data[:httpsession].page_path = nil
12
+
13
+ eruby = data[:httpsession].eruby
14
+ eruby.connect(:on_error) do |e|
15
+ _hb.handle_error(e)
16
+ end
17
+
18
+ eruby.import("#{File.dirname(__FILE__)}/../pages/spec.rhtml")
19
+ }
20
+ }]
21
+ }
22
+ }
@@ -0,0 +1,46 @@
1
+ <h1>Database connections</h1>
2
+
3
+ <table>
4
+ <thead>
5
+ <tr>
6
+ <th>Key</th>
7
+ <th>Free</th>
8
+ </tr>
9
+ </thead>
10
+ <tbody>
11
+ <%
12
+ thread_handler = _hb.db_handler.conns
13
+ if !thread_handler.is_a?(Knj::Threadhandler)
14
+ print "A threadhandler has not been spawned for this instance."
15
+ exit
16
+ end
17
+
18
+ objects = thread_handler.objects.clone
19
+
20
+ objects.each_index do |key|
21
+ val = objects[key]
22
+
23
+ %>
24
+ <tr>
25
+ <td>
26
+ <%=key%>
27
+ </td>
28
+ <td>
29
+ <%=Knj::Strings.yn_str(val[:free])%>
30
+ </td>
31
+ </tr>
32
+ <%
33
+ end
34
+
35
+ if objects.empty?
36
+ %>
37
+ <tr>
38
+ <td colspan="2">
39
+ Thread handler was spawned but no active connections was spawned?
40
+ </td>
41
+ </tr>
42
+ <%
43
+ end
44
+ %>
45
+ </tbody>
46
+ </table>
@@ -0,0 +1,40 @@
1
+ <h1>HTTP sessions</h1>
2
+
3
+ <table>
4
+ <thead>
5
+ <tr>
6
+ <th>Key</th>
7
+ <th>Working</th>
8
+ </tr>
9
+ </thead>
10
+ <tbody>
11
+ <%
12
+ sessions = _hb.httpserv.http_sessions.clone
13
+
14
+ sessions.each_index do |key|
15
+ http_session = sessions[key]
16
+
17
+ %>
18
+ <tr>
19
+ <td>
20
+ <%=key%>
21
+ </td>
22
+ <td>
23
+ <%=Knj::Strings.yn_str(http_session.working)%>
24
+ </td>
25
+ </tr>
26
+ <%
27
+ end
28
+
29
+ if sessions.empty?
30
+ %>
31
+ <tr>
32
+ <td colspan="2">
33
+ No HTTP-sessions has been spawned.
34
+ </td>
35
+ </tr>
36
+ <%
37
+ end
38
+ %>
39
+ </tbody>
40
+ </table>
@@ -0,0 +1,39 @@
1
+ <%
2
+ if _get["choice"] == "dogarbagecollect"
3
+ _hb.clean
4
+ GC.start
5
+
6
+ #Clean all Knj::Objects used in the application.
7
+ ObjectSpace.each_object(Knj::Objects) do |objects|
8
+ objects.clean_all
9
+ end
10
+
11
+ Knj::Web.redirect("?show=debug_memory_usage")
12
+ end
13
+ %>
14
+
15
+ <h1>Memory usage</h1>
16
+
17
+ <div style="padding-bottom: 15px;">
18
+ <input type="button" value="Garbage collect" onclick="location.href='?show=debug_memory_usage&amp;choice=dogarbagecollect';" />
19
+ </div>
20
+
21
+ <h1>Hayabusa sessions</h1>
22
+ <table style="width: 600px;">
23
+ <tbody>
24
+ <tr>
25
+ <td>Active sessions</td>
26
+ <td><%=_hb.num(_hb.sessions.length, 0)%></td>
27
+ </tr>
28
+ <tr>
29
+ <td>Total sessions</td>
30
+ <td><%=_hb.num(_hb.ob.list(:Session, "count" => true), 0)%>
31
+ </tr>
32
+ </tbody>
33
+ </table>
34
+
35
+ <br />
36
+
37
+ <%
38
+ Knj::Memory_analyzer.new.write
39
+ %>
@@ -0,0 +1,12 @@
1
+ <%
2
+ _httpsession.resp.status = 404
3
+ %>
4
+ <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
5
+ <html><head>
6
+ <title>404 Not Found</title>
7
+ </head><body>
8
+ <h1>Not Found</h1>
9
+ <p>The requested URL <%=_meta["REQUEST_URI"]%> was not found on this server.</p>
10
+ <hr>
11
+ <address>Hayabusa at <%=_meta["HTTP_HOST"]%></address>
12
+ </body></html>
data/pages/image.png ADDED
Binary file
@@ -0,0 +1,57 @@
1
+ <%
2
+ access = _hb.events.call(:check_page_access, {:page => :logs_latest})
3
+ if !access
4
+ print _("You do not have access to this page.")
5
+ exit
6
+ end
7
+
8
+ ob = _hb.events.call(:ob)
9
+ %>
10
+
11
+ <table class="list">
12
+ <thead>
13
+ <tr>
14
+ <th><%=_("ID")%></th>
15
+ <th><%=_("Log")%></th>
16
+ <%if ob%>
17
+ <th><%=_("Object")%></th>
18
+ <%end%>
19
+ </tr>
20
+ </thead>
21
+ <tbody>
22
+ <%
23
+ logs = _hb.ob.list(:Log, {
24
+ "orderby" => [["date_saved", "desc"]],
25
+ "limit" => 200
26
+ })
27
+
28
+ logs.each do |log|
29
+ %>
30
+ <tr>
31
+ <td>
32
+ <a href="logs_show.rhtml?log_id=<%=log.id%>"><%=log.id%></a>
33
+ </td>
34
+ <td>
35
+ <%=log.first_line%>
36
+ </td>
37
+ <%if ob%>
38
+ <td>
39
+ <%=log.objects_html(ob)%>
40
+ </td>
41
+ <%end%>
42
+ </tr>
43
+ <%
44
+ end
45
+
46
+ if logs.empty?
47
+ %>
48
+ <tr>
49
+ <td class="error">
50
+ <%=_("No logs were found.")%>
51
+ </td>
52
+ </tr>
53
+ <%
54
+ end
55
+ %>
56
+ </tbody>
57
+ </table>
@@ -0,0 +1,32 @@
1
+ <%
2
+ access = _hb.events.call(:check_page_access, {:page => :logs_show})
3
+ if !access
4
+ print _("You do not have access to this page.")
5
+ exit
6
+ end
7
+
8
+ ob = _hb.events.call(:ob)
9
+ log = _hb.ob.get(:Log, _get["log_id"])
10
+ %>
11
+
12
+ <table class="form">
13
+ <%
14
+ print Knj::Web.inputs([{
15
+ :title => _("Date"),
16
+ :type => :info,
17
+ :value => Datet.in(log[:date_saved]).out
18
+ }])
19
+
20
+ if ob
21
+ print Knj::Web.input(
22
+ :title => _("Objects"),
23
+ :type => :info,
24
+ :value => log.objects_html(ob)
25
+ )
26
+ end
27
+ %>
28
+ </table>
29
+
30
+ <div style="padding-top: 10px;">
31
+ <%=log.text%>
32
+ </div>
data/pages/spec.rhtml ADDED
@@ -0,0 +1,41 @@
1
+ <%
2
+ require "json"
3
+
4
+ if _get["choice"] == "test_cookie"
5
+ _hb.cookie(
6
+ "name" => "TestCookie",
7
+ "value" => "TestValue",
8
+ "expires" => Time.new + 3600 #add an hour
9
+ )
10
+ _hb.cookie(
11
+ "name" => "TestCookie2",
12
+ "value" => "TestValue2",
13
+ "expires" => Time.new + 7200 #add an hour
14
+ )
15
+ _hb.cookie(
16
+ "name" => "TestCookie3",
17
+ "value" => "TestValue 3 ",
18
+ "expires" => Time.new + 1200
19
+ )
20
+ exit
21
+ elsif _get["choice"] == "dopostconvert"
22
+ print JSON.generate(_post)
23
+ exit
24
+ end
25
+
26
+ if _get["choice"] == "get_cookies"
27
+ print JSON.generate(_cookie)
28
+ exit
29
+ end
30
+
31
+ _hb.header("TestHeader", "NormalHeader")
32
+ _hb.header_raw("TestRaw: RawHeader")
33
+
34
+ if _meta["REQUEST_METHOD"] == "POST"
35
+ print _post["postdata"]
36
+ elsif _get["choice"] == "check_get_parse"
37
+ print _get["value"]
38
+ else
39
+ print "Test"
40
+ end
41
+ %>
@@ -0,0 +1,5 @@
1
+ <%
2
+ _httpsession.resp.status = 304
3
+ puts "ExitOutput"
4
+ exit
5
+ %>
@@ -0,0 +1,18 @@
1
+ <%
2
+ require "json"
3
+
4
+ if !_session.key?(:request_count)
5
+ _session[:request_count] = 1
6
+ else
7
+ _session[:request_count] = _session[:request_count].to_i + 1
8
+ end
9
+
10
+ print JSON.generate(
11
+ :pid => Process.pid,
12
+ :session_id => _session_obj.id,
13
+ :session_hash_id => _session.__id__,
14
+ :request_count => _session[:request_count],
15
+ :cookie => _cookie,
16
+ :meta => _meta
17
+ )
18
+ %>
@@ -0,0 +1,4 @@
1
+ <%
2
+ sleep 0.7
3
+ print Process.pid
4
+ %>
@@ -0,0 +1,3 @@
1
+ <%
2
+
3
+ %>
@@ -0,0 +1,29 @@
1
+ <%
2
+ #Knj.p _hb.config
3
+ #exit
4
+
5
+ print "1"
6
+
7
+ cont = "2"
8
+ t1 = _hb.thread(:id => 4) do
9
+ sleep 0.5
10
+ cont << "4"
11
+ end
12
+
13
+ t2 = _hb.thread(:id => 3) do
14
+ sleep 0.3
15
+ cont << "3"
16
+ end
17
+
18
+ sleep 0.1
19
+
20
+ raise "Expected thread 1 to be running but it wasnt." if !t1.running?
21
+ raise "Expected thread 2 to be running but it wasnt." if !t2.running?
22
+
23
+ t1.join
24
+ t2.join_error
25
+
26
+ cont << "5"
27
+
28
+ print cont
29
+ %>
@@ -0,0 +1,40 @@
1
+ <%
2
+ _hb.threadded_content do
3
+ sleep 0.2
4
+ print "1"
5
+ end
6
+
7
+ print "2"
8
+
9
+ _hb.threadded_content do
10
+ sleep 0.1
11
+
12
+ _hb.threadded_content do
13
+ sleep 0.1
14
+ print "3"
15
+
16
+ sleep 0.1
17
+
18
+ _hb.threadded_content do
19
+ print "4"
20
+ sleep 0.1
21
+ print "5"
22
+ end
23
+
24
+ _hb.threadded_content do
25
+ print "6"
26
+ print "7"
27
+ end
28
+ end
29
+
30
+ print "8"
31
+ end
32
+
33
+ #This will first finish after the printing has starter - it should still be printed correct.
34
+ _hb.threadded_content do
35
+ sleep 1
36
+ print "9"
37
+ end
38
+
39
+ print "10"
40
+ %>
@@ -0,0 +1,4 @@
1
+ <%
2
+ require "json"
3
+ print JSON.generate(_get)
4
+ %>
@@ -0,0 +1,3 @@
1
+ <%
2
+ _hb.header("TestHeader", "TestValue")
3
+ %>
@@ -0,0 +1,4 @@
1
+ <%
2
+ require "json"
3
+ print JSON.generate(_post)
4
+ %>
@@ -0,0 +1,19 @@
1
+ <%
2
+ pdata = {}
3
+ _post.each do |key, val|
4
+ data = {
5
+ "class" => val.class.name
6
+ }
7
+
8
+ if val.is_a?(Hayabusa::Http_session::Post_multipart::File_upload)
9
+ data["val"] = val.to_s
10
+ else
11
+ data["val"] = val
12
+ end
13
+
14
+ pdata[key] = data
15
+ end
16
+
17
+ require "json"
18
+ print Marshal.dump(pdata)
19
+ %>
Binary file
data/pages/tests.rhtml ADDED
@@ -0,0 +1,14 @@
1
+ <%
2
+ print "Test 1: #{_testvar1}<br />\n"
3
+ print "Test 2: #{_testvar2}<br />\n"
4
+ %>
5
+
6
+ <table style="width: 1000px;">
7
+ <%
8
+ print Knj::Web.inputs([{
9
+ :title => "FCKEditor test",
10
+ :type => :fckeditor,
11
+ :name => :textest
12
+ }])
13
+ %>
14
+ </table>
@@ -0,0 +1,23 @@
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
+ %>
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: hayabusa
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.29
4
+ version: 0.0.30
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kasper Stöckel
@@ -344,6 +344,33 @@ files:
344
344
  - lib/models/log_data_value.rb
345
345
  - lib/models/log_link.rb
346
346
  - lib/models/session.rb
347
+ - pages/benchmark.rhtml
348
+ - pages/benchmark_print.rhtml
349
+ - pages/benchmark_simple.rhtml
350
+ - pages/benchmark_threadded_content.rhtml
351
+ - pages/config_cgi.rb
352
+ - pages/config_fcgi.rb
353
+ - pages/debug_database_connections.rhtml
354
+ - pages/debug_http_sessions.rhtml
355
+ - pages/debug_memory_usage.rhtml
356
+ - pages/error_notfound.rhtml
357
+ - pages/image.png
358
+ - pages/logs_latest.rhtml
359
+ - pages/logs_show.rhtml
360
+ - pages/spec.rhtml
361
+ - pages/spec_exit.rhtml
362
+ - pages/spec_multiple_threads.rhtml
363
+ - pages/spec_sleeper.rhtml
364
+ - pages/spec_test_multiple_clients.rhtml
365
+ - pages/spec_thread_joins.rhtml
366
+ - pages/spec_threadded_content.rhtml
367
+ - pages/spec_vars_get.rhtml
368
+ - pages/spec_vars_header.rhtml
369
+ - pages/spec_vars_post.rhtml
370
+ - pages/spec_vars_post_fileupload.rhtml
371
+ - pages/testpic.jpeg
372
+ - pages/tests.rhtml
373
+ - pages/threadded_content_test.rhtml
347
374
  homepage: http://github.com/kaspernj/hayabusa
348
375
  licenses:
349
376
  - MIT