mongrel_esi 0.5.2 → 0.5.4
Sign up to get free protection for your applications and to get access to all the features.
- 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
@@ -1,26 +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>
|
7
|
-
<head>
|
8
|
-
<title>new (ESI::Processor)</title>
|
9
|
-
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
|
10
|
-
<link rel="stylesheet" href="../../.././rdoc-style.css" type="text/css" media="screen" />
|
11
|
-
</head>
|
12
|
-
<body class="standalone-code">
|
13
|
-
<pre> <span class="ruby-comment cmt"># File lib/esi/processor.rb, line 11</span>
|
14
|
-
11: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">initialize</span>( <span class="ruby-identifier">config</span>, <span class="ruby-identifier">router</span>, <span class="ruby-identifier">cache_buffer</span> = <span class="ruby-keyword kw">nil</span> )
|
15
|
-
12: <span class="ruby-ivar">@config</span> = <span class="ruby-identifier">config</span>
|
16
|
-
13: <span class="ruby-ivar">@router</span> = <span class="ruby-identifier">router</span>
|
17
|
-
14: <span class="ruby-ivar">@chunk_count</span> = <span class="ruby-value">0</span>
|
18
|
-
15: <span class="ruby-ivar">@chunk_size</span> = <span class="ruby-ivar">@config</span>[<span class="ruby-identifier">:chunk_size</span>] <span class="ruby-operator">||</span> <span class="ruby-value">4096</span>
|
19
|
-
16: <span class="ruby-ivar">@bytes_sent</span> = <span class="ruby-value">0</span>
|
20
|
-
17: <span class="ruby-ivar">@max_depth</span> = <span class="ruby-ivar">@config</span>[<span class="ruby-identifier">:max_depth</span>] <span class="ruby-operator">||</span> <span class="ruby-value">3</span>
|
21
|
-
18: <span class="ruby-ivar">@chunk_buffer</span> = <span class="ruby-constant">StringIO</span>.<span class="ruby-identifier">new</span> <span class="ruby-comment cmt"># when buffer reaches chunk_size write to the http_response socket</span>
|
22
|
-
19: <span class="ruby-ivar">@parser</span> = <span class="ruby-constant">ESI</span><span class="ruby-operator">::</span><span class="ruby-constant">Parser</span>.<span class="ruby-identifier">new</span>( <span class="ruby-ivar">@chunk_buffer</span>, <span class="ruby-ivar">@router</span>, <span class="ruby-ivar">@config</span>.<span class="ruby-identifier">cache</span>, <span class="ruby-ivar">@max_depth</span> )
|
23
|
-
20: <span class="ruby-ivar">@cache_buffer</span> = <span class="ruby-identifier">cache_buffer</span>
|
24
|
-
21: <span class="ruby-keyword kw">end</span></pre>
|
25
|
-
</body>
|
26
|
-
</html>
|
@@ -1,44 +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>
|
7
|
-
<head>
|
8
|
-
<title>send_body (ESI::Processor)</title>
|
9
|
-
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
|
10
|
-
<link rel="stylesheet" href="../../.././rdoc-style.css" type="text/css" media="screen" />
|
11
|
-
</head>
|
12
|
-
<body class="standalone-code">
|
13
|
-
<pre> <span class="ruby-comment cmt"># File lib/esi/processor.rb, line 23</span>
|
14
|
-
23: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">send_body</span>( <span class="ruby-identifier">http_request</span>, <span class="ruby-identifier">params</span>, <span class="ruby-identifier">http_response</span>, <span class="ruby-identifier">proxy_response</span> )
|
15
|
-
24:
|
16
|
-
25: <span class="ruby-ivar">@http_response</span> = <span class="ruby-identifier">http_response</span>
|
17
|
-
26:
|
18
|
-
27: <span class="ruby-comment cmt"># prepare the parser given the raw request params and the preprocessed request params</span>
|
19
|
-
28: <span class="ruby-ivar">@parser</span>.<span class="ruby-identifier">prepare</span>( <span class="ruby-identifier">http_request</span>.<span class="ruby-identifier">params</span>, <span class="ruby-identifier">params</span> )
|
20
|
-
29:
|
21
|
-
30: <span class="ruby-comment cmt"># feed data to the parser</span>
|
22
|
-
31: <span class="ruby-identifier">proxy_response</span>.<span class="ruby-identifier">read_body</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">data</span><span class="ruby-operator">|</span>
|
23
|
-
32: <span class="ruby-ivar">@parser</span>.<span class="ruby-identifier">process</span> <span class="ruby-identifier">data</span>
|
24
|
-
33: <span class="ruby-ivar">@cache_buffer</span> <span class="ruby-operator"><<</span> <span class="ruby-identifier">data</span> <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@cache_buffer</span>
|
25
|
-
34: <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@chunk_buffer</span>.<span class="ruby-identifier">size</span> <span class="ruby-operator">></span> <span class="ruby-ivar">@chunk_size</span>
|
26
|
-
35: <span class="ruby-identifier">send_chunk</span>
|
27
|
-
36: <span class="ruby-ivar">@chunk_buffer</span> = <span class="ruby-constant">StringIO</span>.<span class="ruby-identifier">new</span>
|
28
|
-
37: <span class="ruby-ivar">@parser</span>.<span class="ruby-identifier">response</span>.<span class="ruby-identifier">update_output</span>( <span class="ruby-ivar">@chunk_buffer</span> )
|
29
|
-
38: <span class="ruby-keyword kw">end</span>
|
30
|
-
39: <span class="ruby-keyword kw">end</span>
|
31
|
-
40:
|
32
|
-
41: <span class="ruby-ivar">@parser</span>.<span class="ruby-identifier">finish</span>
|
33
|
-
42:
|
34
|
-
43: <span class="ruby-identifier">send_chunk</span>
|
35
|
-
44:
|
36
|
-
45: [<span class="ruby-ivar">@chunk_count</span>,<span class="ruby-ivar">@bytes_sent</span>]
|
37
|
-
46: <span class="ruby-keyword kw">rescue</span> =<span class="ruby-operator">></span> <span class="ruby-identifier">e</span>
|
38
|
-
47: <span class="ruby-constant">STDERR</span>.<span class="ruby-identifier">puts</span> <span class="ruby-node">"\n#{e.message}: #{e.backtrace.join("\n")}\n"</span>
|
39
|
-
48: <span class="ruby-keyword kw">ensure</span>
|
40
|
-
49: <span class="ruby-identifier">http_response</span>.<span class="ruby-identifier">write</span>( <span class="ruby-value str">"0\r\n\r\n"</span> )
|
41
|
-
50: <span class="ruby-identifier">http_response</span>.<span class="ruby-identifier">done</span> = <span class="ruby-keyword kw">true</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">http_response</span>.<span class="ruby-identifier">respond_to?</span>(<span class="ruby-identifier">:done</span>)
|
42
|
-
51: <span class="ruby-keyword kw">end</span></pre>
|
43
|
-
</body>
|
44
|
-
</html>
|
@@ -1,26 +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>
|
7
|
-
<head>
|
8
|
-
<title>send_chunk (ESI::Processor)</title>
|
9
|
-
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
|
10
|
-
<link rel="stylesheet" href="../../.././rdoc-style.css" type="text/css" media="screen" />
|
11
|
-
</head>
|
12
|
-
<body class="standalone-code">
|
13
|
-
<pre> <span class="ruby-comment cmt"># File lib/esi/processor.rb, line 53</span>
|
14
|
-
53: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">send_chunk</span>
|
15
|
-
54: <span class="ruby-ivar">@chunk_buffer</span>.<span class="ruby-identifier">rewind</span>
|
16
|
-
55: <span class="ruby-identifier">size</span> = <span class="ruby-ivar">@chunk_buffer</span>.<span class="ruby-identifier">size</span>
|
17
|
-
56: <span class="ruby-identifier">chunk_header</span> = <span class="ruby-node">"#{"%x" % size}"</span> <span class="ruby-operator">+</span> <span class="ruby-constant">Mongrel</span><span class="ruby-operator">::</span><span class="ruby-constant">Const</span><span class="ruby-operator">::</span><span class="ruby-constant">LINE_END</span>
|
18
|
-
57: <span class="ruby-comment cmt">#print chunk_header</span>
|
19
|
-
58: <span class="ruby-ivar">@http_response</span>.<span class="ruby-identifier">write</span>( <span class="ruby-identifier">chunk_header</span> ) <span class="ruby-comment cmt"># write the chunk size</span>
|
20
|
-
59: <span class="ruby-ivar">@http_response</span>.<span class="ruby-identifier">write</span>( <span class="ruby-ivar">@chunk_buffer</span>.<span class="ruby-identifier">read</span> <span class="ruby-operator">+</span> <span class="ruby-constant">Mongrel</span><span class="ruby-operator">::</span><span class="ruby-constant">Const</span><span class="ruby-operator">::</span><span class="ruby-constant">LINE_END</span> ) <span class="ruby-comment cmt"># write the chunk</span>
|
21
|
-
60: <span class="ruby-ivar">@bytes_sent</span> <span class="ruby-operator">+=</span> <span class="ruby-identifier">size</span>
|
22
|
-
61:
|
23
|
-
62: <span class="ruby-ivar">@chunk_count</span> <span class="ruby-operator">+=</span> <span class="ruby-value">1</span>
|
24
|
-
63: <span class="ruby-keyword kw">end</span></pre>
|
25
|
-
</body>
|
26
|
-
</html>
|
@@ -1,304 +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>Class: ESI::Proxy</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="classHeader">
|
50
|
-
<table class="header-table">
|
51
|
-
<tr class="top-aligned-row">
|
52
|
-
<td><strong>Class</strong></td>
|
53
|
-
<td class="class-name-in-header">ESI::Proxy</td>
|
54
|
-
</tr>
|
55
|
-
<tr class="top-aligned-row">
|
56
|
-
<td><strong>In:</strong></td>
|
57
|
-
<td>
|
58
|
-
<a href="../../files/lib/esi/proxy_rb.html">
|
59
|
-
lib/esi/proxy.rb
|
60
|
-
</a>
|
61
|
-
<br />
|
62
|
-
</td>
|
63
|
-
</tr>
|
64
|
-
|
65
|
-
<tr class="top-aligned-row">
|
66
|
-
<td><strong>Parent:</strong></td>
|
67
|
-
<td>
|
68
|
-
Object
|
69
|
-
</td>
|
70
|
-
</tr>
|
71
|
-
</table>
|
72
|
-
</div>
|
73
|
-
<!-- banner header -->
|
74
|
-
|
75
|
-
<div id="bodyContent">
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
<div id="contextContent">
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
</div>
|
84
|
-
|
85
|
-
<div id="method-list">
|
86
|
-
<h3 class="section-bar">Methods</h3>
|
87
|
-
|
88
|
-
<div class="name-list">
|
89
|
-
<a href="#M000079">copy_headers</a>
|
90
|
-
<a href="#M000078">http_params</a>
|
91
|
-
<a href="#M000071">new</a>
|
92
|
-
<a href="#M000072">process</a>
|
93
|
-
<a href="#M000074">proxy_direct</a>
|
94
|
-
<a href="#M000075">proxy_filter_esi</a>
|
95
|
-
<a href="#M000077">read_status</a>
|
96
|
-
<a href="#M000076">send_esi_buffered</a>
|
97
|
-
<a href="#M000073">send_response</a>
|
98
|
-
</div>
|
99
|
-
</div>
|
100
|
-
|
101
|
-
</div>
|
102
|
-
|
103
|
-
|
104
|
-
<!-- if includes -->
|
105
|
-
<div id="includes">
|
106
|
-
<h3 class="section-bar">Included Modules</h3>
|
107
|
-
|
108
|
-
<div id="includes-list">
|
109
|
-
<span class="include-name"><a href="Log.html">ESI::Log</a></span>
|
110
|
-
</div>
|
111
|
-
</div>
|
112
|
-
|
113
|
-
<div id="section">
|
114
|
-
|
115
|
-
|
116
|
-
<div id="constants-list">
|
117
|
-
<h3 class="section-bar">Constants</h3>
|
118
|
-
|
119
|
-
<div class="name-list">
|
120
|
-
<table summary="Constants">
|
121
|
-
<tr class="top-aligned-row context-row">
|
122
|
-
<td class="context-item-name">SERVER</td>
|
123
|
-
<td>=</td>
|
124
|
-
<td class="context-item-value">"mongrel-esi/#{ESI::VERSION::STRING}"</td>
|
125
|
-
</tr>
|
126
|
-
</table>
|
127
|
-
</div>
|
128
|
-
</div>
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
<div id="attribute-list">
|
133
|
-
<h3 class="section-bar">Attributes</h3>
|
134
|
-
|
135
|
-
<div class="name-list">
|
136
|
-
<table>
|
137
|
-
<tr class="top-aligned-row context-row">
|
138
|
-
<td class="context-item-name">cache_buffer</td>
|
139
|
-
<td class="context-item-value"> [R] </td>
|
140
|
-
<td class="context-item-desc"></td>
|
141
|
-
</tr>
|
142
|
-
<tr class="top-aligned-row context-row">
|
143
|
-
<td class="context-item-name">config</td>
|
144
|
-
<td class="context-item-value"> [R] </td>
|
145
|
-
<td class="context-item-desc"></td>
|
146
|
-
</tr>
|
147
|
-
<tr class="top-aligned-row context-row">
|
148
|
-
<td class="context-item-name">router</td>
|
149
|
-
<td class="context-item-value"> [R] </td>
|
150
|
-
<td class="context-item-desc"></td>
|
151
|
-
</tr>
|
152
|
-
</table>
|
153
|
-
</div>
|
154
|
-
</div>
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
<!-- if method_list -->
|
159
|
-
<div id="methods">
|
160
|
-
<h3 class="section-bar">Public Class methods</h3>
|
161
|
-
|
162
|
-
<div id="method-M000071" class="method-detail">
|
163
|
-
<a name="M000071"></a>
|
164
|
-
|
165
|
-
<div class="method-heading">
|
166
|
-
<a href="Proxy.src/M000071.html" target="Code" class="method-signature"
|
167
|
-
onclick="popupCode('Proxy.src/M000071.html');return false;">
|
168
|
-
<span class="method-name">new</span><span class="method-args">( config )</span>
|
169
|
-
</a>
|
170
|
-
</div>
|
171
|
-
|
172
|
-
<div class="method-description">
|
173
|
-
</div>
|
174
|
-
</div>
|
175
|
-
|
176
|
-
<h3 class="section-bar">Public Instance methods</h3>
|
177
|
-
|
178
|
-
<div id="method-M000072" class="method-detail">
|
179
|
-
<a name="M000072"></a>
|
180
|
-
|
181
|
-
<div class="method-heading">
|
182
|
-
<a href="Proxy.src/M000072.html" target="Code" class="method-signature"
|
183
|
-
onclick="popupCode('Proxy.src/M000072.html');return false;">
|
184
|
-
<span class="method-name">process</span><span class="method-args">(url, request, response)</span>
|
185
|
-
</a>
|
186
|
-
</div>
|
187
|
-
|
188
|
-
<div class="method-description">
|
189
|
-
</div>
|
190
|
-
</div>
|
191
|
-
|
192
|
-
<h3 class="section-bar">Protected Instance methods</h3>
|
193
|
-
|
194
|
-
<div id="method-M000079" class="method-detail">
|
195
|
-
<a name="M000079"></a>
|
196
|
-
|
197
|
-
<div class="method-heading">
|
198
|
-
<a href="Proxy.src/M000079.html" target="Code" class="method-signature"
|
199
|
-
onclick="popupCode('Proxy.src/M000079.html');return false;">
|
200
|
-
<span class="method-name">copy_headers</span><span class="method-args">(response)</span>
|
201
|
-
</a>
|
202
|
-
</div>
|
203
|
-
|
204
|
-
<div class="method-description">
|
205
|
-
</div>
|
206
|
-
</div>
|
207
|
-
|
208
|
-
<div id="method-M000078" class="method-detail">
|
209
|
-
<a name="M000078"></a>
|
210
|
-
|
211
|
-
<div class="method-heading">
|
212
|
-
<a href="Proxy.src/M000078.html" target="Code" class="method-signature"
|
213
|
-
onclick="popupCode('Proxy.src/M000078.html');return false;">
|
214
|
-
<span class="method-name">http_params</span><span class="method-args">(params)</span>
|
215
|
-
</a>
|
216
|
-
</div>
|
217
|
-
|
218
|
-
<div class="method-description">
|
219
|
-
</div>
|
220
|
-
</div>
|
221
|
-
|
222
|
-
<div id="method-M000074" class="method-detail">
|
223
|
-
<a name="M000074"></a>
|
224
|
-
|
225
|
-
<div class="method-heading">
|
226
|
-
<a href="Proxy.src/M000074.html" target="Code" class="method-signature"
|
227
|
-
onclick="popupCode('Proxy.src/M000074.html');return false;">
|
228
|
-
<span class="method-name">proxy_direct</span><span class="method-args">( http_response, proxy_response )</span>
|
229
|
-
</a>
|
230
|
-
</div>
|
231
|
-
|
232
|
-
<div class="method-description">
|
233
|
-
</div>
|
234
|
-
</div>
|
235
|
-
|
236
|
-
<div id="method-M000075" class="method-detail">
|
237
|
-
<a name="M000075"></a>
|
238
|
-
|
239
|
-
<div class="method-heading">
|
240
|
-
<a href="Proxy.src/M000075.html" target="Code" class="method-signature"
|
241
|
-
onclick="popupCode('Proxy.src/M000075.html');return false;">
|
242
|
-
<span class="method-name">proxy_filter_esi</span><span class="method-args">( http_request, http_response, http_params, proxy_response )</span>
|
243
|
-
</a>
|
244
|
-
</div>
|
245
|
-
|
246
|
-
<div class="method-description">
|
247
|
-
</div>
|
248
|
-
</div>
|
249
|
-
|
250
|
-
<div id="method-M000077" class="method-detail">
|
251
|
-
<a name="M000077"></a>
|
252
|
-
|
253
|
-
<div class="method-heading">
|
254
|
-
<a href="Proxy.src/M000077.html" target="Code" class="method-signature"
|
255
|
-
onclick="popupCode('Proxy.src/M000077.html');return false;">
|
256
|
-
<span class="method-name">read_status</span><span class="method-args">(response)</span>
|
257
|
-
</a>
|
258
|
-
</div>
|
259
|
-
|
260
|
-
<div class="method-description">
|
261
|
-
</div>
|
262
|
-
</div>
|
263
|
-
|
264
|
-
<div id="method-M000076" class="method-detail">
|
265
|
-
<a name="M000076"></a>
|
266
|
-
|
267
|
-
<div class="method-heading">
|
268
|
-
<a href="Proxy.src/M000076.html" target="Code" class="method-signature"
|
269
|
-
onclick="popupCode('Proxy.src/M000076.html');return false;">
|
270
|
-
<span class="method-name">send_esi_buffered</span><span class="method-args">( response, request, http_params, buffer )</span>
|
271
|
-
</a>
|
272
|
-
</div>
|
273
|
-
|
274
|
-
<div class="method-description">
|
275
|
-
</div>
|
276
|
-
</div>
|
277
|
-
|
278
|
-
<div id="method-M000073" class="method-detail">
|
279
|
-
<a name="M000073"></a>
|
280
|
-
|
281
|
-
<div class="method-heading">
|
282
|
-
<a href="Proxy.src/M000073.html" target="Code" class="method-signature"
|
283
|
-
onclick="popupCode('Proxy.src/M000073.html');return false;">
|
284
|
-
<span class="method-name">send_response</span><span class="method-args">( http_request, http_response, http_params, proxy_response )</span>
|
285
|
-
</a>
|
286
|
-
</div>
|
287
|
-
|
288
|
-
<div class="method-description">
|
289
|
-
</div>
|
290
|
-
</div>
|
291
|
-
|
292
|
-
|
293
|
-
</div>
|
294
|
-
|
295
|
-
|
296
|
-
</div>
|
297
|
-
|
298
|
-
|
299
|
-
<div id="validator-badges">
|
300
|
-
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
|
301
|
-
</div>
|
302
|
-
|
303
|
-
</body>
|
304
|
-
</html>
|
@@ -1,20 +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>
|
7
|
-
<head>
|
8
|
-
<title>new (ESI::Proxy)</title>
|
9
|
-
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
|
10
|
-
<link rel="stylesheet" href="../../.././rdoc-style.css" type="text/css" media="screen" />
|
11
|
-
</head>
|
12
|
-
<body class="standalone-code">
|
13
|
-
<pre> <span class="ruby-comment cmt"># File lib/esi/proxy.rb, line 21</span>
|
14
|
-
21: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">initialize</span>( <span class="ruby-identifier">config</span> )
|
15
|
-
22: <span class="ruby-ivar">@config</span> = <span class="ruby-identifier">config</span>
|
16
|
-
23: <span class="ruby-ivar">@router</span> = <span class="ruby-identifier">config</span>.<span class="ruby-identifier">router</span>
|
17
|
-
24: <span class="ruby-ivar">@cache_buffer</span> = <span class="ruby-keyword kw">nil</span>
|
18
|
-
25: <span class="ruby-keyword kw">end</span></pre>
|
19
|
-
</body>
|
20
|
-
</html>
|
@@ -1,63 +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>
|
7
|
-
<head>
|
8
|
-
<title>process (ESI::Proxy)</title>
|
9
|
-
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
|
10
|
-
<link rel="stylesheet" href="../../.././rdoc-style.css" type="text/css" media="screen" />
|
11
|
-
</head>
|
12
|
-
<body class="standalone-code">
|
13
|
-
<pre> <span class="ruby-comment cmt"># File lib/esi/proxy.rb, line 27</span>
|
14
|
-
27: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">process</span>(<span class="ruby-identifier">url</span>, <span class="ruby-identifier">request</span>, <span class="ruby-identifier">response</span>)
|
15
|
-
28:
|
16
|
-
29: <span class="ruby-identifier">status</span> = <span class="ruby-value">200</span>
|
17
|
-
30:
|
18
|
-
31: <span class="ruby-identifier">http_params</span> = <span class="ruby-identifier">http_params</span>(<span class="ruby-identifier">request</span>.<span class="ruby-identifier">params</span>)
|
19
|
-
32:
|
20
|
-
33: <span class="ruby-identifier">chunk_count</span> = <span class="ruby-value">0</span>
|
21
|
-
34: <span class="ruby-identifier">bytes_sent</span> = <span class="ruby-value">0</span>
|
22
|
-
35: <span class="ruby-identifier">sent_from_cache</span> = <span class="ruby-keyword kw">false</span>
|
23
|
-
36: <span class="ruby-identifier">uri</span> = <span class="ruby-constant">URI</span>.<span class="ruby-identifier">parse</span>(<span class="ruby-identifier">url</span>)
|
24
|
-
37:
|
25
|
-
38: <span class="ruby-identifier">path_with_query</span> = <span class="ruby-identifier">uri</span>.<span class="ruby-identifier">query</span> <span class="ruby-value">? </span><span class="ruby-node">"#{uri.path}?#{uri.query}"</span> <span class="ruby-operator">:</span> <span class="ruby-identifier">uri</span>.<span class="ruby-identifier">path</span>
|
26
|
-
39:
|
27
|
-
40: <span class="ruby-comment cmt"># check if the origin is cached</span>
|
28
|
-
41: <span class="ruby-identifier">cached_page</span> = <span class="ruby-ivar">@config</span>.<span class="ruby-identifier">cache</span>.<span class="ruby-identifier">get</span>( <span class="ruby-identifier">path_with_query</span>, <span class="ruby-identifier">http_params</span> )
|
29
|
-
42: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">cached_page</span> <span class="ruby-keyword kw">and</span> <span class="ruby-identifier">cached_page</span>.<span class="ruby-identifier">valid?</span>
|
30
|
-
43: <span class="ruby-identifier">cache_buffer</span> = <span class="ruby-identifier">cached_page</span>.<span class="ruby-identifier">body</span>
|
31
|
-
44: <span class="ruby-identifier">head</span>, <span class="ruby-identifier">body</span> = <span class="ruby-identifier">cache_buffer</span>.<span class="ruby-identifier">split</span>(<span class="ruby-value str">"\r\n\r\n"</span>)
|
32
|
-
45: <span class="ruby-identifier">buffer</span> = <span class="ruby-constant">StringIO</span>.<span class="ruby-identifier">new</span>
|
33
|
-
46: <span class="ruby-identifier">bytes_sent</span> = <span class="ruby-identifier">send_esi_buffered</span>( <span class="ruby-identifier">buffer</span>, <span class="ruby-identifier">request</span>, <span class="ruby-identifier">http_params</span>, <span class="ruby-identifier">body</span> )
|
34
|
-
47: <span class="ruby-identifier">buffer</span>.<span class="ruby-identifier">rewind</span>
|
35
|
-
48: <span class="ruby-identifier">bytes_sent</span> = <span class="ruby-identifier">buffer</span>.<span class="ruby-identifier">size</span>
|
36
|
-
49: <span class="ruby-comment cmt">#puts bytes_sent.inspect</span>
|
37
|
-
50: <span class="ruby-identifier">head</span> = <span class="ruby-identifier">head</span>.<span class="ruby-identifier">sub</span>(<span class="ruby-regexp re">/Content-Length:.*$/</span>,<span class="ruby-node">"Content-Length: #{bytes_sent}"</span>)
|
38
|
-
51: <span class="ruby-comment cmt">#puts head</span>
|
39
|
-
52: <span class="ruby-identifier">response</span>.<span class="ruby-identifier">write</span> <span class="ruby-identifier">head</span>
|
40
|
-
53: <span class="ruby-identifier">response</span>.<span class="ruby-identifier">write</span> <span class="ruby-value str">"\r\n\r\n"</span>
|
41
|
-
54: <span class="ruby-identifier">response</span>.<span class="ruby-identifier">write</span> <span class="ruby-identifier">buffer</span>.<span class="ruby-identifier">read</span>
|
42
|
-
55: <span class="ruby-identifier">response</span>.<span class="ruby-identifier">done</span> = <span class="ruby-keyword kw">true</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">response</span>.<span class="ruby-identifier">respond_to?</span>(<span class="ruby-identifier">:done</span>)
|
43
|
-
56: <span class="ruby-identifier">sent_from_cache</span> = <span class="ruby-keyword kw">true</span>
|
44
|
-
57: <span class="ruby-keyword kw">else</span>
|
45
|
-
58: <span class="ruby-identifier">proxy_request</span> = (<span class="ruby-identifier">request</span>.<span class="ruby-identifier">params</span>[<span class="ruby-value str">"REQUEST_METHOD"</span>] <span class="ruby-operator">==</span> <span class="ruby-value str">"POST"</span>) <span class="ruby-operator">?</span>
|
46
|
-
59: <span class="ruby-constant">Net</span><span class="ruby-operator">::</span><span class="ruby-constant">HTTP</span><span class="ruby-operator">::</span><span class="ruby-constant">Post</span>.<span class="ruby-identifier">new</span>( <span class="ruby-identifier">path_with_query</span>, <span class="ruby-identifier">http_params</span> ) <span class="ruby-operator">:</span>
|
47
|
-
60: <span class="ruby-constant">Net</span><span class="ruby-operator">::</span><span class="ruby-constant">HTTP</span><span class="ruby-operator">::</span><span class="ruby-constant">Get</span>.<span class="ruby-identifier">new</span>( <span class="ruby-identifier">path_with_query</span>, <span class="ruby-identifier">http_params</span> )
|
48
|
-
61:
|
49
|
-
62: <span class="ruby-comment cmt"># open the conneciton up so we can start to stream the connection</span>
|
50
|
-
63: <span class="ruby-constant">Net</span><span class="ruby-operator">::</span><span class="ruby-constant">HTTP</span>.<span class="ruby-identifier">start</span>(<span class="ruby-identifier">uri</span>.<span class="ruby-identifier">host</span>, <span class="ruby-identifier">uri</span>.<span class="ruby-identifier">port</span>).<span class="ruby-identifier">request</span>(<span class="ruby-identifier">proxy_request</span>,<span class="ruby-identifier">request</span>.<span class="ruby-identifier">body</span>.<span class="ruby-identifier">read</span>) <span class="ruby-keyword kw">do</span><span class="ruby-operator">|</span><span class="ruby-identifier">proxy_response</span><span class="ruby-operator">|</span>
|
51
|
-
64: <span class="ruby-identifier">chunk_count</span>,<span class="ruby-identifier">bytes_sent</span> = <span class="ruby-identifier">send_response</span>( <span class="ruby-identifier">request</span>, <span class="ruby-identifier">response</span>, <span class="ruby-identifier">http_params</span>, <span class="ruby-identifier">proxy_response</span> )
|
52
|
-
65: <span class="ruby-keyword kw">end</span> <span class="ruby-comment cmt"># end request</span>
|
53
|
-
66:
|
54
|
-
67: <span class="ruby-keyword kw">if</span> <span class="ruby-operator">!</span><span class="ruby-ivar">@control</span>.<span class="ruby-identifier">nil?</span> <span class="ruby-keyword kw">and</span> <span class="ruby-operator">!</span><span class="ruby-ivar">@cache_buffer</span>.<span class="ruby-identifier">nil?</span> <span class="ruby-keyword kw">and</span> <span class="ruby-ivar">@control</span>[<span class="ruby-value str">'max-age'</span>].<span class="ruby-identifier">to_i</span> <span class="ruby-operator">></span> <span class="ruby-value">0</span> <span class="ruby-keyword kw">and</span> <span class="ruby-ivar">@cache_buffer</span>.<span class="ruby-identifier">size</span> <span class="ruby-operator">></span> <span class="ruby-value">0</span>
|
55
|
-
68: <span class="ruby-ivar">@cache_buffer</span>.<span class="ruby-identifier">rewind</span>
|
56
|
-
69: <span class="ruby-ivar">@config</span>.<span class="ruby-identifier">cache</span>.<span class="ruby-identifier">put</span>(<span class="ruby-identifier">path_with_query</span>, <span class="ruby-identifier">http_params</span>, <span class="ruby-ivar">@control</span>[<span class="ruby-value str">'max-age'</span>].<span class="ruby-identifier">to_i</span>, <span class="ruby-ivar">@cache_buffer</span>.<span class="ruby-identifier">read</span> )
|
57
|
-
70: <span class="ruby-keyword kw">end</span>
|
58
|
-
71:
|
59
|
-
72: <span class="ruby-keyword kw">end</span>
|
60
|
-
73: [<span class="ruby-identifier">chunk_count</span>, <span class="ruby-identifier">bytes_sent</span>, <span class="ruby-identifier">status</span>, <span class="ruby-identifier">sent_from_cache</span>]
|
61
|
-
74: <span class="ruby-keyword kw">end</span></pre>
|
62
|
-
</body>
|
63
|
-
</html>
|