httpkit 0.6.0.pre.5 → 0.6.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +8 -8
- data/.gitignore +0 -2
- data/.travis.yml +1 -1
- data/Gemfile +2 -0
- data/README.md +32 -25
- data/Rakefile +5 -0
- data/config/flay.yml +1 -1
- data/doc/api/httpkit.html +50 -0
- data/doc/api/httpkit/body.html +149 -0
- data/doc/api/httpkit/client.html +50 -0
- data/doc/api/httpkit/client/body_handler.html +50 -0
- data/doc/api/httpkit/client/keep_alive_handler.html +79 -0
- data/doc/api/httpkit/client/mandatory_handler.html +50 -0
- data/doc/api/httpkit/client/timeouts_handler.html +82 -0
- data/doc/api/httpkit/connection/eventmachine.html +157 -0
- data/doc/api/httpkit/connection/status.html +50 -0
- data/doc/api/httpkit/promise.html +50 -0
- data/doc/api/httpkit/request.html +123 -0
- data/doc/api/httpkit/response.html +209 -0
- data/doc/api/httpkit/serializer.html +150 -0
- data/doc/api/httpkit/server.html +50 -0
- data/doc/api/httpkit/server/block_handler.html +50 -0
- data/doc/api/httpkit/server/body_handler.html +50 -0
- data/doc/api/httpkit/server/keep_alive_handler.html +145 -0
- data/doc/api/httpkit/server/mandatory_handler.html +50 -0
- data/doc/api/httpkit/server/timeouts_handler.html +81 -0
- data/doc/api/httpkit/support/handler_manager.html +95 -0
- data/doc/api/httpkit/support/message.html +50 -0
- data/doc/api/httpkit/version.html +50 -0
- data/doc/examples/echo_server.html +101 -0
- data/doc/examples/error_handling.html +176 -0
- data/doc/examples/getting_started.html +161 -0
- data/doc/examples/streaming.html +108 -0
- data/doc/index.html +165 -0
- data/examples/echo_server.rb +14 -6
- data/examples/error_handling.rb +56 -0
- data/examples/getting_started.rb +10 -18
- data/examples/streaming.rb +41 -0
- data/lib/httpkit.rb +22 -0
- data/lib/httpkit/body.rb +4 -0
- data/lib/httpkit/client.rb +1 -9
- data/lib/httpkit/client/keep_alive_handler.rb +1 -0
- data/lib/httpkit/connection/eventmachine.rb +2 -1
- data/lib/httpkit/server/block_handler.rb +13 -0
- data/lib/httpkit/server/keep_alive_handler.rb +1 -0
- data/lib/httpkit/version.rb +1 -1
- data/spec/integration/timeouts_spec.rb +3 -2
- data/spec/support/helper.rb +1 -8
- data/spec/unit/client_spec.rb +2 -21
- data/spec/unit/server_spec.rb +11 -1
- metadata +34 -5
- data/Procfile +0 -1
@@ -0,0 +1,79 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
<html>
|
3
|
+
<head>
|
4
|
+
<meta http-equiv="content-type" content="text/html;charset=utf-8">
|
5
|
+
<title>keep_alive_handler.rb</title>
|
6
|
+
<link rel="stylesheet" href="http://jashkenas.github.io/docco/resources/linear/docco.css">
|
7
|
+
</head>
|
8
|
+
<body>
|
9
|
+
<div id='container'>
|
10
|
+
<div id="background"></div>
|
11
|
+
<div id="jump_to">
|
12
|
+
Jump To …
|
13
|
+
<div id="jump_wrapper">
|
14
|
+
<div id="jump_page">
|
15
|
+
<a class="source" href="../../httpkit.html">httpkit.rb</a>
|
16
|
+
<a class="source" href="../body.html">body.rb</a>
|
17
|
+
<a class="source" href="../client.html">client.rb</a>
|
18
|
+
<a class="source" href="body_handler.html">body_handler.rb</a>
|
19
|
+
<a class="source" href="keep_alive_handler.html">keep_alive_handler.rb</a>
|
20
|
+
<a class="source" href="mandatory_handler.html">mandatory_handler.rb</a>
|
21
|
+
<a class="source" href="timeouts_handler.html">timeouts_handler.rb</a>
|
22
|
+
<a class="source" href="../connection/eventmachine.html">eventmachine.rb</a>
|
23
|
+
<a class="source" href="../connection/status.html">status.rb</a>
|
24
|
+
<a class="source" href="../promise.html">promise.rb</a>
|
25
|
+
<a class="source" href="../request.html">request.rb</a>
|
26
|
+
<a class="source" href="../response.html">response.rb</a>
|
27
|
+
<a class="source" href="../serializer.html">serializer.rb</a>
|
28
|
+
<a class="source" href="../server.html">server.rb</a>
|
29
|
+
<a class="source" href="../server/block_handler.html">block_handler.rb</a>
|
30
|
+
<a class="source" href="../server/body_handler.html">body_handler.rb</a>
|
31
|
+
<a class="source" href="../server/keep_alive_handler.html">keep_alive_handler.rb</a>
|
32
|
+
<a class="source" href="../server/mandatory_handler.html">mandatory_handler.rb</a>
|
33
|
+
<a class="source" href="../server/timeouts_handler.html">timeouts_handler.rb</a>
|
34
|
+
<a class="source" href="../support/handler_manager.html">handler_manager.rb</a>
|
35
|
+
<a class="source" href="../support/message.html">message.rb</a>
|
36
|
+
<a class="source" href="../version.html">version.rb</a>
|
37
|
+
</div>
|
38
|
+
</div>
|
39
|
+
</div>
|
40
|
+
<table cellspacing=0 cellpadding=0>
|
41
|
+
<thead>
|
42
|
+
<tr>
|
43
|
+
<th class=docs><h1>keep_alive_handler.rb</h1></th>
|
44
|
+
<th class=code></th>
|
45
|
+
</tr>
|
46
|
+
</thead>
|
47
|
+
<tbody>
|
48
|
+
<tr id='section-1'>
|
49
|
+
<td class=docs>
|
50
|
+
<div class="pilwrap">
|
51
|
+
<a class="pilcrow" href="#section-1">¶</a>
|
52
|
+
</div>
|
53
|
+
|
54
|
+
</td>
|
55
|
+
<td class=code>
|
56
|
+
<div class='highlight'><pre><span class="k">module</span> <span class="nn">HTTPkit</span>
|
57
|
+
<span class="k">class</span> <span class="nc">Client</span><span class="o">::</span><span class="no">KeepAliveHandler</span>
|
58
|
+
<span class="k">def</span> <span class="nf">perform</span><span class="p">(</span><span class="n">request</span><span class="p">)</span>
|
59
|
+
<span class="vi">@previous</span><span class="p">,</span> <span class="n">previous</span> <span class="o">=</span> <span class="n">request</span><span class="p">,</span> <span class="vi">@previous</span></pre></div>
|
60
|
+
</td>
|
61
|
+
</tr>
|
62
|
+
<tr id='section-2'>
|
63
|
+
<td class=docs>
|
64
|
+
<div class="pilwrap">
|
65
|
+
<a class="pilcrow" href="#section-2">¶</a>
|
66
|
+
</div>
|
67
|
+
<p>TODO: move to Serializer</p>
|
68
|
+
|
69
|
+
</td>
|
70
|
+
<td class=code>
|
71
|
+
<div class='highlight'><pre> <span class="n">previous</span><span class="o">.</span><span class="n">closed!</span> <span class="k">if</span> <span class="n">previous</span>
|
72
|
+
<span class="k">end</span>
|
73
|
+
<span class="k">end</span>
|
74
|
+
<span class="k">end</span></pre></div>
|
75
|
+
</td>
|
76
|
+
</tr>
|
77
|
+
</table>
|
78
|
+
</div>
|
79
|
+
</body>
|
@@ -0,0 +1,50 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
<html>
|
3
|
+
<head>
|
4
|
+
<meta http-equiv="content-type" content="text/html;charset=utf-8">
|
5
|
+
<title>mandatory_handler.rb</title>
|
6
|
+
<link rel="stylesheet" href="http://jashkenas.github.io/docco/resources/linear/docco.css">
|
7
|
+
</head>
|
8
|
+
<body>
|
9
|
+
<div id='container'>
|
10
|
+
<div id="background"></div>
|
11
|
+
<div id="jump_to">
|
12
|
+
Jump To …
|
13
|
+
<div id="jump_wrapper">
|
14
|
+
<div id="jump_page">
|
15
|
+
<a class="source" href="../../httpkit.html">httpkit.rb</a>
|
16
|
+
<a class="source" href="../body.html">body.rb</a>
|
17
|
+
<a class="source" href="../client.html">client.rb</a>
|
18
|
+
<a class="source" href="body_handler.html">body_handler.rb</a>
|
19
|
+
<a class="source" href="keep_alive_handler.html">keep_alive_handler.rb</a>
|
20
|
+
<a class="source" href="mandatory_handler.html">mandatory_handler.rb</a>
|
21
|
+
<a class="source" href="timeouts_handler.html">timeouts_handler.rb</a>
|
22
|
+
<a class="source" href="../connection/eventmachine.html">eventmachine.rb</a>
|
23
|
+
<a class="source" href="../connection/status.html">status.rb</a>
|
24
|
+
<a class="source" href="../promise.html">promise.rb</a>
|
25
|
+
<a class="source" href="../request.html">request.rb</a>
|
26
|
+
<a class="source" href="../response.html">response.rb</a>
|
27
|
+
<a class="source" href="../serializer.html">serializer.rb</a>
|
28
|
+
<a class="source" href="../server.html">server.rb</a>
|
29
|
+
<a class="source" href="../server/block_handler.html">block_handler.rb</a>
|
30
|
+
<a class="source" href="../server/body_handler.html">body_handler.rb</a>
|
31
|
+
<a class="source" href="../server/keep_alive_handler.html">keep_alive_handler.rb</a>
|
32
|
+
<a class="source" href="../server/mandatory_handler.html">mandatory_handler.rb</a>
|
33
|
+
<a class="source" href="../server/timeouts_handler.html">timeouts_handler.rb</a>
|
34
|
+
<a class="source" href="../support/handler_manager.html">handler_manager.rb</a>
|
35
|
+
<a class="source" href="../support/message.html">message.rb</a>
|
36
|
+
<a class="source" href="../version.html">version.rb</a>
|
37
|
+
</div>
|
38
|
+
</div>
|
39
|
+
</div>
|
40
|
+
<table cellspacing=0 cellpadding=0>
|
41
|
+
<thead>
|
42
|
+
<tr>
|
43
|
+
<th class=docs><h1>mandatory_handler.rb</h1></th>
|
44
|
+
<th class=code></th>
|
45
|
+
</tr>
|
46
|
+
</thead>
|
47
|
+
<tbody>
|
48
|
+
</table>
|
49
|
+
</div>
|
50
|
+
</body>
|
@@ -0,0 +1,82 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
<html>
|
3
|
+
<head>
|
4
|
+
<meta http-equiv="content-type" content="text/html;charset=utf-8">
|
5
|
+
<title>timeouts_handler.rb</title>
|
6
|
+
<link rel="stylesheet" href="http://jashkenas.github.io/docco/resources/linear/docco.css">
|
7
|
+
</head>
|
8
|
+
<body>
|
9
|
+
<div id='container'>
|
10
|
+
<div id="background"></div>
|
11
|
+
<div id="jump_to">
|
12
|
+
Jump To …
|
13
|
+
<div id="jump_wrapper">
|
14
|
+
<div id="jump_page">
|
15
|
+
<a class="source" href="../../httpkit.html">httpkit.rb</a>
|
16
|
+
<a class="source" href="../body.html">body.rb</a>
|
17
|
+
<a class="source" href="../client.html">client.rb</a>
|
18
|
+
<a class="source" href="body_handler.html">body_handler.rb</a>
|
19
|
+
<a class="source" href="keep_alive_handler.html">keep_alive_handler.rb</a>
|
20
|
+
<a class="source" href="mandatory_handler.html">mandatory_handler.rb</a>
|
21
|
+
<a class="source" href="timeouts_handler.html">timeouts_handler.rb</a>
|
22
|
+
<a class="source" href="../connection/eventmachine.html">eventmachine.rb</a>
|
23
|
+
<a class="source" href="../connection/status.html">status.rb</a>
|
24
|
+
<a class="source" href="../promise.html">promise.rb</a>
|
25
|
+
<a class="source" href="../request.html">request.rb</a>
|
26
|
+
<a class="source" href="../response.html">response.rb</a>
|
27
|
+
<a class="source" href="../serializer.html">serializer.rb</a>
|
28
|
+
<a class="source" href="../server.html">server.rb</a>
|
29
|
+
<a class="source" href="../server/block_handler.html">block_handler.rb</a>
|
30
|
+
<a class="source" href="../server/body_handler.html">body_handler.rb</a>
|
31
|
+
<a class="source" href="../server/keep_alive_handler.html">keep_alive_handler.rb</a>
|
32
|
+
<a class="source" href="../server/mandatory_handler.html">mandatory_handler.rb</a>
|
33
|
+
<a class="source" href="../server/timeouts_handler.html">timeouts_handler.rb</a>
|
34
|
+
<a class="source" href="../support/handler_manager.html">handler_manager.rb</a>
|
35
|
+
<a class="source" href="../support/message.html">message.rb</a>
|
36
|
+
<a class="source" href="../version.html">version.rb</a>
|
37
|
+
</div>
|
38
|
+
</div>
|
39
|
+
</div>
|
40
|
+
<table cellspacing=0 cellpadding=0>
|
41
|
+
<thead>
|
42
|
+
<tr>
|
43
|
+
<th class=docs><h1>timeouts_handler.rb</h1></th>
|
44
|
+
<th class=code></th>
|
45
|
+
</tr>
|
46
|
+
</thead>
|
47
|
+
<tbody>
|
48
|
+
<tr id='section-1'>
|
49
|
+
<td class=docs>
|
50
|
+
<div class="pilwrap">
|
51
|
+
<a class="pilcrow" href="#section-1">¶</a>
|
52
|
+
</div>
|
53
|
+
|
54
|
+
</td>
|
55
|
+
<td class=code>
|
56
|
+
<div class='highlight'><pre><span class="k">module</span> <span class="nn">HTTPkit</span></pre></div>
|
57
|
+
</td>
|
58
|
+
</tr>
|
59
|
+
<tr id='section-2'>
|
60
|
+
<td class=docs>
|
61
|
+
<div class="pilwrap">
|
62
|
+
<a class="pilcrow" href="#section-2">¶</a>
|
63
|
+
</div>
|
64
|
+
<p>@see EM.heartbeat_interval</p>
|
65
|
+
|
66
|
+
</td>
|
67
|
+
<td class=code>
|
68
|
+
<div class='highlight'><pre> <span class="k">class</span> <span class="nc">Client</span><span class="o">::</span><span class="no">TimeoutsHandler</span>
|
69
|
+
<span class="k">def</span> <span class="nf">setup</span><span class="p">(</span><span class="n">config</span><span class="p">,</span> <span class="n">_</span><span class="p">,</span> <span class="n">connection</span><span class="p">)</span>
|
70
|
+
<span class="vi">@config</span> <span class="o">=</span> <span class="n">config</span>
|
71
|
+
<span class="vi">@connection</span> <span class="o">=</span> <span class="n">connection</span>
|
72
|
+
|
73
|
+
<span class="vi">@connection</span><span class="o">.</span><span class="n">comm_inactivity_timeout</span> <span class="o">=</span> <span class="vi">@config</span><span class="o">[</span><span class="ss">:timeout</span><span class="o">]</span> <span class="o">||=</span> <span class="mi">2</span><span class="o">.</span><span class="mi">0</span>
|
74
|
+
<span class="vi">@connection</span><span class="o">.</span><span class="n">pending_connect_timeout</span> <span class="o">=</span> <span class="vi">@config</span><span class="o">[</span><span class="ss">:connect_timeout</span><span class="o">]</span> <span class="o">||=</span> <span class="mi">2</span><span class="o">.</span><span class="mi">0</span>
|
75
|
+
<span class="k">end</span>
|
76
|
+
<span class="k">end</span>
|
77
|
+
<span class="k">end</span></pre></div>
|
78
|
+
</td>
|
79
|
+
</tr>
|
80
|
+
</table>
|
81
|
+
</div>
|
82
|
+
</body>
|
@@ -0,0 +1,157 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
<html>
|
3
|
+
<head>
|
4
|
+
<meta http-equiv="content-type" content="text/html;charset=utf-8">
|
5
|
+
<title>eventmachine.rb</title>
|
6
|
+
<link rel="stylesheet" href="http://jashkenas.github.io/docco/resources/linear/docco.css">
|
7
|
+
</head>
|
8
|
+
<body>
|
9
|
+
<div id='container'>
|
10
|
+
<div id="background"></div>
|
11
|
+
<div id="jump_to">
|
12
|
+
Jump To …
|
13
|
+
<div id="jump_wrapper">
|
14
|
+
<div id="jump_page">
|
15
|
+
<a class="source" href="../../httpkit.html">httpkit.rb</a>
|
16
|
+
<a class="source" href="../body.html">body.rb</a>
|
17
|
+
<a class="source" href="../client.html">client.rb</a>
|
18
|
+
<a class="source" href="../client/body_handler.html">body_handler.rb</a>
|
19
|
+
<a class="source" href="../client/keep_alive_handler.html">keep_alive_handler.rb</a>
|
20
|
+
<a class="source" href="../client/mandatory_handler.html">mandatory_handler.rb</a>
|
21
|
+
<a class="source" href="../client/timeouts_handler.html">timeouts_handler.rb</a>
|
22
|
+
<a class="source" href="eventmachine.html">eventmachine.rb</a>
|
23
|
+
<a class="source" href="status.html">status.rb</a>
|
24
|
+
<a class="source" href="../promise.html">promise.rb</a>
|
25
|
+
<a class="source" href="../request.html">request.rb</a>
|
26
|
+
<a class="source" href="../response.html">response.rb</a>
|
27
|
+
<a class="source" href="../serializer.html">serializer.rb</a>
|
28
|
+
<a class="source" href="../server.html">server.rb</a>
|
29
|
+
<a class="source" href="../server/block_handler.html">block_handler.rb</a>
|
30
|
+
<a class="source" href="../server/body_handler.html">body_handler.rb</a>
|
31
|
+
<a class="source" href="../server/keep_alive_handler.html">keep_alive_handler.rb</a>
|
32
|
+
<a class="source" href="../server/mandatory_handler.html">mandatory_handler.rb</a>
|
33
|
+
<a class="source" href="../server/timeouts_handler.html">timeouts_handler.rb</a>
|
34
|
+
<a class="source" href="../support/handler_manager.html">handler_manager.rb</a>
|
35
|
+
<a class="source" href="../support/message.html">message.rb</a>
|
36
|
+
<a class="source" href="../version.html">version.rb</a>
|
37
|
+
</div>
|
38
|
+
</div>
|
39
|
+
</div>
|
40
|
+
<table cellspacing=0 cellpadding=0>
|
41
|
+
<thead>
|
42
|
+
<tr>
|
43
|
+
<th class=docs><h1>eventmachine.rb</h1></th>
|
44
|
+
<th class=code></th>
|
45
|
+
</tr>
|
46
|
+
</thead>
|
47
|
+
<tbody>
|
48
|
+
<tr id='section-1'>
|
49
|
+
<td class=docs>
|
50
|
+
<div class="pilwrap">
|
51
|
+
<a class="pilcrow" href="#section-1">¶</a>
|
52
|
+
</div>
|
53
|
+
|
54
|
+
</td>
|
55
|
+
<td class=code>
|
56
|
+
<div class='highlight'><pre><span class="k">module</span> <span class="nn">HTTPkit</span>
|
57
|
+
<span class="k">module</span> <span class="nn">Connection</span>
|
58
|
+
<span class="k">class</span> <span class="nc">EventMachine</span> <span class="o"><</span> <span class="ss">EM</span><span class="p">:</span><span class="ss">:Connection</span>
|
59
|
+
<span class="k">def</span> <span class="nc">self</span><span class="o">.</span><span class="nf">start_client</span><span class="p">(</span><span class="n">config</span><span class="p">,</span> <span class="n">client_class</span><span class="p">)</span>
|
60
|
+
<span class="n">connection</span> <span class="o">=</span> <span class="no">EM</span><span class="o">.</span><span class="n">connect</span><span class="p">(</span><span class="n">config</span><span class="o">[</span><span class="ss">:address</span><span class="o">]</span><span class="p">,</span> <span class="n">config</span><span class="o">[</span><span class="ss">:port</span><span class="o">]</span><span class="p">,</span> <span class="nb">self</span><span class="p">)</span>
|
61
|
+
<span class="n">client_class</span><span class="o">.</span><span class="n">new</span><span class="p">(</span><span class="n">config</span><span class="p">,</span> <span class="n">connection</span><span class="p">)</span>
|
62
|
+
<span class="k">end</span>
|
63
|
+
|
64
|
+
<span class="k">def</span> <span class="nc">self</span><span class="o">.</span><span class="nf">start_server</span><span class="p">(</span><span class="n">config</span><span class="p">,</span> <span class="n">server_class</span><span class="p">)</span>
|
65
|
+
<span class="no">EM</span><span class="o">.</span><span class="n">start_server</span><span class="p">(</span><span class="n">config</span><span class="o">[</span><span class="ss">:address</span><span class="o">]</span><span class="p">,</span> <span class="n">config</span><span class="o">[</span><span class="ss">:port</span><span class="o">]</span><span class="p">,</span> <span class="nb">self</span><span class="p">,</span>
|
66
|
+
<span class="nb">proc</span> <span class="p">{</span> <span class="o">|</span><span class="n">conn</span><span class="o">|</span> <span class="n">server_class</span><span class="o">.</span><span class="n">new</span><span class="p">(</span><span class="n">config</span><span class="p">,</span> <span class="n">conn</span><span class="p">)</span> <span class="p">})</span>
|
67
|
+
<span class="k">end</span>
|
68
|
+
|
69
|
+
<span class="kp">attr_reader</span> <span class="ss">:closed</span>
|
70
|
+
<span class="kp">attr_writer</span> <span class="ss">:on_message</span>
|
71
|
+
|
72
|
+
<span class="k">def</span> <span class="nf">initialize</span><span class="p">(</span><span class="n">callback</span> <span class="o">=</span> <span class="nb">proc</span> <span class="p">{})</span>
|
73
|
+
<span class="vi">@closed</span> <span class="o">=</span> <span class="no">Promise</span><span class="o">.</span><span class="n">new</span>
|
74
|
+
<span class="vi">@parser</span> <span class="o">=</span> <span class="ss">HTTP</span><span class="p">:</span><span class="ss">:Parser</span><span class="o">.</span><span class="n">new</span><span class="p">(</span><span class="nb">self</span><span class="p">)</span>
|
75
|
+
<span class="n">callback</span><span class="o">.</span><span class="n">call</span><span class="p">(</span><span class="nb">self</span><span class="p">)</span>
|
76
|
+
<span class="k">end</span>
|
77
|
+
|
78
|
+
<span class="k">def</span> <span class="nf">serialize</span><span class="p">(</span><span class="n">message</span><span class="p">)</span>
|
79
|
+
<span class="n">serializer</span> <span class="o">=</span> <span class="no">Serializer</span><span class="o">.</span><span class="n">new</span><span class="p">(</span><span class="n">message</span><span class="p">,</span> <span class="nb">method</span><span class="p">(</span><span class="ss">:send_data</span><span class="p">))</span>
|
80
|
+
<span class="n">serializer</span><span class="o">.</span><span class="n">serialize</span>
|
81
|
+
<span class="k">end</span>
|
82
|
+
|
83
|
+
<span class="k">def</span> <span class="nf">receive_data</span><span class="p">(</span><span class="n">data</span><span class="p">)</span></pre></div>
|
84
|
+
</td>
|
85
|
+
</tr>
|
86
|
+
<tr id='section-2'>
|
87
|
+
<td class=docs>
|
88
|
+
<div class="pilwrap">
|
89
|
+
<a class="pilcrow" href="#section-2">¶</a>
|
90
|
+
</div>
|
91
|
+
<p>p [<strong>id</strong>, :receive, data]
|
92
|
+
p data</p>
|
93
|
+
</td>
|
94
|
+
<td class=code>
|
95
|
+
<div class='highlight'><pre> <span class="vi">@parser</span> <span class="o"><<</span> <span class="n">data</span>
|
96
|
+
<span class="k">rescue</span> <span class="o">=></span> <span class="n">ex</span></pre></div>
|
97
|
+
</td>
|
98
|
+
</tr>
|
99
|
+
<tr id='section-3'>
|
100
|
+
<td class=docs>
|
101
|
+
<div class="pilwrap">
|
102
|
+
<a class="pilcrow" href="#section-3">¶</a>
|
103
|
+
</div>
|
104
|
+
<p>message = ex.message.empty? ? ex.class : ex.message
|
105
|
+
puts [message, *ex.backtrace].join(“\n\t”)</p>
|
106
|
+
</td>
|
107
|
+
<td class=code>
|
108
|
+
<div class='highlight'><pre> <span class="n">close</span><span class="p">(</span><span class="n">ex</span><span class="p">)</span>
|
109
|
+
<span class="k">end</span></pre></div>
|
110
|
+
</td>
|
111
|
+
</tr>
|
112
|
+
<tr id='section-4'>
|
113
|
+
<td class=docs>
|
114
|
+
<div class="pilwrap">
|
115
|
+
<a class="pilcrow" href="#section-4">¶</a>
|
116
|
+
</div>
|
117
|
+
<p>def send_data(data)
|
118
|
+
p [<strong>id</strong>, :send, data]
|
119
|
+
# p data
|
120
|
+
super
|
121
|
+
end</p>
|
122
|
+
|
123
|
+
</td>
|
124
|
+
<td class=code>
|
125
|
+
<div class='highlight'><pre> <span class="k">def</span> <span class="nf">close</span><span class="p">(</span><span class="n">reason</span> <span class="o">=</span> <span class="kp">nil</span><span class="p">)</span>
|
126
|
+
<span class="n">closed</span><span class="o">.</span><span class="n">reject</span><span class="p">(</span><span class="n">reason</span><span class="p">)</span> <span class="k">if</span> <span class="n">reason</span>
|
127
|
+
<span class="n">close_connection_after_writing</span>
|
128
|
+
<span class="k">end</span>
|
129
|
+
|
130
|
+
<span class="k">def</span> <span class="nf">unbind</span><span class="p">(</span><span class="n">reason</span> <span class="o">=</span> <span class="kp">nil</span><span class="p">)</span>
|
131
|
+
<span class="k">if</span> <span class="n">reason</span>
|
132
|
+
<span class="n">closed</span><span class="o">.</span><span class="n">reject</span><span class="p">(</span><span class="n">reason</span><span class="p">)</span>
|
133
|
+
<span class="k">else</span>
|
134
|
+
<span class="n">closed</span><span class="o">.</span><span class="n">fulfill</span>
|
135
|
+
<span class="k">end</span>
|
136
|
+
<span class="k">end</span>
|
137
|
+
|
138
|
+
<span class="k">def</span> <span class="nf">on_headers_complete</span><span class="p">(</span><span class="n">_</span><span class="p">)</span>
|
139
|
+
<span class="vi">@message</span> <span class="o">=</span> <span class="ss">Support</span><span class="p">:</span><span class="ss">:Message</span><span class="o">.</span><span class="n">build</span><span class="p">(</span><span class="vi">@parser</span><span class="p">)</span>
|
140
|
+
<span class="vi">@on_message</span><span class="o">.</span><span class="n">call</span><span class="p">(</span><span class="vi">@message</span><span class="p">)</span>
|
141
|
+
<span class="k">end</span>
|
142
|
+
|
143
|
+
<span class="k">def</span> <span class="nf">on_body</span><span class="p">(</span><span class="n">chunk</span><span class="p">)</span>
|
144
|
+
<span class="vi">@message</span><span class="o">.</span><span class="n">body</span><span class="o">.</span><span class="n">write</span><span class="p">(</span><span class="n">chunk</span><span class="p">)</span>
|
145
|
+
<span class="k">end</span>
|
146
|
+
|
147
|
+
<span class="k">def</span> <span class="nf">on_message_complete</span>
|
148
|
+
<span class="vi">@message</span><span class="o">.</span><span class="n">close</span>
|
149
|
+
<span class="k">end</span>
|
150
|
+
<span class="k">end</span>
|
151
|
+
<span class="k">end</span>
|
152
|
+
<span class="k">end</span></pre></div>
|
153
|
+
</td>
|
154
|
+
</tr>
|
155
|
+
</table>
|
156
|
+
</div>
|
157
|
+
</body>
|
@@ -0,0 +1,50 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
<html>
|
3
|
+
<head>
|
4
|
+
<meta http-equiv="content-type" content="text/html;charset=utf-8">
|
5
|
+
<title>status.rb</title>
|
6
|
+
<link rel="stylesheet" href="http://jashkenas.github.io/docco/resources/linear/docco.css">
|
7
|
+
</head>
|
8
|
+
<body>
|
9
|
+
<div id='container'>
|
10
|
+
<div id="background"></div>
|
11
|
+
<div id="jump_to">
|
12
|
+
Jump To …
|
13
|
+
<div id="jump_wrapper">
|
14
|
+
<div id="jump_page">
|
15
|
+
<a class="source" href="../../httpkit.html">httpkit.rb</a>
|
16
|
+
<a class="source" href="../body.html">body.rb</a>
|
17
|
+
<a class="source" href="../client.html">client.rb</a>
|
18
|
+
<a class="source" href="../client/body_handler.html">body_handler.rb</a>
|
19
|
+
<a class="source" href="../client/keep_alive_handler.html">keep_alive_handler.rb</a>
|
20
|
+
<a class="source" href="../client/mandatory_handler.html">mandatory_handler.rb</a>
|
21
|
+
<a class="source" href="../client/timeouts_handler.html">timeouts_handler.rb</a>
|
22
|
+
<a class="source" href="eventmachine.html">eventmachine.rb</a>
|
23
|
+
<a class="source" href="status.html">status.rb</a>
|
24
|
+
<a class="source" href="../promise.html">promise.rb</a>
|
25
|
+
<a class="source" href="../request.html">request.rb</a>
|
26
|
+
<a class="source" href="../response.html">response.rb</a>
|
27
|
+
<a class="source" href="../serializer.html">serializer.rb</a>
|
28
|
+
<a class="source" href="../server.html">server.rb</a>
|
29
|
+
<a class="source" href="../server/block_handler.html">block_handler.rb</a>
|
30
|
+
<a class="source" href="../server/body_handler.html">body_handler.rb</a>
|
31
|
+
<a class="source" href="../server/keep_alive_handler.html">keep_alive_handler.rb</a>
|
32
|
+
<a class="source" href="../server/mandatory_handler.html">mandatory_handler.rb</a>
|
33
|
+
<a class="source" href="../server/timeouts_handler.html">timeouts_handler.rb</a>
|
34
|
+
<a class="source" href="../support/handler_manager.html">handler_manager.rb</a>
|
35
|
+
<a class="source" href="../support/message.html">message.rb</a>
|
36
|
+
<a class="source" href="../version.html">version.rb</a>
|
37
|
+
</div>
|
38
|
+
</div>
|
39
|
+
</div>
|
40
|
+
<table cellspacing=0 cellpadding=0>
|
41
|
+
<thead>
|
42
|
+
<tr>
|
43
|
+
<th class=docs><h1>status.rb</h1></th>
|
44
|
+
<th class=code></th>
|
45
|
+
</tr>
|
46
|
+
</thead>
|
47
|
+
<tbody>
|
48
|
+
</table>
|
49
|
+
</div>
|
50
|
+
</body>
|
@@ -0,0 +1,50 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
<html>
|
3
|
+
<head>
|
4
|
+
<meta http-equiv="content-type" content="text/html;charset=utf-8">
|
5
|
+
<title>promise.rb</title>
|
6
|
+
<link rel="stylesheet" href="http://jashkenas.github.io/docco/resources/linear/docco.css">
|
7
|
+
</head>
|
8
|
+
<body>
|
9
|
+
<div id='container'>
|
10
|
+
<div id="background"></div>
|
11
|
+
<div id="jump_to">
|
12
|
+
Jump To …
|
13
|
+
<div id="jump_wrapper">
|
14
|
+
<div id="jump_page">
|
15
|
+
<a class="source" href="../httpkit.html">httpkit.rb</a>
|
16
|
+
<a class="source" href="body.html">body.rb</a>
|
17
|
+
<a class="source" href="client.html">client.rb</a>
|
18
|
+
<a class="source" href="client/body_handler.html">body_handler.rb</a>
|
19
|
+
<a class="source" href="client/keep_alive_handler.html">keep_alive_handler.rb</a>
|
20
|
+
<a class="source" href="client/mandatory_handler.html">mandatory_handler.rb</a>
|
21
|
+
<a class="source" href="client/timeouts_handler.html">timeouts_handler.rb</a>
|
22
|
+
<a class="source" href="connection/eventmachine.html">eventmachine.rb</a>
|
23
|
+
<a class="source" href="connection/status.html">status.rb</a>
|
24
|
+
<a class="source" href="promise.html">promise.rb</a>
|
25
|
+
<a class="source" href="request.html">request.rb</a>
|
26
|
+
<a class="source" href="response.html">response.rb</a>
|
27
|
+
<a class="source" href="serializer.html">serializer.rb</a>
|
28
|
+
<a class="source" href="server.html">server.rb</a>
|
29
|
+
<a class="source" href="server/block_handler.html">block_handler.rb</a>
|
30
|
+
<a class="source" href="server/body_handler.html">body_handler.rb</a>
|
31
|
+
<a class="source" href="server/keep_alive_handler.html">keep_alive_handler.rb</a>
|
32
|
+
<a class="source" href="server/mandatory_handler.html">mandatory_handler.rb</a>
|
33
|
+
<a class="source" href="server/timeouts_handler.html">timeouts_handler.rb</a>
|
34
|
+
<a class="source" href="support/handler_manager.html">handler_manager.rb</a>
|
35
|
+
<a class="source" href="support/message.html">message.rb</a>
|
36
|
+
<a class="source" href="version.html">version.rb</a>
|
37
|
+
</div>
|
38
|
+
</div>
|
39
|
+
</div>
|
40
|
+
<table cellspacing=0 cellpadding=0>
|
41
|
+
<thead>
|
42
|
+
<tr>
|
43
|
+
<th class=docs><h1>promise.rb</h1></th>
|
44
|
+
<th class=code></th>
|
45
|
+
</tr>
|
46
|
+
</thead>
|
47
|
+
<tbody>
|
48
|
+
</table>
|
49
|
+
</div>
|
50
|
+
</body>
|