mongrel_esi 0.5.2 → 0.5.4
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.
- data/ext/esi/esi_parser.c +1 -0
- data/ext/esi/extconf.rb +2 -0
- data/ext/esi/parser.c +2 -2
- data/ext/esi/parser.h +2 -0
- data/ext/esi/parser.rl +2 -2
- data/ext/esi/test/common.rl +46 -0
- data/ext/esi/test/parser.c +1901 -0
- data/ext/esi/test/parser.h +127 -0
- data/ext/esi/test/parser.rl +611 -0
- data/ext/esi/test/test.c +2 -2
- data/lib/esi/cache.rb +1 -1
- data/lib/esi/version.rb +1 -1
- data/test/benchmarks/perf-trunk-n1000-c1.csv +100 -100
- data/test/benchmarks/perf-trunk-n1000-c2.csv +100 -100
- data/test/benchmarks/perf-trunk-n1000-c3.csv +100 -100
- data/test/benchmarks/perf-trunk-n1000-c4.csv +100 -100
- data/test/benchmarks/perf-trunk-n1000-c5.csv +100 -100
- data/test/integration/docs/large-no-cache.html +688 -0
- data/test/integration/handler_test.rb +7 -2
- data/test/load_test_ab.rb +1 -1
- metadata +7 -222
- data/doc/rdoc/classes/ESI/CParser.html +0 -122
- data/doc/rdoc/classes/ESI/Cache.html +0 -178
- data/doc/rdoc/classes/ESI/Cache.src/M000087.html +0 -17
- data/doc/rdoc/classes/ESI/Cache.src/M000088.html +0 -20
- data/doc/rdoc/classes/ESI/Config.html +0 -314
- data/doc/rdoc/classes/ESI/Config.src/M000049.html +0 -18
- data/doc/rdoc/classes/ESI/Config.src/M000050.html +0 -18
- data/doc/rdoc/classes/ESI/Config.src/M000051.html +0 -35
- data/doc/rdoc/classes/ESI/Config.src/M000052.html +0 -40
- data/doc/rdoc/classes/ESI/Config.src/M000053.html +0 -23
- data/doc/rdoc/classes/ESI/Config.src/M000054.html +0 -18
- data/doc/rdoc/classes/ESI/Config.src/M000055.html +0 -20
- data/doc/rdoc/classes/ESI/Config.src/M000056.html +0 -24
- data/doc/rdoc/classes/ESI/Config/CacheConfig.html +0 -212
- data/doc/rdoc/classes/ESI/Config/CacheConfig.src/M000060.html +0 -19
- data/doc/rdoc/classes/ESI/Config/CacheConfig.src/M000061.html +0 -19
- data/doc/rdoc/classes/ESI/Config/CacheConfig.src/M000062.html +0 -18
- data/doc/rdoc/classes/ESI/Config/CacheConfig.src/M000063.html +0 -18
- data/doc/rdoc/classes/ESI/Config/CacheConfig.src/M000064.html +0 -18
- data/doc/rdoc/classes/ESI/Config/ConfigRouter.html +0 -187
- data/doc/rdoc/classes/ESI/Config/ConfigRouter.src/M000057.html +0 -19
- data/doc/rdoc/classes/ESI/Config/ConfigRouter.src/M000058.html +0 -21
- data/doc/rdoc/classes/ESI/Config/ConfigRouter.src/M000059.html +0 -21
- data/doc/rdoc/classes/ESI/Dispatcher.html +0 -174
- data/doc/rdoc/classes/ESI/Dispatcher.src/M000092.html +0 -19
- data/doc/rdoc/classes/ESI/Dispatcher.src/M000093.html +0 -27
- data/doc/rdoc/classes/ESI/Fragment.html +0 -218
- data/doc/rdoc/classes/ESI/Fragment.src/M000111.html +0 -20
- data/doc/rdoc/classes/ESI/Fragment.src/M000112.html +0 -18
- data/doc/rdoc/classes/ESI/Fragment.src/M000113.html +0 -18
- data/doc/rdoc/classes/ESI/Invalidator.html +0 -131
- data/doc/rdoc/classes/ESI/Invalidator.src/M000004.html +0 -41
- data/doc/rdoc/classes/ESI/Log.html +0 -221
- data/doc/rdoc/classes/ESI/Log.src/M000030.html +0 -18
- data/doc/rdoc/classes/ESI/Log.src/M000031.html +0 -18
- data/doc/rdoc/classes/ESI/Log.src/M000032.html +0 -18
- data/doc/rdoc/classes/ESI/Log.src/M000033.html +0 -18
- data/doc/rdoc/classes/ESI/Log.src/M000034.html +0 -18
- data/doc/rdoc/classes/ESI/Log.src/M000035.html +0 -18
- data/doc/rdoc/classes/ESI/Log.src/M000036.html +0 -18
- data/doc/rdoc/classes/ESI/MemcachedCache.html +0 -314
- data/doc/rdoc/classes/ESI/MemcachedCache.src/M000037.html +0 -24
- data/doc/rdoc/classes/ESI/MemcachedCache.src/M000038.html +0 -22
- data/doc/rdoc/classes/ESI/MemcachedCache.src/M000039.html +0 -19
- data/doc/rdoc/classes/ESI/MemcachedCache.src/M000040.html +0 -23
- data/doc/rdoc/classes/ESI/MemcachedCache.src/M000041.html +0 -18
- data/doc/rdoc/classes/ESI/MemcachedCache.src/M000042.html +0 -19
- data/doc/rdoc/classes/ESI/MemcachedCache.src/M000043.html +0 -18
- data/doc/rdoc/classes/ESI/MemcachedCache.src/M000044.html +0 -18
- data/doc/rdoc/classes/ESI/MemcachedCache.src/M000045.html +0 -17
- data/doc/rdoc/classes/ESI/OutputAdapter.html +0 -204
- data/doc/rdoc/classes/ESI/OutputAdapter.src/M000094.html +0 -37
- data/doc/rdoc/classes/ESI/OutputAdapter.src/M000095.html +0 -18
- data/doc/rdoc/classes/ESI/OutputAdapter.src/M000096.html +0 -18
- data/doc/rdoc/classes/ESI/OutputAdapter.src/M000097.html +0 -18
- data/doc/rdoc/classes/ESI/Parser.html +0 -184
- data/doc/rdoc/classes/ESI/Parser.src/M000065.html +0 -51
- data/doc/rdoc/classes/ESI/Parser.src/M000066.html +0 -39
- data/doc/rdoc/classes/ESI/Parser.src/M000067.html +0 -19
- data/doc/rdoc/classes/ESI/Processor.html +0 -194
- data/doc/rdoc/classes/ESI/Processor.src/M000046.html +0 -26
- data/doc/rdoc/classes/ESI/Processor.src/M000047.html +0 -44
- data/doc/rdoc/classes/ESI/Processor.src/M000048.html +0 -26
- data/doc/rdoc/classes/ESI/Proxy.html +0 -304
- data/doc/rdoc/classes/ESI/Proxy.src/M000071.html +0 -20
- data/doc/rdoc/classes/ESI/Proxy.src/M000072.html +0 -63
- data/doc/rdoc/classes/ESI/Proxy.src/M000073.html +0 -62
- data/doc/rdoc/classes/ESI/Proxy.src/M000074.html +0 -24
- data/doc/rdoc/classes/ESI/Proxy.src/M000075.html +0 -19
- data/doc/rdoc/classes/ESI/Proxy.src/M000076.html +0 -22
- data/doc/rdoc/classes/ESI/Proxy.src/M000077.html +0 -18
- data/doc/rdoc/classes/ESI/Proxy.src/M000078.html +0 -28
- data/doc/rdoc/classes/ESI/Proxy.src/M000079.html +0 -29
- data/doc/rdoc/classes/ESI/RackAdapter.html +0 -214
- data/doc/rdoc/classes/ESI/RackAdapter.src/M000068.html +0 -18
- data/doc/rdoc/classes/ESI/RackAdapter.src/M000069.html +0 -34
- data/doc/rdoc/classes/ESI/RackAdapter.src/M000070.html +0 -17
- data/doc/rdoc/classes/ESI/RackConfig.html +0 -173
- data/doc/rdoc/classes/ESI/RackConfig.src/M000089.html +0 -28
- data/doc/rdoc/classes/ESI/RackConfig.src/M000090.html +0 -18
- data/doc/rdoc/classes/ESI/RackConfig.src/M000091.html +0 -20
- data/doc/rdoc/classes/ESI/Request.html +0 -158
- data/doc/rdoc/classes/ESI/Request.src/M000098.html +0 -18
- data/doc/rdoc/classes/ESI/Request.src/M000099.html +0 -18
- data/doc/rdoc/classes/ESI/Response.html +0 -250
- data/doc/rdoc/classes/ESI/Response.src/M000080.html +0 -23
- data/doc/rdoc/classes/ESI/Response.src/M000081.html +0 -18
- data/doc/rdoc/classes/ESI/Response.src/M000082.html +0 -21
- data/doc/rdoc/classes/ESI/Response.src/M000083.html +0 -20
- data/doc/rdoc/classes/ESI/Response.src/M000084.html +0 -25
- data/doc/rdoc/classes/ESI/Response.src/M000085.html +0 -18
- data/doc/rdoc/classes/ESI/Response.src/M000086.html +0 -33
- data/doc/rdoc/classes/ESI/Router.html +0 -212
- data/doc/rdoc/classes/ESI/Router.src/M000109.html +0 -36
- data/doc/rdoc/classes/ESI/Router.src/M000110.html +0 -25
- data/doc/rdoc/classes/ESI/RubyCache.html +0 -278
- data/doc/rdoc/classes/ESI/RubyCache.src/M000100.html +0 -20
- data/doc/rdoc/classes/ESI/RubyCache.src/M000101.html +0 -20
- data/doc/rdoc/classes/ESI/RubyCache.src/M000102.html +0 -20
- data/doc/rdoc/classes/ESI/RubyCache.src/M000103.html +0 -22
- data/doc/rdoc/classes/ESI/RubyCache.src/M000104.html +0 -18
- data/doc/rdoc/classes/ESI/RubyCache.src/M000105.html +0 -22
- data/doc/rdoc/classes/ESI/RubyCache.src/M000106.html +0 -18
- data/doc/rdoc/classes/ESI/RubyCache.src/M000107.html +0 -18
- data/doc/rdoc/classes/ESI/RubyCache.src/M000108.html +0 -18
- data/doc/rdoc/classes/ESI/Tag.html +0 -141
- data/doc/rdoc/classes/ESI/Tag/Attempt.html +0 -113
- data/doc/rdoc/classes/ESI/Tag/Base.html +0 -237
- data/doc/rdoc/classes/ESI/Tag/Base.src/M000026.html +0 -23
- data/doc/rdoc/classes/ESI/Tag/Base.src/M000027.html +0 -22
- data/doc/rdoc/classes/ESI/Tag/Base.src/M000028.html +0 -22
- data/doc/rdoc/classes/ESI/Tag/Base.src/M000029.html +0 -17
- data/doc/rdoc/classes/ESI/Tag/Container.html +0 -206
- data/doc/rdoc/classes/ESI/Tag/Container.src/M000015.html +0 -20
- data/doc/rdoc/classes/ESI/Tag/Container.src/M000016.html +0 -22
- data/doc/rdoc/classes/ESI/Tag/Container.src/M000017.html +0 -25
- data/doc/rdoc/classes/ESI/Tag/Except.html +0 -184
- data/doc/rdoc/classes/ESI/Tag/Except.src/M000018.html +0 -21
- data/doc/rdoc/classes/ESI/Tag/Except.src/M000019.html +0 -20
- data/doc/rdoc/classes/ESI/Tag/Except.src/M000020.html +0 -18
- data/doc/rdoc/classes/ESI/Tag/Include.html +0 -257
- data/doc/rdoc/classes/ESI/Tag/Include.src/M000005.html +0 -20
- data/doc/rdoc/classes/ESI/Tag/Include.src/M000006.html +0 -18
- data/doc/rdoc/classes/ESI/Tag/Include.src/M000007.html +0 -34
- data/doc/rdoc/classes/ESI/Tag/Include.src/M000008.html +0 -22
- data/doc/rdoc/classes/ESI/Tag/Include.src/M000009.html +0 -27
- data/doc/rdoc/classes/ESI/Tag/Include.src/M000010.html +0 -30
- data/doc/rdoc/classes/ESI/Tag/Include.src/M000011.html +0 -51
- data/doc/rdoc/classes/ESI/Tag/Include/Request.html +0 -199
- data/doc/rdoc/classes/ESI/Tag/Include/Request.src/M000012.html +0 -18
- data/doc/rdoc/classes/ESI/Tag/Include/Request.src/M000013.html +0 -44
- data/doc/rdoc/classes/ESI/Tag/Include/Request/Error.html +0 -155
- data/doc/rdoc/classes/ESI/Tag/Include/Request/Error.src/M000014.html +0 -19
- data/doc/rdoc/classes/ESI/Tag/Invalidate.html +0 -171
- data/doc/rdoc/classes/ESI/Tag/Invalidate.src/M000023.html +0 -19
- data/doc/rdoc/classes/ESI/Tag/Invalidate.src/M000024.html +0 -51
- data/doc/rdoc/classes/ESI/Tag/Invalidate.src/M000025.html +0 -19
- data/doc/rdoc/classes/ESI/Tag/Try.html +0 -154
- data/doc/rdoc/classes/ESI/Tag/Try.src/M000021.html +0 -38
- data/doc/rdoc/classes/ESI/Tag/Try.src/M000022.html +0 -18
- data/doc/rdoc/classes/MultiDirHandler.html +0 -198
- data/doc/rdoc/classes/MultiDirHandler.src/M000001.html +0 -20
- data/doc/rdoc/classes/MultiDirHandler.src/M000002.html +0 -28
- data/doc/rdoc/classes/MultiDirHandler.src/M000003.html +0 -22
- data/doc/rdoc/created.rid +0 -1
- data/doc/rdoc/files/COPYING.html +0 -167
- data/doc/rdoc/files/LICENSE.html +0 -605
- data/doc/rdoc/files/README.html +0 -361
- data/doc/rdoc/files/ext/esi/common_rl.html +0 -160
- data/doc/rdoc/files/ext/esi/esi_parser_c.html +0 -101
- data/doc/rdoc/files/ext/esi/parser_c.html +0 -101
- data/doc/rdoc/files/ext/esi/parser_h.html +0 -101
- data/doc/rdoc/files/ext/esi/parser_rl.html +0 -867
- data/doc/rdoc/files/ext/esi/test/test_c.html +0 -101
- data/doc/rdoc/files/lib/esi/cache_rb.html +0 -120
- data/doc/rdoc/files/lib/esi/config_rb.html +0 -115
- data/doc/rdoc/files/lib/esi/dispatcher_rb.html +0 -110
- data/doc/rdoc/files/lib/esi/invalidator_rb.html +0 -114
- data/doc/rdoc/files/lib/esi/logger_rb.html +0 -108
- data/doc/rdoc/files/lib/esi/parser_rb.html +0 -120
- data/doc/rdoc/files/lib/esi/processor_rb.html +0 -115
- data/doc/rdoc/files/lib/esi/proxy_rb.html +0 -123
- data/doc/rdoc/files/lib/esi/rack_adapter_rb.html +0 -117
- data/doc/rdoc/files/lib/esi/response_rb.html +0 -116
- data/doc/rdoc/files/lib/esi/router_rb.html +0 -107
- data/doc/rdoc/files/lib/esi/tag/attempt_rb.html +0 -114
- data/doc/rdoc/files/lib/esi/tag/base_rb.html +0 -114
- data/doc/rdoc/files/lib/esi/tag/container_rb.html +0 -115
- data/doc/rdoc/files/lib/esi/tag/except_rb.html +0 -114
- data/doc/rdoc/files/lib/esi/tag/include_rb.html +0 -116
- data/doc/rdoc/files/lib/esi/tag/invalidate_rb.html +0 -115
- data/doc/rdoc/files/lib/esi/tag/try_rb.html +0 -115
- data/doc/rdoc/files/lib/esi/version_rb.html +0 -101
- data/doc/rdoc/files/lib/multi_dirhandler_rb.html +0 -109
- data/doc/rdoc/fr_class_index.html +0 -57
- data/doc/rdoc/fr_file_index.html +0 -55
- data/doc/rdoc/fr_method_index.html +0 -139
- data/doc/rdoc/index.html +0 -24
- data/doc/rdoc/rdoc-style.css +0 -208
data/doc/rdoc/files/README.html
DELETED
|
@@ -1,361 +0,0 @@
|
|
|
1
|
-
<?xml version="1.0" encoding="iso-8859-1"?>
|
|
2
|
-
<!DOCTYPE html
|
|
3
|
-
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
|
4
|
-
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
|
5
|
-
|
|
6
|
-
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
|
7
|
-
<head>
|
|
8
|
-
<title>File: README</title>
|
|
9
|
-
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
|
|
10
|
-
<meta http-equiv="Content-Script-Type" content="text/javascript" />
|
|
11
|
-
<link rel="stylesheet" href=".././rdoc-style.css" type="text/css" media="screen" />
|
|
12
|
-
<script type="text/javascript">
|
|
13
|
-
// <![CDATA[
|
|
14
|
-
|
|
15
|
-
function popupCode( url ) {
|
|
16
|
-
window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
function toggleCode( id ) {
|
|
20
|
-
if ( document.getElementById )
|
|
21
|
-
elem = document.getElementById( id );
|
|
22
|
-
else if ( document.all )
|
|
23
|
-
elem = eval( "document.all." + id );
|
|
24
|
-
else
|
|
25
|
-
return false;
|
|
26
|
-
|
|
27
|
-
elemStyle = elem.style;
|
|
28
|
-
|
|
29
|
-
if ( elemStyle.display != "block" ) {
|
|
30
|
-
elemStyle.display = "block"
|
|
31
|
-
} else {
|
|
32
|
-
elemStyle.display = "none"
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
return true;
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
// Make codeblocks hidden by default
|
|
39
|
-
document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
|
|
40
|
-
|
|
41
|
-
// ]]>
|
|
42
|
-
</script>
|
|
43
|
-
|
|
44
|
-
</head>
|
|
45
|
-
<body>
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
<div id="fileHeader">
|
|
50
|
-
<h1>README</h1>
|
|
51
|
-
<table class="header-table">
|
|
52
|
-
<tr class="top-aligned-row">
|
|
53
|
-
<td><strong>Path:</strong></td>
|
|
54
|
-
<td>README
|
|
55
|
-
</td>
|
|
56
|
-
</tr>
|
|
57
|
-
<tr class="top-aligned-row">
|
|
58
|
-
<td><strong>Last Update:</strong></td>
|
|
59
|
-
<td>Mon Jun 23 15:57:40 -0400 2008</td>
|
|
60
|
-
</tr>
|
|
61
|
-
</table>
|
|
62
|
-
</div>
|
|
63
|
-
<!-- banner header -->
|
|
64
|
-
|
|
65
|
-
<div id="bodyContent">
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
<div id="contextContent">
|
|
70
|
-
|
|
71
|
-
<div id="description">
|
|
72
|
-
<h1>About</h1>
|
|
73
|
-
<p>
|
|
74
|
-
mongrel-esi is meant to make caching easier by distributing the cache
|
|
75
|
-
logic.
|
|
76
|
-
</p>
|
|
77
|
-
<p>
|
|
78
|
-
The idea is to represent each part of the page as a unique URL.
|
|
79
|
-
</p>
|
|
80
|
-
<p>
|
|
81
|
-
The whole page may not be cachable, but most of it probably is. The cache
|
|
82
|
-
server works by scanning the requested document for specific <esi:* tags
|
|
83
|
-
before servering the response. MongrelESI currently, only supports a few
|
|
84
|
-
basic instructions
|
|
85
|
-
</p>
|
|
86
|
-
<h1>Tags</h1>
|
|
87
|
-
<p>
|
|
88
|
-
esi:include:
|
|
89
|
-
</p>
|
|
90
|
-
<pre>
|
|
91
|
-
src - request path, response replaces esi:include tag
|
|
92
|
-
alt - if src is unavailable, use alt
|
|
93
|
-
timeout - how long to wait on the response
|
|
94
|
-
max-age - how long to cache the entity
|
|
95
|
-
onerror - whether continue on errors or trigger an exception
|
|
96
|
-
</pre>
|
|
97
|
-
<p>
|
|
98
|
-
esi:invalidate:
|
|
99
|
-
</p>
|
|
100
|
-
<pre>
|
|
101
|
-
encloses invalidation instructions.
|
|
102
|
-
these instructions currently only support basic invalidation
|
|
103
|
-
e.g.
|
|
104
|
-
<esi:invalidate output="no">
|
|
105
|
-
<?xml version="1.0"?>
|
|
106
|
-
<!DOCTYPE INVALIDATION SYSTEM "internal:///WCSinvalidation.dtd">
|
|
107
|
-
<INVALIDATION VERSION="WCS-1.1">
|
|
108
|
-
<OBJECT>
|
|
109
|
-
<BASICSELECTOR URI="/path/to/invalidate"/>
|
|
110
|
-
<ACTION REMOVALTTL="0"/>
|
|
111
|
-
<INFO VALUE="invalidating fragment test 1"/>
|
|
112
|
-
</OBJECT>
|
|
113
|
-
</INVALIDATION>
|
|
114
|
-
</esi:invalidate>
|
|
115
|
-
|
|
116
|
-
In the above example, only /path/to/invalidate will be invalidated, advanced regex style selectors are only support with ruby as the
|
|
117
|
-
cache storage.
|
|
118
|
-
</pre>
|
|
119
|
-
<p>
|
|
120
|
-
esi:try/esi:attempt/esi:except
|
|
121
|
-
</p>
|
|
122
|
-
<pre>
|
|
123
|
-
if any tags within the attempt block raise an exception and the onerror attribute is not equal to continue then
|
|
124
|
-
the server will fall back to the markup within the except block
|
|
125
|
-
</pre>
|
|
126
|
-
<h1>Proxy Config</h1>
|
|
127
|
-
<p>
|
|
128
|
-
mongrel-esi is a proxy server. To configure where requests should be
|
|
129
|
-
proxied modify the config/routes.yml file.
|
|
130
|
-
</p>
|
|
131
|
-
<p>
|
|
132
|
-
Here‘s an example:
|
|
133
|
-
</p>
|
|
134
|
-
<p>
|
|
135
|
-
ESI::Config.define(listeners) do|config|
|
|
136
|
-
</p>
|
|
137
|
-
<pre>
|
|
138
|
-
# define request path routing rules
|
|
139
|
-
config.routes do|s|
|
|
140
|
-
s.match( /^\/(content|samples|extras).*/ ) do|r|
|
|
141
|
-
r.servers = ['127.0.0.1:4000']
|
|
142
|
-
end
|
|
143
|
-
s.default do|r|
|
|
144
|
-
r.servers = ['127.0.0.1:3000']
|
|
145
|
-
end
|
|
146
|
-
end
|
|
147
|
-
</pre>
|
|
148
|
-
<p>
|
|
149
|
-
end
|
|
150
|
-
</p>
|
|
151
|
-
<p>
|
|
152
|
-
This sample configuration will route all urls starting with /content,
|
|
153
|
-
/samples, or /extras to the servers running at 127.0.0.1 on port 4000.
|
|
154
|
-
Everything else that matches the .* will be routed to the server running on
|
|
155
|
-
port 3000. Optionally the caching duration can be specificied explicity for
|
|
156
|
-
each host
|
|
157
|
-
</p>
|
|
158
|
-
<p>
|
|
159
|
-
s.default do|r|
|
|
160
|
-
</p>
|
|
161
|
-
<pre>
|
|
162
|
-
r.servers = ['127.0.0.1:3000']
|
|
163
|
-
r.cache_ttl = 300
|
|
164
|
-
</pre>
|
|
165
|
-
<p>
|
|
166
|
-
end
|
|
167
|
-
</p>
|
|
168
|
-
<p>
|
|
169
|
-
This example will cache all requests for 300 seconds, but normally you
|
|
170
|
-
would want to set the ttl on each individual fragment or include.
|
|
171
|
-
</p>
|
|
172
|
-
<p>
|
|
173
|
-
A typical include would look like the following:
|
|
174
|
-
</p>
|
|
175
|
-
<p>
|
|
176
|
-
<esi:include src="/content/1" max-age="600+600"/>
|
|
177
|
-
</p>
|
|
178
|
-
<p>
|
|
179
|
-
Requesting /home, might respond with the following:
|
|
180
|
-
</p>
|
|
181
|
-
<p>
|
|
182
|
-
<html> <head><title>Your Page</title> </head>
|
|
183
|
-
<body> <div class="header"><esi:include
|
|
184
|
-
src="/content/1 max-age="600+600"/></div>
|
|
185
|
-
<div>Some content</div> <div>Some more
|
|
186
|
-
content</div> </body> </html>
|
|
187
|
-
</p>
|
|
188
|
-
<p>
|
|
189
|
-
If the uri is not already cached, the cache server will request /content/1,
|
|
190
|
-
which will respond with:
|
|
191
|
-
</p>
|
|
192
|
-
<p>
|
|
193
|
-
<div>hello User42</div>
|
|
194
|
-
</p>
|
|
195
|
-
<p>
|
|
196
|
-
And finally, mongrel-esi will respond to the original client request with
|
|
197
|
-
the combined documents: <html> <head><title>Your
|
|
198
|
-
Page</title> </head> <body> <div
|
|
199
|
-
class="header"><div>hello User42</div></div>
|
|
200
|
-
<div>Some content</div> <div>Some more
|
|
201
|
-
content</div> </body> </html>
|
|
202
|
-
</p>
|
|
203
|
-
<h2>Integrating with your applications</h2>
|
|
204
|
-
<p>
|
|
205
|
-
mongrel-esi was built to support integrating lots of applications together.
|
|
206
|
-
</p>
|
|
207
|
-
<p>
|
|
208
|
-
Primarily, you‘ll want to integrate by having one base application
|
|
209
|
-
and many tiny applications that surface within your primary application. In
|
|
210
|
-
the rails sense think components. In a bigger sense think multiple
|
|
211
|
-
application technologies all integrating into the same application. Imagine
|
|
212
|
-
a java application returning up to the minute chat conversations in one
|
|
213
|
-
part of the page, while rails delivers a reliable listing of current forum
|
|
214
|
-
discussion, and maybe a python presense indicator for forum posts…
|
|
215
|
-
</p>
|
|
216
|
-
<p>
|
|
217
|
-
One thing to keep in mind is mongrel-esi is a proxy server. This means for
|
|
218
|
-
each request it needs to know where to route the requests. To support this
|
|
219
|
-
config.rb can express any regex to match a url and determine where a
|
|
220
|
-
request should be forwarded as well as defining a default route.
|
|
221
|
-
</p>
|
|
222
|
-
<p>
|
|
223
|
-
It is also sometimes convenient to allow multiple applications to store or
|
|
224
|
-
house static content. For this to work mongrel-esi needs to know in what
|
|
225
|
-
directories to search for static files. This can be done by using the <a
|
|
226
|
-
href="../classes/MultiDirHandler.html">MultiDirHandler</a> (see
|
|
227
|
-
rev-config.rb)
|
|
228
|
-
</p>
|
|
229
|
-
<h2>Supported Features of ESI</h2>
|
|
230
|
-
<p>
|
|
231
|
-
From [<a href="http://www.w3.org/TR/esi-lang">www.w3.org/TR/esi-lang</a>
|
|
232
|
-
esi-lang]
|
|
233
|
-
</p>
|
|
234
|
-
<p>
|
|
235
|
-
mongrel-esi supports basic include, exception handling and invalidation. It
|
|
236
|
-
does not include support for Variable or Conditional processing. It does
|
|
237
|
-
have suppport for COOKIE variables. (e.g. $(HTTP_COOKIE{name}) will be
|
|
238
|
-
replaced with the value of the cookie, name)
|
|
239
|
-
</p>
|
|
240
|
-
<p>
|
|
241
|
-
+ Inclusion - ESI can compose pages by assembling included content, which
|
|
242
|
-
is fetched from the network.
|
|
243
|
-
</p>
|
|
244
|
-
<pre>
|
|
245
|
-
This allows each such fragment to have its own metadata (e.g., cacheability and handling information) seperately associated.
|
|
246
|
-
</pre>
|
|
247
|
-
<ul>
|
|
248
|
-
<li>Variable support - ESI 1.0 supports the use of variables based on HTTP
|
|
249
|
-
request attributes in a manner
|
|
250
|
-
|
|
251
|
-
<pre>
|
|
252
|
-
reminiscent of the Common Gateway Interface. These variables can be used by ESI statements or written directly into the processed markup.
|
|
253
|
-
</pre>
|
|
254
|
-
</li>
|
|
255
|
-
<li>Conditional processing - ESI allows conditional logic with Boolean
|
|
256
|
-
comparisons to be used to influence how a template is processed.
|
|
257
|
-
|
|
258
|
-
</li>
|
|
259
|
-
</ul>
|
|
260
|
-
<p>
|
|
261
|
-
+ Exception and error handling - ESI provides for specification of
|
|
262
|
-
alternate and default resources in a number of situations.
|
|
263
|
-
</p>
|
|
264
|
-
<h2>HTTP Readings</h2>
|
|
265
|
-
<ul>
|
|
266
|
-
<li><a
|
|
267
|
-
href="http://www.jmarshall.com/easy/http">www.jmarshall.com/easy/http</a>/
|
|
268
|
-
|
|
269
|
-
</li>
|
|
270
|
-
</ul>
|
|
271
|
-
<h2>Adding New Features and Bug Fixing</h2>
|
|
272
|
-
<p>
|
|
273
|
-
Before adding a new feature or bug fix, it‘s important to add a test
|
|
274
|
-
to verify the behavior.
|
|
275
|
-
</p>
|
|
276
|
-
<p>
|
|
277
|
-
Also, help out by keeping the Changelog updated with new features and major
|
|
278
|
-
bug fixes
|
|
279
|
-
</p>
|
|
280
|
-
<h2>Future ideas of improving integration</h2>
|
|
281
|
-
<p>
|
|
282
|
-
NOTE: this is a work in progress, below is how I‘d like to integrate
|
|
283
|
-
with rails in the future
|
|
284
|
-
</p>
|
|
285
|
-
<p>
|
|
286
|
-
cd to/path/to/your/primary/rails/app
|
|
287
|
-
</p>
|
|
288
|
-
<p>
|
|
289
|
-
mongrel_esi add . —default mongrel_esi add
|
|
290
|
-
path/to/your/rails/secondary_app2 mongrel_esi add
|
|
291
|
-
path/to/your/rails/secondary_app3 mongrel_esi add
|
|
292
|
-
path/to/your/rails/secondary_app4
|
|
293
|
-
</p>
|
|
294
|
-
<p>
|
|
295
|
-
mongrel_esi start
|
|
296
|
-
</p>
|
|
297
|
-
<pre>
|
|
298
|
-
- starts up mongrel in each of the applications
|
|
299
|
-
</pre>
|
|
300
|
-
<h2>Credits ==</h2>
|
|
301
|
-
<p>
|
|
302
|
-
Support:
|
|
303
|
-
</p>
|
|
304
|
-
<pre>
|
|
305
|
-
Zed A. Shaw -- For writing [http://mongrel.rubyforge.org/ mongrel]
|
|
306
|
-
Adrian D. Thurston -- For writing [http://www.cs.queensu.ca/~thurston/ragel/ ragel]
|
|
307
|
-
|
|
308
|
-
The [http://www.ruby-lang.org/ ruby] community, for all their insights and help
|
|
309
|
-
</pre>
|
|
310
|
-
<p>
|
|
311
|
-
Author:
|
|
312
|
-
</p>
|
|
313
|
-
<pre>
|
|
314
|
-
Todd Fisher
|
|
315
|
-
</pre>
|
|
316
|
-
<p>
|
|
317
|
-
Co-Authors:
|
|
318
|
-
</p>
|
|
319
|
-
<pre>
|
|
320
|
-
Aaron Batalion -- Design ideas and integrating with Rails, fragment_fu. Ragel advocate
|
|
321
|
-
Richard Kilmer -- Thread saftey dispatcher, production ready
|
|
322
|
-
Adam Bair -- Writing the initial testing framework and logger.
|
|
323
|
-
Jeff Damick -- Writing the initial configuration.
|
|
324
|
-
</pre>
|
|
325
|
-
<p>
|
|
326
|
-
And of course thanks to everyone in ruby-lang for putting up with my
|
|
327
|
-
questions MenTaLguY for the great help in making good use of ruby
|
|
328
|
-
</p>
|
|
329
|
-
|
|
330
|
-
</div>
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
</div>
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
</div>
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
<!-- if includes -->
|
|
340
|
-
|
|
341
|
-
<div id="section">
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
<!-- if method_list -->
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
</div>
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
<div id="validator-badges">
|
|
357
|
-
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
|
|
358
|
-
</div>
|
|
359
|
-
|
|
360
|
-
</body>
|
|
361
|
-
</html>
|
|
@@ -1,160 +0,0 @@
|
|
|
1
|
-
<?xml version="1.0" encoding="iso-8859-1"?>
|
|
2
|
-
<!DOCTYPE html
|
|
3
|
-
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
|
4
|
-
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
|
5
|
-
|
|
6
|
-
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
|
7
|
-
<head>
|
|
8
|
-
<title>File: common.rl</title>
|
|
9
|
-
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
|
|
10
|
-
<meta http-equiv="Content-Script-Type" content="text/javascript" />
|
|
11
|
-
<link rel="stylesheet" href="../../.././rdoc-style.css" type="text/css" media="screen" />
|
|
12
|
-
<script type="text/javascript">
|
|
13
|
-
// <![CDATA[
|
|
14
|
-
|
|
15
|
-
function popupCode( url ) {
|
|
16
|
-
window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
function toggleCode( id ) {
|
|
20
|
-
if ( document.getElementById )
|
|
21
|
-
elem = document.getElementById( id );
|
|
22
|
-
else if ( document.all )
|
|
23
|
-
elem = eval( "document.all." + id );
|
|
24
|
-
else
|
|
25
|
-
return false;
|
|
26
|
-
|
|
27
|
-
elemStyle = elem.style;
|
|
28
|
-
|
|
29
|
-
if ( elemStyle.display != "block" ) {
|
|
30
|
-
elemStyle.display = "block"
|
|
31
|
-
} else {
|
|
32
|
-
elemStyle.display = "none"
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
return true;
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
// Make codeblocks hidden by default
|
|
39
|
-
document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
|
|
40
|
-
|
|
41
|
-
// ]]>
|
|
42
|
-
</script>
|
|
43
|
-
|
|
44
|
-
</head>
|
|
45
|
-
<body>
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
<div id="fileHeader">
|
|
50
|
-
<h1>common.rl</h1>
|
|
51
|
-
<table class="header-table">
|
|
52
|
-
<tr class="top-aligned-row">
|
|
53
|
-
<td><strong>Path:</strong></td>
|
|
54
|
-
<td>ext/esi/common.rl
|
|
55
|
-
</td>
|
|
56
|
-
</tr>
|
|
57
|
-
<tr class="top-aligned-row">
|
|
58
|
-
<td><strong>Last Update:</strong></td>
|
|
59
|
-
<td>Mon Jun 23 15:57:37 -0400 2008</td>
|
|
60
|
-
</tr>
|
|
61
|
-
</table>
|
|
62
|
-
</div>
|
|
63
|
-
<!-- banner header -->
|
|
64
|
-
|
|
65
|
-
<div id="bodyContent">
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
<div id="contextContent">
|
|
70
|
-
|
|
71
|
-
<div id="description">
|
|
72
|
-
<p>
|
|
73
|
-
/**
|
|
74
|
-
</p>
|
|
75
|
-
<pre>
|
|
76
|
-
* Copyright (c) 2008 Todd A. Fisher
|
|
77
|
-
* see LICENSE
|
|
78
|
-
*/
|
|
79
|
-
</pre>
|
|
80
|
-
<p>
|
|
81
|
-
%%{
|
|
82
|
-
</p>
|
|
83
|
-
<pre>
|
|
84
|
-
machine esi_common_parser;
|
|
85
|
-
|
|
86
|
-
# valid attribute key characters
|
|
87
|
-
attr_key = [a-zA-Z_\-]+ [a-zA-Z_\-0-9]*;
|
|
88
|
-
|
|
89
|
-
# attribute values can be contained within either double or single quotes, when single quoted then double quotes are valid
|
|
90
|
-
# when double quoted then single quotes are valid
|
|
91
|
-
attr_valueq1 = ('"' ("\\\""| [^"])* '"');
|
|
92
|
-
attr_valueq2 = ("'" ("\\\'"| [^'])* "'");
|
|
93
|
-
|
|
94
|
-
# an attribute value is either single or double quoted
|
|
95
|
-
attr_value = ( attr_valueq1 | attr_valueq2 );
|
|
96
|
-
|
|
97
|
-
# inline tags e.g. <esi:comment text='some useless text'/> or <esi:include src='/foo/'/>, etc...
|
|
98
|
-
# block tags e.g. <esi:try><esi:attempt></esi:attempt></esi:try>
|
|
99
|
-
# NOTE: not verifying the tag nesting
|
|
100
|
-
esi_tags = (
|
|
101
|
-
start: (
|
|
102
|
-
# first match block start tag with no attributes
|
|
103
|
-
'<esi:' [a-z]+ '>' @block_start_tag -> final |
|
|
104
|
-
# next match either an inline or block tag with attributes
|
|
105
|
-
'<esi:' [a-z]+ space @see_start_tag -> start_attribute |
|
|
106
|
-
# finally match a closing block tag
|
|
107
|
-
'</esi:' [a-z]+ '>' @block_end_tag
|
|
108
|
-
),
|
|
109
|
-
start_attribute: (
|
|
110
|
-
# match the attribute key up to the begining = allowing for arbitrary whitespace before the start of the key
|
|
111
|
-
space* attr_key '=' @see_attribute_key -> end_attribute |
|
|
112
|
-
# match the end of an inline tag, triggers start and end callbacks
|
|
113
|
-
space* '/>' @see_end_tag -> final |
|
|
114
|
-
# matching the end of a block tag, triggers start callback
|
|
115
|
-
'>' @see_block_start_with_attributes -> final
|
|
116
|
-
),
|
|
117
|
-
end_attribute: (
|
|
118
|
-
# match the attribute value and return to matching attribute start
|
|
119
|
-
space* attr_value @see_attribute_value -> start_attribute
|
|
120
|
-
)
|
|
121
|
-
) >begin %finish;
|
|
122
|
-
|
|
123
|
-
main := ((/.*/)? @echo (esi_tags) )*;
|
|
124
|
-
</pre>
|
|
125
|
-
<p>
|
|
126
|
-
}%%
|
|
127
|
-
</p>
|
|
128
|
-
|
|
129
|
-
</div>
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
</div>
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
</div>
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
<!-- if includes -->
|
|
139
|
-
|
|
140
|
-
<div id="section">
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
<!-- if method_list -->
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
</div>
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
<div id="validator-badges">
|
|
156
|
-
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
|
|
157
|
-
</div>
|
|
158
|
-
|
|
159
|
-
</body>
|
|
160
|
-
</html>
|