agouti 0.0.1 → 0.0.2
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/.gitignore +0 -2
- data/.rspec +2 -0
- data/.travis.yml +7 -0
- data/CHANGELOG.md +9 -0
- data/Gemfile.lock +46 -0
- data/README.md +2 -2
- data/Rakefile +5 -1
- data/agouti.gemspec +4 -0
- data/doc/Agouti.html +131 -0
- data/doc/Agouti/Rack.html +115 -0
- data/doc/Agouti/Rack/PackageLimiter.html +408 -0
- data/doc/Agouti/Rack/PackageLimiter/GzipTruncatedStream.html +310 -0
- data/doc/Agouti/Rack/PackageLimiter/InvalidHeaderException.html +134 -0
- data/doc/Agouti/Railtie.html +123 -0
- data/doc/_index.html +177 -0
- data/doc/class_list.html +54 -0
- data/doc/css/common.css +1 -0
- data/doc/css/full_list.css +57 -0
- data/doc/css/style.css +339 -0
- data/doc/file.README.html +140 -0
- data/doc/file_list.html +56 -0
- data/doc/frames.html +26 -0
- data/doc/index.html +140 -0
- data/doc/js/app.js +219 -0
- data/doc/js/full_list.js +178 -0
- data/doc/js/jquery.js +4 -0
- data/doc/method_list.html +77 -0
- data/doc/top-level-namespace.html +112 -0
- data/lib/agouti.rb +3 -3
- data/lib/agouti/rack/package_limiter.rb +73 -24
- data/lib/agouti/version.rb +1 -1
- data/spec/rack/package_limiter_spec.rb +91 -0
- data/spec/spec_helper.rb +7 -0
- metadata +88 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2d220334119fa85a7b2ddc377869b628032dc0e6
|
4
|
+
data.tar.gz: f8237d926836a2490b283c9074fc75233c64c6cd
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2119a404d3ff535dd01354e9abde09a4eda59bf485574929a53d3985d287d9ea2a8c7f41230166207608505fcb0718450ca61ff7b9fe08e1b144a36d9060e506
|
7
|
+
data.tar.gz: 144a9805e7ad6eec204a70691d63e23f1ddece6ea4dbda038965e7a277ee113a5378768d3fcd33715e1fb2723a2a532fa926ce96f9dcc648402823d7dcb3f7e5
|
data/.gitignore
CHANGED
data/.rspec
ADDED
data/.travis.yml
ADDED
data/CHANGELOG.md
ADDED
data/Gemfile.lock
ADDED
@@ -0,0 +1,46 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
agouti (0.0.2)
|
5
|
+
rack (~> 1.5)
|
6
|
+
|
7
|
+
GEM
|
8
|
+
remote: https://rubygems.org/
|
9
|
+
specs:
|
10
|
+
coderay (1.1.0)
|
11
|
+
diff-lcs (1.2.5)
|
12
|
+
method_source (0.8.2)
|
13
|
+
pry (0.9.12.3)
|
14
|
+
coderay (~> 1.0)
|
15
|
+
method_source (~> 0.8)
|
16
|
+
slop (~> 3.4)
|
17
|
+
pry-nav (0.2.3)
|
18
|
+
pry (~> 0.9.10)
|
19
|
+
rack (1.5.2)
|
20
|
+
rake (10.3.2)
|
21
|
+
rspec (2.14.1)
|
22
|
+
rspec-core (~> 2.14.0)
|
23
|
+
rspec-expectations (~> 2.14.0)
|
24
|
+
rspec-mocks (~> 2.14.0)
|
25
|
+
rspec-core (2.14.8)
|
26
|
+
rspec-expectations (2.14.5)
|
27
|
+
diff-lcs (>= 1.1.3, < 2.0)
|
28
|
+
rspec-mocks (2.14.6)
|
29
|
+
slop (3.4.7)
|
30
|
+
tomparse (0.4.2)
|
31
|
+
yard (0.8.7.4)
|
32
|
+
yard-tomdoc (0.7.1)
|
33
|
+
tomparse (>= 0.4.0)
|
34
|
+
yard
|
35
|
+
|
36
|
+
PLATFORMS
|
37
|
+
ruby
|
38
|
+
|
39
|
+
DEPENDENCIES
|
40
|
+
agouti!
|
41
|
+
bundler (~> 1.7)
|
42
|
+
pry
|
43
|
+
pry-nav
|
44
|
+
rake (~> 10.0)
|
45
|
+
rspec
|
46
|
+
yard-tomdoc
|
data/README.md
CHANGED
@@ -1,10 +1,10 @@
|
|
1
|
-
# Agouti
|
1
|
+
# Agouti [](https://travis-ci.org/CWISoftware/agouti) [](https://codeclimate.com/github/CWISoftware/agouti) [](http://badge.fury.io/rb/agouti)
|
2
2
|
|
3
3
|
Gem for testing above the fold render on the first tcp round trip.
|
4
4
|
|
5
5
|
This gem is a Rack middleware that truncates the gzipped response to 14kb.
|
6
6
|
|
7
|
-
|
7
|
+
Useful for testing [critical rendering path optimization](https://developers.google.com/web/fundamentals/performance/critical-rendering-path/).
|
8
8
|
|
9
9
|
## Installation
|
10
10
|
|
data/Rakefile
CHANGED
data/agouti.gemspec
CHANGED
@@ -22,4 +22,8 @@ Gem::Specification.new do |spec|
|
|
22
22
|
|
23
23
|
spec.add_development_dependency "bundler", "~> 1.7"
|
24
24
|
spec.add_development_dependency "rake", "~> 10.0"
|
25
|
+
spec.add_development_dependency "rspec"
|
26
|
+
spec.add_development_dependency "pry"
|
27
|
+
spec.add_development_dependency "pry-nav"
|
28
|
+
spec.add_development_dependency "yard-tomdoc"
|
25
29
|
end
|
data/doc/Agouti.html
ADDED
@@ -0,0 +1,131 @@
|
|
1
|
+
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
2
|
+
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
3
|
+
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
4
|
+
<head>
|
5
|
+
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
6
|
+
<title>
|
7
|
+
Module: Agouti
|
8
|
+
|
9
|
+
— Documentation by YARD 0.8.7.4
|
10
|
+
|
11
|
+
</title>
|
12
|
+
|
13
|
+
<link rel="stylesheet" href="css/style.css" type="text/css" charset="utf-8" />
|
14
|
+
|
15
|
+
<link rel="stylesheet" href="css/common.css" type="text/css" charset="utf-8" />
|
16
|
+
|
17
|
+
<script type="text/javascript" charset="utf-8">
|
18
|
+
hasFrames = window.top.frames.main ? true : false;
|
19
|
+
relpath = '';
|
20
|
+
framesUrl = "frames.html#!Agouti.html";
|
21
|
+
</script>
|
22
|
+
|
23
|
+
|
24
|
+
<script type="text/javascript" charset="utf-8" src="js/jquery.js"></script>
|
25
|
+
|
26
|
+
<script type="text/javascript" charset="utf-8" src="js/app.js"></script>
|
27
|
+
|
28
|
+
|
29
|
+
</head>
|
30
|
+
<body>
|
31
|
+
<div id="header">
|
32
|
+
<div id="menu">
|
33
|
+
|
34
|
+
<a href="_index.html">Index (A)</a> »
|
35
|
+
|
36
|
+
|
37
|
+
<span class="title">Agouti</span>
|
38
|
+
|
39
|
+
|
40
|
+
<div class="noframes"><span class="title">(</span><a href="." target="_top">no frames</a><span class="title">)</span></div>
|
41
|
+
</div>
|
42
|
+
|
43
|
+
<div id="search">
|
44
|
+
|
45
|
+
<a class="full_list_link" id="class_list_link"
|
46
|
+
href="class_list.html">
|
47
|
+
Class List
|
48
|
+
</a>
|
49
|
+
|
50
|
+
<a class="full_list_link" id="method_list_link"
|
51
|
+
href="method_list.html">
|
52
|
+
Method List
|
53
|
+
</a>
|
54
|
+
|
55
|
+
<a class="full_list_link" id="file_list_link"
|
56
|
+
href="file_list.html">
|
57
|
+
File List
|
58
|
+
</a>
|
59
|
+
|
60
|
+
</div>
|
61
|
+
<div class="clear"></div>
|
62
|
+
</div>
|
63
|
+
|
64
|
+
<iframe id="search_frame"></iframe>
|
65
|
+
|
66
|
+
<div id="content"><h1>Module: Agouti
|
67
|
+
|
68
|
+
|
69
|
+
|
70
|
+
</h1>
|
71
|
+
|
72
|
+
<dl class="box">
|
73
|
+
|
74
|
+
|
75
|
+
|
76
|
+
|
77
|
+
|
78
|
+
|
79
|
+
|
80
|
+
|
81
|
+
<dt class="r1 last">Defined in:</dt>
|
82
|
+
<dd class="r1 last">lib/agouti/version.rb<span class="defines">,<br />
|
83
|
+
lib/agouti/railtie.rb,<br /> lib/agouti/rack/package_limiter.rb</span>
|
84
|
+
</dd>
|
85
|
+
|
86
|
+
</dl>
|
87
|
+
<div class="clear"></div>
|
88
|
+
|
89
|
+
<h2>Defined Under Namespace</h2>
|
90
|
+
<p class="children">
|
91
|
+
|
92
|
+
|
93
|
+
<strong class="modules">Modules:</strong> <span class='object_link'><a href="Agouti/Rack.html" title="Agouti::Rack (module)">Rack</a></span>
|
94
|
+
|
95
|
+
|
96
|
+
|
97
|
+
<strong class="classes">Classes:</strong> <span class='object_link'><a href="Agouti/Railtie.html" title="Agouti::Railtie (class)">Railtie</a></span>
|
98
|
+
|
99
|
+
|
100
|
+
</p>
|
101
|
+
|
102
|
+
<h2>Constant Summary</h2>
|
103
|
+
|
104
|
+
<dl class="constants">
|
105
|
+
|
106
|
+
<dt id="VERSION-constant" class="">VERSION =
|
107
|
+
|
108
|
+
</dt>
|
109
|
+
<dd><pre class="code"><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>0.0.1</span><span class='tstring_end'>'</span></span></pre></dd>
|
110
|
+
|
111
|
+
</dl>
|
112
|
+
|
113
|
+
|
114
|
+
|
115
|
+
|
116
|
+
|
117
|
+
|
118
|
+
|
119
|
+
|
120
|
+
|
121
|
+
|
122
|
+
</div>
|
123
|
+
|
124
|
+
<div id="footer">
|
125
|
+
Generated on Tue Sep 2 15:27:49 2014 by
|
126
|
+
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
127
|
+
0.8.7.4 (ruby-2.0.0).
|
128
|
+
</div>
|
129
|
+
|
130
|
+
</body>
|
131
|
+
</html>
|
@@ -0,0 +1,115 @@
|
|
1
|
+
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
2
|
+
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
3
|
+
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
4
|
+
<head>
|
5
|
+
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
6
|
+
<title>
|
7
|
+
Module: Agouti::Rack
|
8
|
+
|
9
|
+
— Documentation by YARD 0.8.7.4
|
10
|
+
|
11
|
+
</title>
|
12
|
+
|
13
|
+
<link rel="stylesheet" href="../css/style.css" type="text/css" charset="utf-8" />
|
14
|
+
|
15
|
+
<link rel="stylesheet" href="../css/common.css" type="text/css" charset="utf-8" />
|
16
|
+
|
17
|
+
<script type="text/javascript" charset="utf-8">
|
18
|
+
hasFrames = window.top.frames.main ? true : false;
|
19
|
+
relpath = '../';
|
20
|
+
framesUrl = "../frames.html#!Agouti/Rack.html";
|
21
|
+
</script>
|
22
|
+
|
23
|
+
|
24
|
+
<script type="text/javascript" charset="utf-8" src="../js/jquery.js"></script>
|
25
|
+
|
26
|
+
<script type="text/javascript" charset="utf-8" src="../js/app.js"></script>
|
27
|
+
|
28
|
+
|
29
|
+
</head>
|
30
|
+
<body>
|
31
|
+
<div id="header">
|
32
|
+
<div id="menu">
|
33
|
+
|
34
|
+
<a href="../_index.html">Index (R)</a> »
|
35
|
+
<span class='title'><span class='object_link'><a href="../Agouti.html" title="Agouti (module)">Agouti</a></span></span>
|
36
|
+
»
|
37
|
+
<span class="title">Rack</span>
|
38
|
+
|
39
|
+
|
40
|
+
<div class="noframes"><span class="title">(</span><a href="." target="_top">no frames</a><span class="title">)</span></div>
|
41
|
+
</div>
|
42
|
+
|
43
|
+
<div id="search">
|
44
|
+
|
45
|
+
<a class="full_list_link" id="class_list_link"
|
46
|
+
href="../class_list.html">
|
47
|
+
Class List
|
48
|
+
</a>
|
49
|
+
|
50
|
+
<a class="full_list_link" id="method_list_link"
|
51
|
+
href="../method_list.html">
|
52
|
+
Method List
|
53
|
+
</a>
|
54
|
+
|
55
|
+
<a class="full_list_link" id="file_list_link"
|
56
|
+
href="../file_list.html">
|
57
|
+
File List
|
58
|
+
</a>
|
59
|
+
|
60
|
+
</div>
|
61
|
+
<div class="clear"></div>
|
62
|
+
</div>
|
63
|
+
|
64
|
+
<iframe id="search_frame"></iframe>
|
65
|
+
|
66
|
+
<div id="content"><h1>Module: Agouti::Rack
|
67
|
+
|
68
|
+
|
69
|
+
|
70
|
+
</h1>
|
71
|
+
|
72
|
+
<dl class="box">
|
73
|
+
|
74
|
+
|
75
|
+
|
76
|
+
|
77
|
+
|
78
|
+
|
79
|
+
|
80
|
+
|
81
|
+
<dt class="r1 last">Defined in:</dt>
|
82
|
+
<dd class="r1 last">lib/agouti/rack/package_limiter.rb</dd>
|
83
|
+
|
84
|
+
</dl>
|
85
|
+
<div class="clear"></div>
|
86
|
+
|
87
|
+
<h2>Defined Under Namespace</h2>
|
88
|
+
<p class="children">
|
89
|
+
|
90
|
+
|
91
|
+
|
92
|
+
|
93
|
+
<strong class="classes">Classes:</strong> <span class='object_link'><a href="Rack/PackageLimiter.html" title="Agouti::Rack::PackageLimiter (class)">PackageLimiter</a></span>
|
94
|
+
|
95
|
+
|
96
|
+
</p>
|
97
|
+
|
98
|
+
|
99
|
+
|
100
|
+
|
101
|
+
|
102
|
+
|
103
|
+
|
104
|
+
|
105
|
+
|
106
|
+
</div>
|
107
|
+
|
108
|
+
<div id="footer">
|
109
|
+
Generated on Tue Sep 2 15:27:49 2014 by
|
110
|
+
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
111
|
+
0.8.7.4 (ruby-2.0.0).
|
112
|
+
</div>
|
113
|
+
|
114
|
+
</body>
|
115
|
+
</html>
|
@@ -0,0 +1,408 @@
|
|
1
|
+
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
2
|
+
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
3
|
+
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
4
|
+
<head>
|
5
|
+
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
6
|
+
<title>
|
7
|
+
Class: Agouti::Rack::PackageLimiter
|
8
|
+
|
9
|
+
— Documentation by YARD 0.8.7.4
|
10
|
+
|
11
|
+
</title>
|
12
|
+
|
13
|
+
<link rel="stylesheet" href="../../css/style.css" type="text/css" charset="utf-8" />
|
14
|
+
|
15
|
+
<link rel="stylesheet" href="../../css/common.css" type="text/css" charset="utf-8" />
|
16
|
+
|
17
|
+
<script type="text/javascript" charset="utf-8">
|
18
|
+
hasFrames = window.top.frames.main ? true : false;
|
19
|
+
relpath = '../../';
|
20
|
+
framesUrl = "../../frames.html#!Agouti/Rack/PackageLimiter.html";
|
21
|
+
</script>
|
22
|
+
|
23
|
+
|
24
|
+
<script type="text/javascript" charset="utf-8" src="../../js/jquery.js"></script>
|
25
|
+
|
26
|
+
<script type="text/javascript" charset="utf-8" src="../../js/app.js"></script>
|
27
|
+
|
28
|
+
|
29
|
+
</head>
|
30
|
+
<body>
|
31
|
+
<div id="header">
|
32
|
+
<div id="menu">
|
33
|
+
|
34
|
+
<a href="../../_index.html">Index (P)</a> »
|
35
|
+
<span class='title'><span class='object_link'><a href="../../Agouti.html" title="Agouti (module)">Agouti</a></span></span> » <span class='title'><span class='object_link'><a href="../Rack.html" title="Agouti::Rack (module)">Rack</a></span></span>
|
36
|
+
»
|
37
|
+
<span class="title">PackageLimiter</span>
|
38
|
+
|
39
|
+
|
40
|
+
<div class="noframes"><span class="title">(</span><a href="." target="_top">no frames</a><span class="title">)</span></div>
|
41
|
+
</div>
|
42
|
+
|
43
|
+
<div id="search">
|
44
|
+
|
45
|
+
<a class="full_list_link" id="class_list_link"
|
46
|
+
href="../../class_list.html">
|
47
|
+
Class List
|
48
|
+
</a>
|
49
|
+
|
50
|
+
<a class="full_list_link" id="method_list_link"
|
51
|
+
href="../../method_list.html">
|
52
|
+
Method List
|
53
|
+
</a>
|
54
|
+
|
55
|
+
<a class="full_list_link" id="file_list_link"
|
56
|
+
href="../../file_list.html">
|
57
|
+
File List
|
58
|
+
</a>
|
59
|
+
|
60
|
+
</div>
|
61
|
+
<div class="clear"></div>
|
62
|
+
</div>
|
63
|
+
|
64
|
+
<iframe id="search_frame"></iframe>
|
65
|
+
|
66
|
+
<div id="content"><h1>Class: Agouti::Rack::PackageLimiter
|
67
|
+
|
68
|
+
|
69
|
+
|
70
|
+
</h1>
|
71
|
+
|
72
|
+
<dl class="box">
|
73
|
+
|
74
|
+
<dt class="r1">Inherits:</dt>
|
75
|
+
<dd class="r1">
|
76
|
+
<span class="inheritName">Object</span>
|
77
|
+
|
78
|
+
<ul class="fullTree">
|
79
|
+
<li>Object</li>
|
80
|
+
|
81
|
+
<li class="next">Agouti::Rack::PackageLimiter</li>
|
82
|
+
|
83
|
+
</ul>
|
84
|
+
<a href="#" class="inheritanceTree">show all</a>
|
85
|
+
|
86
|
+
</dd>
|
87
|
+
|
88
|
+
|
89
|
+
|
90
|
+
|
91
|
+
|
92
|
+
|
93
|
+
|
94
|
+
|
95
|
+
|
96
|
+
<dt class="r2 last">Defined in:</dt>
|
97
|
+
<dd class="r2 last">lib/agouti/rack/package_limiter.rb</dd>
|
98
|
+
|
99
|
+
</dl>
|
100
|
+
<div class="clear"></div>
|
101
|
+
|
102
|
+
<h2>Overview</h2><div class="docstring">
|
103
|
+
<div class="discussion">
|
104
|
+
|
105
|
+
<p>Public: rack middleware that truncates the gzipped response. Useful for
|
106
|
+
testing critical rendering path optimization.</p>
|
107
|
+
|
108
|
+
|
109
|
+
</div>
|
110
|
+
</div>
|
111
|
+
<div class="tags">
|
112
|
+
|
113
|
+
|
114
|
+
</div><h2>Defined Under Namespace</h2>
|
115
|
+
<p class="children">
|
116
|
+
|
117
|
+
|
118
|
+
|
119
|
+
|
120
|
+
<strong class="classes">Classes:</strong> <span class='object_link'><a href="PackageLimiter/GzipTruncatedStream.html" title="Agouti::Rack::PackageLimiter::GzipTruncatedStream (class)">GzipTruncatedStream</a></span>, <span class='object_link'><a href="PackageLimiter/InvalidHeaderException.html" title="Agouti::Rack::PackageLimiter::InvalidHeaderException (class)">InvalidHeaderException</a></span>
|
121
|
+
|
122
|
+
|
123
|
+
</p>
|
124
|
+
|
125
|
+
<h2>Constant Summary</h2>
|
126
|
+
|
127
|
+
<dl class="constants">
|
128
|
+
|
129
|
+
<dt id="ENABLE_HEADER-constant" class="">ENABLE_HEADER =
|
130
|
+
|
131
|
+
</dt>
|
132
|
+
<dd><pre class="code"><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>X-Agouti-Enable</span><span class='tstring_end'>'</span></span></pre></dd>
|
133
|
+
|
134
|
+
<dt id="LIMIT_HEADER-constant" class="">LIMIT_HEADER =
|
135
|
+
|
136
|
+
</dt>
|
137
|
+
<dd><pre class="code"><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>X-Agouti-Limit</span><span class='tstring_end'>'</span></span></pre></dd>
|
138
|
+
|
139
|
+
<dt id="DEFAULT_LIMIT-constant" class="">DEFAULT_LIMIT =
|
140
|
+
<div class="docstring">
|
141
|
+
<div class="discussion">
|
142
|
+
|
143
|
+
<p>Public: Default limit of bytes.</p>
|
144
|
+
|
145
|
+
|
146
|
+
</div>
|
147
|
+
</div>
|
148
|
+
<div class="tags">
|
149
|
+
|
150
|
+
|
151
|
+
</div>
|
152
|
+
</dt>
|
153
|
+
<dd><pre class="code"><span class='int'>14000</span></pre></dd>
|
154
|
+
|
155
|
+
</dl>
|
156
|
+
|
157
|
+
|
158
|
+
|
159
|
+
|
160
|
+
|
161
|
+
|
162
|
+
|
163
|
+
|
164
|
+
|
165
|
+
<h2>
|
166
|
+
Instance Method Summary
|
167
|
+
<small>(<a href="#" class="summary_toggle">collapse</a>)</small>
|
168
|
+
</h2>
|
169
|
+
|
170
|
+
<ul class="summary">
|
171
|
+
|
172
|
+
<li class="public ">
|
173
|
+
<span class="summary_signature">
|
174
|
+
|
175
|
+
<a href="#call-instance_method" title="#call (instance method)">- (Object) <strong>call</strong>(env) </a>
|
176
|
+
|
177
|
+
|
178
|
+
|
179
|
+
</span>
|
180
|
+
|
181
|
+
|
182
|
+
|
183
|
+
|
184
|
+
|
185
|
+
|
186
|
+
|
187
|
+
|
188
|
+
|
189
|
+
<span class="summary_desc"><div class='inline'>
|
190
|
+
<p>Public: Apply middleware to request.</p>
|
191
|
+
</div></span>
|
192
|
+
|
193
|
+
</li>
|
194
|
+
|
195
|
+
|
196
|
+
<li class="public ">
|
197
|
+
<span class="summary_signature">
|
198
|
+
|
199
|
+
<a href="#initialize-instance_method" title="#initialize (instance method)">- (PackageLimiter) <strong>initialize</strong>(app) </a>
|
200
|
+
|
201
|
+
|
202
|
+
|
203
|
+
</span>
|
204
|
+
|
205
|
+
|
206
|
+
<span class="note title constructor">constructor</span>
|
207
|
+
|
208
|
+
|
209
|
+
|
210
|
+
|
211
|
+
|
212
|
+
|
213
|
+
|
214
|
+
|
215
|
+
<span class="summary_desc"><div class='inline'>
|
216
|
+
<p>Public: Constructor.</p>
|
217
|
+
</div></span>
|
218
|
+
|
219
|
+
</li>
|
220
|
+
|
221
|
+
|
222
|
+
</ul>
|
223
|
+
|
224
|
+
|
225
|
+
<div id="constructor_details" class="method_details_list">
|
226
|
+
<h2>Constructor Details</h2>
|
227
|
+
|
228
|
+
<div class="method_details first">
|
229
|
+
<h3 class="signature first" id="initialize-instance_method">
|
230
|
+
|
231
|
+
- (<tt><span class='object_link'><a href="" title="Agouti::Rack::PackageLimiter (class)">PackageLimiter</a></span></tt>) <strong>initialize</strong>(app)
|
232
|
+
|
233
|
+
|
234
|
+
|
235
|
+
|
236
|
+
|
237
|
+
</h3><div class="docstring">
|
238
|
+
<div class="discussion">
|
239
|
+
|
240
|
+
<p>Public: Constructor.</p>
|
241
|
+
|
242
|
+
<p>app - rack app instance</p>
|
243
|
+
|
244
|
+
<p>Returns an instance of Agouti::Rack::PackageLimiter middleware.</p>
|
245
|
+
|
246
|
+
|
247
|
+
</div>
|
248
|
+
</div>
|
249
|
+
<div class="tags">
|
250
|
+
|
251
|
+
|
252
|
+
</div><table class="source_code">
|
253
|
+
<tr>
|
254
|
+
<td>
|
255
|
+
<pre class="lines">
|
256
|
+
|
257
|
+
|
258
|
+
20
|
259
|
+
21
|
260
|
+
22</pre>
|
261
|
+
</td>
|
262
|
+
<td>
|
263
|
+
<pre class="code"><span class="info file"># File 'lib/agouti/rack/package_limiter.rb', line 20</span>
|
264
|
+
|
265
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_initialize'>initialize</span><span class='lparen'>(</span><span class='id identifier rubyid_app'>app</span><span class='rparen'>)</span>
|
266
|
+
<span class='ivar'>@app</span> <span class='op'>=</span> <span class='id identifier rubyid_app'>app</span>
|
267
|
+
<span class='kw'>end</span></pre>
|
268
|
+
</td>
|
269
|
+
</tr>
|
270
|
+
</table>
|
271
|
+
</div>
|
272
|
+
|
273
|
+
</div>
|
274
|
+
|
275
|
+
|
276
|
+
<div id="instance_method_details" class="method_details_list">
|
277
|
+
<h2>Instance Method Details</h2>
|
278
|
+
|
279
|
+
|
280
|
+
<div class="method_details first">
|
281
|
+
<h3 class="signature first" id="call-instance_method">
|
282
|
+
|
283
|
+
- (<tt>Object</tt>) <strong>call</strong>(env)
|
284
|
+
|
285
|
+
|
286
|
+
|
287
|
+
|
288
|
+
|
289
|
+
</h3><div class="docstring">
|
290
|
+
<div class="discussion">
|
291
|
+
|
292
|
+
<p>Public: Apply middleware to request.</p>
|
293
|
+
|
294
|
+
<p>env - environment.</p>
|
295
|
+
|
296
|
+
<p>Raises Agouti::Rack::PackageLimiter::InvalidHeaderException if headers are
|
297
|
+
not valid. The following values are accepted:</p>
|
298
|
+
|
299
|
+
<pre class="code ruby"><code class="ruby">X-Agouti-Enable:
|
300
|
+
- header not present or set with value 0(disabled).
|
301
|
+
- header set with value 1 (enabled).
|
302
|
+
X-Agouti-Limit: a positive integer.</code></pre>
|
303
|
+
|
304
|
+
<p>The response body is gzipped only when the following conditions are met:</p>
|
305
|
+
|
306
|
+
<pre class="code ruby"><code class="ruby">Header X-Agouti-Enable set with value 1 and header Content-Type with value 'text/html'.
|
307
|
+
If header X-Agouti-Limit is set, response body will be truncated to the given number of bytes.
|
308
|
+
Otherwise, body will be truncated to the default limit, which is 14000 bytes.</code></pre>
|
309
|
+
|
310
|
+
<p>If header X-Agouti-Enable is enabled but header Content-Type does not have
|
311
|
+
value 'text/html', the middleware will return a response with
|
312
|
+
status code 204 and empty body.</p>
|
313
|
+
|
314
|
+
<p>If header X-Agouti-Enable has value 0 or is empty, the response will not be
|
315
|
+
modified.</p>
|
316
|
+
|
317
|
+
|
318
|
+
</div>
|
319
|
+
</div>
|
320
|
+
<div class="tags">
|
321
|
+
|
322
|
+
<p class="tag_title">Raises:</p>
|
323
|
+
<ul class="raise">
|
324
|
+
|
325
|
+
<li>
|
326
|
+
|
327
|
+
|
328
|
+
<span class='type'>(<tt><span class='object_link'><a href="PackageLimiter/InvalidHeaderException.html" title="Agouti::Rack::PackageLimiter::InvalidHeaderException (class)">InvalidHeaderException</a></span></tt>)</span>
|
329
|
+
|
330
|
+
|
331
|
+
|
332
|
+
</li>
|
333
|
+
|
334
|
+
</ul>
|
335
|
+
|
336
|
+
</div><table class="source_code">
|
337
|
+
<tr>
|
338
|
+
<td>
|
339
|
+
<pre class="lines">
|
340
|
+
|
341
|
+
|
342
|
+
43
|
343
|
+
44
|
344
|
+
45
|
345
|
+
46
|
346
|
+
47
|
347
|
+
48
|
348
|
+
49
|
349
|
+
50
|
350
|
+
51
|
351
|
+
52
|
352
|
+
53
|
353
|
+
54
|
354
|
+
55
|
355
|
+
56
|
356
|
+
57
|
357
|
+
58
|
358
|
+
59
|
359
|
+
60
|
360
|
+
61
|
361
|
+
62
|
362
|
+
63
|
363
|
+
64
|
364
|
+
65</pre>
|
365
|
+
</td>
|
366
|
+
<td>
|
367
|
+
<pre class="code"><span class="info file"># File 'lib/agouti/rack/package_limiter.rb', line 43</span>
|
368
|
+
|
369
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_call'>call</span><span class='lparen'>(</span><span class='id identifier rubyid_env'>env</span><span class='rparen'>)</span>
|
370
|
+
<span class='id identifier rubyid_raise'>raise</span> <span class='const'>InvalidHeaderException</span> <span class='kw'>unless</span> <span class='id identifier rubyid_valid?'>valid?</span><span class='lparen'>(</span><span class='id identifier rubyid_env'>env</span><span class='rparen'>)</span>
|
371
|
+
|
372
|
+
<span class='id identifier rubyid_status'>status</span><span class='comma'>,</span> <span class='id identifier rubyid_headers'>headers</span><span class='comma'>,</span> <span class='id identifier rubyid_body'>body</span> <span class='op'>=</span> <span class='ivar'>@app</span><span class='period'>.</span><span class='id identifier rubyid_call'>call</span><span class='lparen'>(</span><span class='id identifier rubyid_env'>env</span><span class='rparen'>)</span>
|
373
|
+
|
374
|
+
<span class='id identifier rubyid_set_limit'>set_limit</span><span class='lparen'>(</span><span class='id identifier rubyid_env'>env</span><span class='rparen'>)</span>
|
375
|
+
|
376
|
+
<span class='kw'>if</span> <span class='id identifier rubyid_enabled?'>enabled?</span><span class='lparen'>(</span><span class='id identifier rubyid_env'>env</span><span class='rparen'>)</span>
|
377
|
+
<span class='kw'>unless</span> <span class='id identifier rubyid_headers'>headers</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>Content-Type</span><span class='tstring_end'>'</span></span><span class='rbracket'>]</span> <span class='op'>==</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>text/html</span><span class='tstring_end'>'</span></span>
|
378
|
+
<span class='kw'>return</span> <span class='lbracket'>[</span><span class='int'>204</span><span class='comma'>,</span> <span class='lbrace'>{</span><span class='rbrace'>}</span><span class='comma'>,</span> <span class='lbracket'>[</span><span class='rbracket'>]</span><span class='rbracket'>]</span>
|
379
|
+
<span class='kw'>end</span>
|
380
|
+
|
381
|
+
<span class='id identifier rubyid_headers'>headers</span> <span class='op'>=</span> <span class='op'>::</span><span class='const'>Rack</span><span class='op'>::</span><span class='const'>Utils</span><span class='op'>::</span><span class='const'>HeaderHash</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='id identifier rubyid_headers'>headers</span><span class='rparen'>)</span>
|
382
|
+
|
383
|
+
<span class='id identifier rubyid_headers'>headers</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>Content-Encoding</span><span class='tstring_end'>'</span></span><span class='rbracket'>]</span> <span class='op'>=</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>gzip</span><span class='tstring_end'>'</span></span>
|
384
|
+
<span class='id identifier rubyid_headers'>headers</span><span class='period'>.</span><span class='id identifier rubyid_delete'>delete</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>Content-Length</span><span class='tstring_end'>'</span></span><span class='rparen'>)</span>
|
385
|
+
<span class='id identifier rubyid_mtime'>mtime</span> <span class='op'>=</span> <span class='id identifier rubyid_headers'>headers</span><span class='period'>.</span><span class='id identifier rubyid_key?'>key?</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>Last-Modified</span><span class='tstring_end'>'</span></span><span class='rparen'>)</span> <span class='op'>?</span> <span class='const'>Time</span><span class='period'>.</span><span class='id identifier rubyid_httpdate'>httpdate</span><span class='lparen'>(</span><span class='id identifier rubyid_headers'>headers</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>Last-Modified</span><span class='tstring_end'>'</span></span><span class='rbracket'>]</span><span class='rparen'>)</span> <span class='op'>:</span> <span class='const'>Time</span><span class='period'>.</span><span class='id identifier rubyid_now'>now</span>
|
386
|
+
|
387
|
+
<span class='lbracket'>[</span><span class='id identifier rubyid_status'>status</span><span class='comma'>,</span> <span class='id identifier rubyid_headers'>headers</span><span class='comma'>,</span> <span class='const'>GzipTruncatedStream</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='id identifier rubyid_body'>body</span><span class='comma'>,</span> <span class='id identifier rubyid_mtime'>mtime</span><span class='comma'>,</span> <span class='ivar'>@limit</span><span class='rparen'>)</span><span class='rbracket'>]</span>
|
388
|
+
<span class='kw'>else</span>
|
389
|
+
<span class='lbracket'>[</span><span class='id identifier rubyid_status'>status</span><span class='comma'>,</span> <span class='id identifier rubyid_headers'>headers</span><span class='comma'>,</span> <span class='id identifier rubyid_body'>body</span><span class='rbracket'>]</span>
|
390
|
+
<span class='kw'>end</span>
|
391
|
+
<span class='kw'>end</span></pre>
|
392
|
+
</td>
|
393
|
+
</tr>
|
394
|
+
</table>
|
395
|
+
</div>
|
396
|
+
|
397
|
+
</div>
|
398
|
+
|
399
|
+
</div>
|
400
|
+
|
401
|
+
<div id="footer">
|
402
|
+
Generated on Tue Sep 2 15:27:50 2014 by
|
403
|
+
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
404
|
+
0.8.7.4 (ruby-2.0.0).
|
405
|
+
</div>
|
406
|
+
|
407
|
+
</body>
|
408
|
+
</html>
|