mongrel_esi 0.5.0 → 0.5.1
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/Rakefile +14 -6
- data/doc/rdoc/classes/ESI/CParser.html +122 -0
- data/doc/rdoc/classes/ESI/Cache.html +178 -0
- data/doc/rdoc/classes/ESI/Cache.src/M000085.html +17 -0
- data/doc/rdoc/classes/ESI/Cache.src/M000086.html +20 -0
- data/doc/rdoc/classes/ESI/Config.html +333 -0
- data/doc/rdoc/classes/ESI/Config.src/M000052.html +18 -0
- data/doc/rdoc/classes/ESI/Config.src/M000053.html +18 -0
- data/doc/rdoc/classes/ESI/Config.src/M000054.html +35 -0
- data/doc/rdoc/classes/ESI/Config.src/M000055.html +38 -0
- data/doc/rdoc/classes/ESI/Config.src/M000056.html +23 -0
- data/doc/rdoc/classes/ESI/Config.src/M000057.html +18 -0
- data/doc/rdoc/classes/ESI/Config.src/M000058.html +20 -0
- data/doc/rdoc/classes/ESI/Config.src/M000059.html +18 -0
- data/doc/rdoc/classes/ESI/Config.src/M000060.html +24 -0
- data/doc/rdoc/classes/ESI/Config/CacheConfig.html +212 -0
- data/doc/rdoc/classes/ESI/Config/CacheConfig.src/M000064.html +19 -0
- data/doc/rdoc/classes/ESI/Config/CacheConfig.src/M000065.html +19 -0
- data/doc/rdoc/classes/ESI/Config/CacheConfig.src/M000066.html +18 -0
- data/doc/rdoc/classes/ESI/Config/CacheConfig.src/M000067.html +18 -0
- data/doc/rdoc/classes/ESI/Config/CacheConfig.src/M000068.html +18 -0
- data/doc/rdoc/classes/ESI/Config/ConfigRouter.html +187 -0
- data/doc/rdoc/classes/ESI/Config/ConfigRouter.src/M000061.html +19 -0
- data/doc/rdoc/classes/ESI/Config/ConfigRouter.src/M000062.html +21 -0
- data/doc/rdoc/classes/ESI/Config/ConfigRouter.src/M000063.html +21 -0
- data/doc/rdoc/classes/ESI/Dispatcher.html +172 -0
- data/doc/rdoc/classes/ESI/Dispatcher.src/M000087.html +22 -0
- data/doc/rdoc/classes/ESI/Dispatcher.src/M000088.html +18 -0
- data/doc/rdoc/classes/ESI/Fragment.html +218 -0
- data/doc/rdoc/classes/ESI/Fragment.src/M000100.html +20 -0
- data/doc/rdoc/classes/ESI/Fragment.src/M000101.html +18 -0
- data/doc/rdoc/classes/ESI/Fragment.src/M000102.html +18 -0
- data/doc/rdoc/classes/ESI/Invalidator.html +131 -0
- data/doc/rdoc/classes/ESI/Invalidator.src/M000004.html +41 -0
- data/doc/rdoc/classes/ESI/Log.html +221 -0
- data/doc/rdoc/classes/ESI/Log.src/M000030.html +18 -0
- data/doc/rdoc/classes/ESI/Log.src/M000031.html +18 -0
- data/doc/rdoc/classes/ESI/Log.src/M000032.html +18 -0
- data/doc/rdoc/classes/ESI/Log.src/M000033.html +18 -0
- data/doc/rdoc/classes/ESI/Log.src/M000034.html +18 -0
- data/doc/rdoc/classes/ESI/Log.src/M000035.html +18 -0
- data/doc/rdoc/classes/ESI/Log.src/M000036.html +18 -0
- data/doc/rdoc/classes/ESI/MemcachedCache.html +314 -0
- data/doc/rdoc/classes/ESI/MemcachedCache.src/M000040.html +24 -0
- data/doc/rdoc/classes/ESI/MemcachedCache.src/M000041.html +22 -0
- data/doc/rdoc/classes/ESI/MemcachedCache.src/M000042.html +19 -0
- data/doc/rdoc/classes/ESI/MemcachedCache.src/M000043.html +23 -0
- data/doc/rdoc/classes/ESI/MemcachedCache.src/M000044.html +18 -0
- data/doc/rdoc/classes/ESI/MemcachedCache.src/M000045.html +19 -0
- data/doc/rdoc/classes/ESI/MemcachedCache.src/M000046.html +18 -0
- data/doc/rdoc/classes/ESI/MemcachedCache.src/M000047.html +18 -0
- data/doc/rdoc/classes/ESI/MemcachedCache.src/M000048.html +17 -0
- data/doc/rdoc/classes/ESI/Parser.html +184 -0
- data/doc/rdoc/classes/ESI/Parser.src/M000049.html +51 -0
- data/doc/rdoc/classes/ESI/Parser.src/M000050.html +39 -0
- data/doc/rdoc/classes/ESI/Parser.src/M000051.html +19 -0
- data/doc/rdoc/classes/ESI/Processor.html +194 -0
- data/doc/rdoc/classes/ESI/Processor.src/M000037.html +26 -0
- data/doc/rdoc/classes/ESI/Processor.src/M000038.html +44 -0
- data/doc/rdoc/classes/ESI/Processor.src/M000039.html +26 -0
- data/doc/rdoc/classes/ESI/Proxy.html +304 -0
- data/doc/rdoc/classes/ESI/Proxy.src/M000069.html +20 -0
- data/doc/rdoc/classes/ESI/Proxy.src/M000070.html +55 -0
- data/doc/rdoc/classes/ESI/Proxy.src/M000071.html +53 -0
- data/doc/rdoc/classes/ESI/Proxy.src/M000072.html +25 -0
- data/doc/rdoc/classes/ESI/Proxy.src/M000073.html +19 -0
- data/doc/rdoc/classes/ESI/Proxy.src/M000074.html +27 -0
- data/doc/rdoc/classes/ESI/Proxy.src/M000075.html +18 -0
- data/doc/rdoc/classes/ESI/Proxy.src/M000076.html +28 -0
- data/doc/rdoc/classes/ESI/Proxy.src/M000077.html +29 -0
- data/doc/rdoc/classes/ESI/Response.html +250 -0
- data/doc/rdoc/classes/ESI/Response.src/M000078.html +23 -0
- data/doc/rdoc/classes/ESI/Response.src/M000079.html +18 -0
- data/doc/rdoc/classes/ESI/Response.src/M000080.html +21 -0
- data/doc/rdoc/classes/ESI/Response.src/M000081.html +20 -0
- data/doc/rdoc/classes/ESI/Response.src/M000082.html +25 -0
- data/doc/rdoc/classes/ESI/Response.src/M000083.html +18 -0
- data/doc/rdoc/classes/ESI/Response.src/M000084.html +33 -0
- data/doc/rdoc/classes/ESI/Router.html +212 -0
- data/doc/rdoc/classes/ESI/Router.src/M000098.html +36 -0
- data/doc/rdoc/classes/ESI/Router.src/M000099.html +25 -0
- data/doc/rdoc/classes/ESI/RubyCache.html +278 -0
- data/doc/rdoc/classes/ESI/RubyCache.src/M000089.html +20 -0
- data/doc/rdoc/classes/ESI/RubyCache.src/M000090.html +20 -0
- data/doc/rdoc/classes/ESI/RubyCache.src/M000091.html +20 -0
- data/doc/rdoc/classes/ESI/RubyCache.src/M000092.html +22 -0
- data/doc/rdoc/classes/ESI/RubyCache.src/M000093.html +18 -0
- data/doc/rdoc/classes/ESI/RubyCache.src/M000094.html +22 -0
- data/doc/rdoc/classes/ESI/RubyCache.src/M000095.html +18 -0
- data/doc/rdoc/classes/ESI/RubyCache.src/M000096.html +18 -0
- data/doc/rdoc/classes/ESI/RubyCache.src/M000097.html +18 -0
- data/doc/rdoc/classes/ESI/Tag.html +141 -0
- data/doc/rdoc/classes/ESI/Tag/Attempt.html +113 -0
- data/doc/rdoc/classes/ESI/Tag/Base.html +237 -0
- data/doc/rdoc/classes/ESI/Tag/Base.src/M000026.html +23 -0
- data/doc/rdoc/classes/ESI/Tag/Base.src/M000027.html +22 -0
- data/doc/rdoc/classes/ESI/Tag/Base.src/M000028.html +22 -0
- data/doc/rdoc/classes/ESI/Tag/Base.src/M000029.html +17 -0
- data/doc/rdoc/classes/ESI/Tag/Container.html +206 -0
- data/doc/rdoc/classes/ESI/Tag/Container.src/M000015.html +20 -0
- data/doc/rdoc/classes/ESI/Tag/Container.src/M000016.html +22 -0
- data/doc/rdoc/classes/ESI/Tag/Container.src/M000017.html +25 -0
- data/doc/rdoc/classes/ESI/Tag/Except.html +184 -0
- data/doc/rdoc/classes/ESI/Tag/Except.src/M000018.html +21 -0
- data/doc/rdoc/classes/ESI/Tag/Except.src/M000019.html +20 -0
- data/doc/rdoc/classes/ESI/Tag/Except.src/M000020.html +18 -0
- data/doc/rdoc/classes/ESI/Tag/Include.html +257 -0
- data/doc/rdoc/classes/ESI/Tag/Include.src/M000005.html +20 -0
- data/doc/rdoc/classes/ESI/Tag/Include.src/M000006.html +18 -0
- data/doc/rdoc/classes/ESI/Tag/Include.src/M000007.html +34 -0
- data/doc/rdoc/classes/ESI/Tag/Include.src/M000008.html +22 -0
- data/doc/rdoc/classes/ESI/Tag/Include.src/M000009.html +27 -0
- data/doc/rdoc/classes/ESI/Tag/Include.src/M000010.html +30 -0
- data/doc/rdoc/classes/ESI/Tag/Include.src/M000011.html +51 -0
- data/doc/rdoc/classes/ESI/Tag/Include/Request.html +199 -0
- data/doc/rdoc/classes/ESI/Tag/Include/Request.src/M000012.html +18 -0
- data/doc/rdoc/classes/ESI/Tag/Include/Request.src/M000013.html +44 -0
- data/doc/rdoc/classes/ESI/Tag/Include/Request/Error.html +155 -0
- data/doc/rdoc/classes/ESI/Tag/Include/Request/Error.src/M000014.html +19 -0
- data/doc/rdoc/classes/ESI/Tag/Invalidate.html +171 -0
- data/doc/rdoc/classes/ESI/Tag/Invalidate.src/M000023.html +19 -0
- data/doc/rdoc/classes/ESI/Tag/Invalidate.src/M000024.html +51 -0
- data/doc/rdoc/classes/ESI/Tag/Invalidate.src/M000025.html +19 -0
- data/doc/rdoc/classes/ESI/Tag/Try.html +154 -0
- data/doc/rdoc/classes/ESI/Tag/Try.src/M000021.html +38 -0
- data/doc/rdoc/classes/ESI/Tag/Try.src/M000022.html +18 -0
- data/doc/rdoc/classes/MultiDirHandler.html +198 -0
- data/doc/rdoc/classes/MultiDirHandler.src/M000001.html +20 -0
- data/doc/rdoc/classes/MultiDirHandler.src/M000002.html +28 -0
- data/doc/rdoc/classes/MultiDirHandler.src/M000003.html +22 -0
- data/doc/rdoc/created.rid +1 -0
- data/doc/rdoc/files/COPYING.html +167 -0
- data/doc/rdoc/files/LICENSE.html +605 -0
- data/doc/rdoc/files/README.html +359 -0
- data/doc/rdoc/files/ext/esi/common_rl.html +160 -0
- data/doc/rdoc/files/ext/esi/esi_parser_c.html +101 -0
- data/doc/rdoc/files/ext/esi/parser_c.html +101 -0
- data/doc/rdoc/files/ext/esi/parser_h.html +101 -0
- data/doc/rdoc/files/ext/esi/parser_rl.html +827 -0
- data/doc/rdoc/files/ext/esi/test/common_rl.html +160 -0
- data/doc/rdoc/files/ext/esi/test/parser_c.html +101 -0
- data/doc/rdoc/files/ext/esi/test/parser_h.html +101 -0
- data/doc/rdoc/files/ext/esi/test/parser_rl.html +827 -0
- data/doc/rdoc/files/ext/esi/test/sp_c.html +101 -0
- data/doc/rdoc/files/ext/esi/test/test_c.html +101 -0
- data/doc/rdoc/files/lib/esi/cache_rb.html +119 -0
- data/doc/rdoc/files/lib/esi/config_rb.html +114 -0
- data/doc/rdoc/files/lib/esi/dispatcher_rb.html +108 -0
- data/doc/rdoc/files/lib/esi/invalidator_rb.html +114 -0
- data/doc/rdoc/files/lib/esi/logger_rb.html +108 -0
- data/doc/rdoc/files/lib/esi/parser_rb.html +120 -0
- data/doc/rdoc/files/lib/esi/processor_rb.html +115 -0
- data/doc/rdoc/files/lib/esi/proxy_rb.html +123 -0
- data/doc/rdoc/files/lib/esi/response_rb.html +116 -0
- data/doc/rdoc/files/lib/esi/router_rb.html +107 -0
- data/doc/rdoc/files/lib/esi/tag/attempt_rb.html +114 -0
- data/doc/rdoc/files/lib/esi/tag/base_rb.html +114 -0
- data/doc/rdoc/files/lib/esi/tag/container_rb.html +115 -0
- data/doc/rdoc/files/lib/esi/tag/except_rb.html +114 -0
- data/doc/rdoc/files/lib/esi/tag/include_rb.html +116 -0
- data/doc/rdoc/files/lib/esi/tag/invalidate_rb.html +115 -0
- data/doc/rdoc/files/lib/esi/tag/try_rb.html +115 -0
- data/doc/rdoc/files/lib/esi/version_rb.html +101 -0
- data/doc/rdoc/files/lib/multi_dirhandler_rb.html +109 -0
- data/doc/rdoc/fr_class_index.html +53 -0
- data/doc/rdoc/fr_file_index.html +59 -0
- data/doc/rdoc/fr_method_index.html +128 -0
- data/doc/rdoc/index.html +24 -0
- data/doc/rdoc/rdoc-style.css +208 -0
- data/ext/esi/esi_parser.c +12 -1
- data/ext/esi/parser.c +492 -3927
- data/ext/esi/parser.rl +83 -14
- data/ext/esi/test/parser.c +1587 -367
- data/ext/esi/test/parser.rl +83 -14
- data/ext/esi/test/sp.c +125 -0
- data/ext/esi/test/test.c +198 -6
- data/lib/esi/cache.rb +5 -8
- data/lib/esi/config.rb +3 -3
- data/lib/esi/dispatcher.rb +2 -4
- data/lib/esi/parser.rb +26 -13
- data/lib/esi/processor.rb +13 -35
- data/lib/esi/proxy.rb +113 -44
- data/lib/esi/response.rb +23 -55
- data/lib/esi/router.rb +0 -11
- data/lib/esi/tag/attempt.rb +2 -1
- data/lib/esi/tag/base.rb +1 -24
- data/lib/esi/tag/container.rb +40 -0
- data/lib/esi/tag/except.rb +3 -1
- data/lib/esi/tag/include.rb +53 -62
- data/lib/esi/tag/try.rb +16 -18
- data/lib/esi/version.rb +9 -0
- data/test/integration/handler_test.rb +49 -12
- data/test/integration/help.rb +12 -0
- data/test/load_test.rb +8 -4
- data/test/load_test_ab.rb +8 -0
- data/test/sample.html +31 -0
- data/test/unit/help.rb +12 -8
- data/test/unit/include_request_test.rb +14 -21
- data/test/unit/parser_test.rb +2 -1
- data/test/unit/response_test.rb +4 -8
- data/tools/rakehelp.rb +1 -1
- metadata +216 -5
|
@@ -0,0 +1,20 @@
|
|
|
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>
|
|
@@ -0,0 +1,55 @@
|
|
|
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">request</span>, <span class="ruby-identifier">response</span>)
|
|
15
|
+
28:
|
|
16
|
+
29: <span class="ruby-identifier">start</span> = <span class="ruby-constant">Time</span>.<span class="ruby-identifier">now</span>
|
|
17
|
+
30: <span class="ruby-identifier">status</span> = <span class="ruby-value">200</span>
|
|
18
|
+
31:
|
|
19
|
+
32: <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>)
|
|
20
|
+
33:
|
|
21
|
+
34: <span class="ruby-identifier">url</span> = <span class="ruby-ivar">@router</span>.<span class="ruby-identifier">url_for</span>(<span class="ruby-identifier">request</span>.<span class="ruby-identifier">params</span>[<span class="ruby-value str">"REQUEST_URI"</span>])
|
|
22
|
+
35: <span class="ruby-comment cmt">#log_debug "#{request.params["REQUEST_METHOD"]} => #{url}"</span>
|
|
23
|
+
36: <span class="ruby-identifier">chunk_count</span> = <span class="ruby-value">0</span>
|
|
24
|
+
37: <span class="ruby-identifier">bytes_sent</span> = <span class="ruby-value">0</span>
|
|
25
|
+
38: <span class="ruby-identifier">uri</span> = <span class="ruby-constant">URI</span>.<span class="ruby-identifier">parse</span>(<span class="ruby-identifier">url</span>)
|
|
26
|
+
39:
|
|
27
|
+
40: <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>
|
|
28
|
+
41:
|
|
29
|
+
42: <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@config</span>.<span class="ruby-identifier">cache</span>.<span class="ruby-identifier">cached?</span>( <span class="ruby-identifier">path_with_query</span>, <span class="ruby-identifier">http_params</span> )
|
|
30
|
+
43: <span class="ruby-identifier">cache_buffer</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> ).<span class="ruby-identifier">body</span>
|
|
31
|
+
44: <span class="ruby-identifier">bytes_sent</span> = <span class="ruby-identifier">send_esi_buffered</span>( <span class="ruby-identifier">status</span>, <span class="ruby-identifier">response</span>, <span class="ruby-identifier">request</span>, <span class="ruby-identifier">http_params</span>, <span class="ruby-identifier">cache_buffer</span> )
|
|
32
|
+
45: <span class="ruby-keyword kw">else</span>
|
|
33
|
+
46: <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>
|
|
34
|
+
47: <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>
|
|
35
|
+
48: <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> )
|
|
36
|
+
49:
|
|
37
|
+
50: <span class="ruby-comment cmt"># open the conneciton up so we can start to stream the connection</span>
|
|
38
|
+
51: <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>
|
|
39
|
+
52: <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> )
|
|
40
|
+
53: <span class="ruby-keyword kw">end</span> <span class="ruby-comment cmt"># end request</span>
|
|
41
|
+
54:
|
|
42
|
+
55: <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>
|
|
43
|
+
56: <span class="ruby-ivar">@cache_buffer</span>.<span class="ruby-identifier">rewind</span>
|
|
44
|
+
57: <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> )
|
|
45
|
+
58: <span class="ruby-keyword kw">end</span>
|
|
46
|
+
59:
|
|
47
|
+
60: <span class="ruby-keyword kw">end</span>
|
|
48
|
+
61:
|
|
49
|
+
62: <span class="ruby-keyword kw">rescue</span> =<span class="ruby-operator">></span> <span class="ruby-identifier">e</span>
|
|
50
|
+
63: <span class="ruby-constant">STDERR</span>.<span class="ruby-identifier">puts</span> <span class="ruby-node">"\n#{e.message}: error at #{e.backtrace.first} msg at #{__FILE__}:#{__LINE__}\n"</span>
|
|
51
|
+
64: <span class="ruby-keyword kw">ensure</span>
|
|
52
|
+
65: <span class="ruby-identifier">log_request</span> <span class="ruby-node">"\n#{url}, #{Time.now - start} seconds with status #{status} and #{chunk_count} chunks, #{bytes_sent} bytes\n"</span>
|
|
53
|
+
66: <span class="ruby-keyword kw">end</span></pre>
|
|
54
|
+
</body>
|
|
55
|
+
</html>
|
|
@@ -0,0 +1,53 @@
|
|
|
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_response (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 69</span>
|
|
14
|
+
69: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">send_response</span>( <span class="ruby-identifier">http_request</span>, <span class="ruby-identifier">http_response</span>, <span class="ruby-identifier">http_params</span>, <span class="ruby-identifier">proxy_response</span> )
|
|
15
|
+
70: <span class="ruby-identifier">status</span> = <span class="ruby-identifier">read_status</span>( <span class="ruby-identifier">proxy_response</span> )
|
|
16
|
+
71:
|
|
17
|
+
72: <span class="ruby-identifier">headers</span> = <span class="ruby-identifier">copy_headers</span>( <span class="ruby-identifier">proxy_response</span> )
|
|
18
|
+
73:
|
|
19
|
+
74: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">proxy_response</span>.<span class="ruby-identifier">header</span>[<span class="ruby-value str">"Surrogate-Control"</span>]
|
|
20
|
+
75: <span class="ruby-ivar">@control</span> = {}
|
|
21
|
+
76: <span class="ruby-identifier">proxy_response</span>.<span class="ruby-identifier">header</span>[<span class="ruby-value str">"Surrogate-Control"</span>].<span class="ruby-identifier">split</span>(<span class="ruby-value str">','</span>).<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">pair</span><span class="ruby-operator">|</span>
|
|
22
|
+
77: <span class="ruby-identifier">k</span>,<span class="ruby-identifier">v</span> = <span class="ruby-identifier">pair</span>.<span class="ruby-identifier">strip</span>.<span class="ruby-identifier">split</span>(<span class="ruby-value str">'='</span>)
|
|
23
|
+
78: <span class="ruby-ivar">@control</span>[<span class="ruby-identifier">k</span>] = <span class="ruby-identifier">v</span>
|
|
24
|
+
79: <span class="ruby-keyword kw">end</span>
|
|
25
|
+
80: <span class="ruby-keyword kw">if</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>
|
|
26
|
+
81: <span class="ruby-ivar">@cache_buffer</span> = <span class="ruby-constant">StringIO</span>.<span class="ruby-identifier">new</span>
|
|
27
|
+
82: <span class="ruby-keyword kw">end</span>
|
|
28
|
+
83: <span class="ruby-keyword kw">end</span>
|
|
29
|
+
84:
|
|
30
|
+
85:
|
|
31
|
+
86: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">status</span> <span class="ruby-operator">>=</span> <span class="ruby-value">500</span> <span class="ruby-keyword kw">or</span> <span class="ruby-operator">!</span><span class="ruby-ivar">@config</span>.<span class="ruby-identifier">enable_esi_processor?</span>( <span class="ruby-identifier">proxy_response</span> )
|
|
32
|
+
87: <span class="ruby-identifier">headers</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span><span class="ruby-operator">|</span><span class="ruby-identifier">k</span>,<span class="ruby-identifier">v</span><span class="ruby-operator">|</span>
|
|
33
|
+
88: <span class="ruby-identifier">http_response</span>.<span class="ruby-identifier">header</span>[<span class="ruby-identifier">k</span>] = <span class="ruby-identifier">v</span>
|
|
34
|
+
89: <span class="ruby-keyword kw">end</span>
|
|
35
|
+
90: <span class="ruby-identifier">proxy_direct</span>( <span class="ruby-identifier">http_response</span>, <span class="ruby-identifier">status</span>, <span class="ruby-identifier">proxy_response</span> )
|
|
36
|
+
91: <span class="ruby-keyword kw">else</span>
|
|
37
|
+
92: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">http_request</span>.<span class="ruby-identifier">params</span>[<span class="ruby-value str">"HTTP_VERSION"</span>].<span class="ruby-identifier">match</span>(<span class="ruby-regexp re">/1.0/</span>)
|
|
38
|
+
93: <span class="ruby-identifier">buffer</span> = <span class="ruby-identifier">proxy_response</span>.<span class="ruby-identifier">read_body</span>
|
|
39
|
+
94: <span class="ruby-identifier">bytes</span>=<span class="ruby-identifier">send_esi_buffered</span>( <span class="ruby-identifier">status</span>, <span class="ruby-identifier">http_response</span>, <span class="ruby-identifier">http_request</span>, <span class="ruby-identifier">http_params</span>, <span class="ruby-identifier">buffer</span> )
|
|
40
|
+
95: <span class="ruby-ivar">@cache_buffer</span> <span class="ruby-operator"><<</span> <span class="ruby-identifier">buffer</span> <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@cache_buffer</span>
|
|
41
|
+
96: [<span class="ruby-value">0</span>,<span class="ruby-identifier">bytes</span>]
|
|
42
|
+
97: <span class="ruby-keyword kw">else</span>
|
|
43
|
+
98: <span class="ruby-identifier">header</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">STATUS_FORMAT</span> <span class="ruby-operator">%</span> [<span class="ruby-identifier">status</span>, <span class="ruby-constant">Mongrel</span><span class="ruby-operator">::</span><span class="ruby-constant">HTTP_STATUS_CODES</span>[<span class="ruby-identifier">status</span>]]
|
|
44
|
+
99: <span class="ruby-identifier">headers</span>.<span class="ruby-identifier">each</span> {<span class="ruby-operator">|</span><span class="ruby-identifier">k</span>,<span class="ruby-identifier">v</span><span class="ruby-operator">|</span> <span class="ruby-identifier">header</span> <span class="ruby-operator"><<</span> <span class="ruby-node">"#{k}: #{v}\r\n"</span> }
|
|
45
|
+
100: <span class="ruby-identifier">header</span> <span class="ruby-operator"><<</span> <span class="ruby-value str">"Transfer-Encoding: chunked\r\n\r\n"</span>
|
|
46
|
+
101: <span class="ruby-identifier">http_response</span>.<span class="ruby-identifier">write</span>( <span class="ruby-identifier">header</span> )
|
|
47
|
+
102: <span class="ruby-identifier">proxy_filter_esi</span>( <span class="ruby-identifier">http_request</span>, <span class="ruby-identifier">http_response</span>, <span class="ruby-identifier">http_params</span>, <span class="ruby-identifier">proxy_response</span> )
|
|
48
|
+
103: <span class="ruby-keyword kw">end</span>
|
|
49
|
+
104: <span class="ruby-keyword kw">end</span>
|
|
50
|
+
105:
|
|
51
|
+
106: <span class="ruby-keyword kw">end</span></pre>
|
|
52
|
+
</body>
|
|
53
|
+
</html>
|
|
@@ -0,0 +1,25 @@
|
|
|
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>proxy_direct (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 108</span>
|
|
14
|
+
108: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">proxy_direct</span>( <span class="ruby-identifier">http_response</span>, <span class="ruby-identifier">status</span>, <span class="ruby-identifier">proxy_response</span> )
|
|
15
|
+
109: <span class="ruby-identifier">bytes_sent</span> = <span class="ruby-value">0</span>
|
|
16
|
+
110: <span class="ruby-identifier">http_response</span>.<span class="ruby-identifier">start</span>(<span class="ruby-identifier">status</span>, <span class="ruby-keyword kw">true</span>) <span class="ruby-keyword kw">do</span><span class="ruby-operator">|</span><span class="ruby-identifier">head</span>,<span class="ruby-identifier">out</span><span class="ruby-operator">|</span>
|
|
17
|
+
111: <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">fragment</span><span class="ruby-operator">|</span>
|
|
18
|
+
112: <span class="ruby-identifier">out</span> <span class="ruby-operator"><<</span> <span class="ruby-identifier">fragment</span>
|
|
19
|
+
113: <span class="ruby-identifier">bytes_sent</span> <span class="ruby-operator">+=</span> <span class="ruby-identifier">fragment</span>.<span class="ruby-identifier">size</span>
|
|
20
|
+
114: <span class="ruby-keyword kw">end</span>
|
|
21
|
+
115: <span class="ruby-keyword kw">end</span>
|
|
22
|
+
116: <span class="ruby-keyword kw">return</span> [<span class="ruby-value">0</span>,<span class="ruby-identifier">bytes_sent</span>]
|
|
23
|
+
117: <span class="ruby-keyword kw">end</span></pre>
|
|
24
|
+
</body>
|
|
25
|
+
</html>
|
|
@@ -0,0 +1,19 @@
|
|
|
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>proxy_filter_esi (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 119</span>
|
|
14
|
+
119: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">proxy_filter_esi</span>( <span class="ruby-identifier">http_request</span>, <span class="ruby-identifier">http_response</span>, <span class="ruby-identifier">http_params</span>, <span class="ruby-identifier">proxy_response</span> )
|
|
15
|
+
120: <span class="ruby-identifier">processor</span> = <span class="ruby-constant">Processor</span>.<span class="ruby-identifier">new</span>( <span class="ruby-ivar">@config</span>, <span class="ruby-ivar">@router</span>, <span class="ruby-ivar">@cache_buffer</span> )
|
|
16
|
+
121: <span class="ruby-identifier">processor</span>.<span class="ruby-identifier">send_body</span>( <span class="ruby-identifier">http_request</span>, <span class="ruby-identifier">http_params</span>, <span class="ruby-identifier">http_response</span>, <span class="ruby-identifier">proxy_response</span> )
|
|
17
|
+
122: <span class="ruby-keyword kw">end</span></pre>
|
|
18
|
+
</body>
|
|
19
|
+
</html>
|
|
@@ -0,0 +1,27 @@
|
|
|
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_esi_buffered (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 124</span>
|
|
14
|
+
124: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">send_esi_buffered</span>( <span class="ruby-identifier">status</span>, <span class="ruby-identifier">response</span>, <span class="ruby-identifier">request</span>, <span class="ruby-identifier">http_params</span>, <span class="ruby-identifier">buffer</span> )
|
|
15
|
+
125: <span class="ruby-identifier">bytes</span> = <span class="ruby-value">0</span>
|
|
16
|
+
126: <span class="ruby-identifier">response</span>.<span class="ruby-identifier">start</span>(<span class="ruby-identifier">status</span>, <span class="ruby-keyword kw">true</span>) <span class="ruby-keyword kw">do</span><span class="ruby-operator">|</span><span class="ruby-identifier">head</span>,<span class="ruby-identifier">out</span><span class="ruby-operator">|</span>
|
|
17
|
+
127: <span class="ruby-identifier">head</span>[<span class="ruby-value str">"Server"</span>] = <span class="ruby-constant">SERVER</span>
|
|
18
|
+
128: <span class="ruby-identifier">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-identifier">out</span>, <span class="ruby-ivar">@router</span>, <span class="ruby-ivar">@config</span>.<span class="ruby-identifier">cache</span>, <span class="ruby-value">3</span> )
|
|
19
|
+
129: <span class="ruby-identifier">parser</span>.<span class="ruby-identifier">prepare</span>( <span class="ruby-identifier">request</span>.<span class="ruby-identifier">params</span>, <span class="ruby-identifier">http_params</span> )
|
|
20
|
+
130: <span class="ruby-identifier">parser</span>.<span class="ruby-identifier">process</span> <span class="ruby-identifier">buffer</span>
|
|
21
|
+
131: <span class="ruby-identifier">parser</span>.<span class="ruby-identifier">finish</span>
|
|
22
|
+
132: <span class="ruby-identifier">bytes</span> = <span class="ruby-identifier">out</span>.<span class="ruby-identifier">size</span>
|
|
23
|
+
133: <span class="ruby-keyword kw">end</span>
|
|
24
|
+
134: <span class="ruby-identifier">bytes</span>
|
|
25
|
+
135: <span class="ruby-keyword kw">end</span></pre>
|
|
26
|
+
</body>
|
|
27
|
+
</html>
|
|
@@ -0,0 +1,18 @@
|
|
|
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>read_status (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 138</span>
|
|
14
|
+
138: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">read_status</span>(<span class="ruby-identifier">response</span>)
|
|
15
|
+
139: <span class="ruby-constant">Net</span><span class="ruby-operator">::</span><span class="ruby-constant">HTTPResponse</span><span class="ruby-operator">::</span><span class="ruby-constant">CODE_TO_OBJ</span>.<span class="ruby-identifier">select</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">k</span>,<span class="ruby-identifier">v</span><span class="ruby-operator">|</span> <span class="ruby-identifier">v</span> <span class="ruby-operator">==</span> <span class="ruby-identifier">response</span>.<span class="ruby-identifier">class</span> }.<span class="ruby-identifier">first</span>[<span class="ruby-value">0</span>].<span class="ruby-identifier">to_i</span> <span class="ruby-keyword kw">rescue</span> <span class="ruby-value">500</span>
|
|
16
|
+
140: <span class="ruby-keyword kw">end</span></pre>
|
|
17
|
+
</body>
|
|
18
|
+
</html>
|
|
@@ -0,0 +1,28 @@
|
|
|
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>http_params (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 142</span>
|
|
14
|
+
142: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">http_params</span>(<span class="ruby-identifier">params</span>)
|
|
15
|
+
143: <span class="ruby-identifier">updated_params</span> = {}
|
|
16
|
+
144: <span class="ruby-identifier">params</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span><span class="ruby-operator">|</span><span class="ruby-identifier">k</span>,<span class="ruby-identifier">v</span><span class="ruby-operator">|</span>
|
|
17
|
+
145: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">k</span>.<span class="ruby-identifier">match</span>(<span class="ruby-regexp re">/HTTP/i</span>)
|
|
18
|
+
146: <span class="ruby-identifier">k</span> = <span class="ruby-identifier">k</span>.<span class="ruby-identifier">split</span>(<span class="ruby-value str">'_'</span>).<span class="ruby-identifier">collect</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">t</span><span class="ruby-operator">|</span> <span class="ruby-identifier">t</span>.<span class="ruby-identifier">capitalize</span> }.<span class="ruby-identifier">join</span>(<span class="ruby-value str">'-'</span>)
|
|
19
|
+
147: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">k</span>[<span class="ruby-value">0</span>,<span class="ruby-value">5</span>] <span class="ruby-operator">==</span><span class="ruby-value str">'Http-'</span>
|
|
20
|
+
148: <span class="ruby-identifier">k</span>[<span class="ruby-value">0</span>,<span class="ruby-value">5</span>] = <span class="ruby-value str">''</span>
|
|
21
|
+
149: <span class="ruby-identifier">updated_params</span>[<span class="ruby-identifier">k</span>] = <span class="ruby-identifier">v</span>
|
|
22
|
+
150: <span class="ruby-keyword kw">end</span>
|
|
23
|
+
151: <span class="ruby-keyword kw">end</span>
|
|
24
|
+
152: <span class="ruby-keyword kw">end</span>
|
|
25
|
+
153: <span class="ruby-identifier">updated_params</span>
|
|
26
|
+
154: <span class="ruby-keyword kw">end</span></pre>
|
|
27
|
+
</body>
|
|
28
|
+
</html>
|
|
@@ -0,0 +1,29 @@
|
|
|
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>copy_headers (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 156</span>
|
|
14
|
+
156: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">copy_headers</span>(<span class="ruby-identifier">response</span>)
|
|
15
|
+
157: <span class="ruby-identifier">headers</span> = {}
|
|
16
|
+
158: <span class="ruby-identifier">response</span>.<span class="ruby-identifier">to_hash</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">k</span>,<span class="ruby-identifier">v</span><span class="ruby-operator">|</span>
|
|
17
|
+
159: <span class="ruby-comment cmt"># for Set-Cookie we need to split on ,</span>
|
|
18
|
+
160: <span class="ruby-comment cmt"># some edge cases with , since things like expires might be a date with , in them.</span>
|
|
19
|
+
161: <span class="ruby-identifier">k</span> = <span class="ruby-identifier">k</span>.<span class="ruby-identifier">split</span>(<span class="ruby-regexp re">/-/</span>).<span class="ruby-identifier">map</span>{<span class="ruby-operator">|</span><span class="ruby-identifier">s</span><span class="ruby-operator">|</span> <span class="ruby-identifier">s</span>.<span class="ruby-identifier">capitalize</span> }.<span class="ruby-identifier">join</span>(<span class="ruby-value str">'-'</span>)
|
|
20
|
+
162:
|
|
21
|
+
163: <span class="ruby-keyword kw">next</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">k</span>.<span class="ruby-identifier">match</span>(<span class="ruby-regexp re">/Content-Length|Surrogate-Control|Server|Connection|Status/i</span>)
|
|
22
|
+
164:
|
|
23
|
+
165: <span class="ruby-identifier">headers</span>[<span class="ruby-identifier">k</span>] = <span class="ruby-identifier">v</span>
|
|
24
|
+
166: <span class="ruby-keyword kw">end</span>
|
|
25
|
+
167: <span class="ruby-identifier">headers</span>[<span class="ruby-value str">"Server"</span>] = <span class="ruby-constant">SERVER</span>
|
|
26
|
+
168: <span class="ruby-identifier">headers</span>
|
|
27
|
+
169: <span class="ruby-keyword kw">end</span></pre>
|
|
28
|
+
</body>
|
|
29
|
+
</html>
|
|
@@ -0,0 +1,250 @@
|
|
|
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::Response</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::Response</td>
|
|
54
|
+
</tr>
|
|
55
|
+
<tr class="top-aligned-row">
|
|
56
|
+
<td><strong>In:</strong></td>
|
|
57
|
+
<td>
|
|
58
|
+
<a href="../../files/lib/esi/response_rb.html">
|
|
59
|
+
lib/esi/response.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="#M000084">flush</a>
|
|
90
|
+
<a href="#M000078">new</a>
|
|
91
|
+
<a href="#M000080">partial_buffer</a>
|
|
92
|
+
<a href="#M000081">reserve_buffer</a>
|
|
93
|
+
<a href="#M000082">send</a>
|
|
94
|
+
<a href="#M000079">update_output</a>
|
|
95
|
+
<a href="#M000083">wait_thread</a>
|
|
96
|
+
</div>
|
|
97
|
+
</div>
|
|
98
|
+
|
|
99
|
+
</div>
|
|
100
|
+
|
|
101
|
+
|
|
102
|
+
<!-- if includes -->
|
|
103
|
+
|
|
104
|
+
<div id="section">
|
|
105
|
+
|
|
106
|
+
|
|
107
|
+
|
|
108
|
+
|
|
109
|
+
|
|
110
|
+
<div id="attribute-list">
|
|
111
|
+
<h3 class="section-bar">Attributes</h3>
|
|
112
|
+
|
|
113
|
+
<div class="name-list">
|
|
114
|
+
<table>
|
|
115
|
+
<tr class="top-aligned-row context-row">
|
|
116
|
+
<td class="context-item-name">active_buffer</td>
|
|
117
|
+
<td class="context-item-value"> [R] </td>
|
|
118
|
+
<td class="context-item-desc"></td>
|
|
119
|
+
</tr>
|
|
120
|
+
<tr class="top-aligned-row context-row">
|
|
121
|
+
<td class="context-item-name">output</td>
|
|
122
|
+
<td class="context-item-value"> [RW] </td>
|
|
123
|
+
<td class="context-item-desc"></td>
|
|
124
|
+
</tr>
|
|
125
|
+
</table>
|
|
126
|
+
</div>
|
|
127
|
+
</div>
|
|
128
|
+
|
|
129
|
+
|
|
130
|
+
|
|
131
|
+
<!-- if method_list -->
|
|
132
|
+
<div id="methods">
|
|
133
|
+
<h3 class="section-bar">Public Class methods</h3>
|
|
134
|
+
|
|
135
|
+
<div id="method-M000078" class="method-detail">
|
|
136
|
+
<a name="M000078"></a>
|
|
137
|
+
|
|
138
|
+
<div class="method-heading">
|
|
139
|
+
<a href="Response.src/M000078.html" target="Code" class="method-signature"
|
|
140
|
+
onclick="popupCode('Response.src/M000078.html');return false;">
|
|
141
|
+
<span class="method-name">new</span><span class="method-args">( output )</span>
|
|
142
|
+
</a>
|
|
143
|
+
</div>
|
|
144
|
+
|
|
145
|
+
<div class="method-description">
|
|
146
|
+
</div>
|
|
147
|
+
</div>
|
|
148
|
+
|
|
149
|
+
<h3 class="section-bar">Public Instance methods</h3>
|
|
150
|
+
|
|
151
|
+
<div id="method-M000084" class="method-detail">
|
|
152
|
+
<a name="M000084"></a>
|
|
153
|
+
|
|
154
|
+
<div class="method-heading">
|
|
155
|
+
<a href="Response.src/M000084.html" target="Code" class="method-signature"
|
|
156
|
+
onclick="popupCode('Response.src/M000084.html');return false;">
|
|
157
|
+
<span class="method-name">flush</span><span class="method-args">()</span>
|
|
158
|
+
</a>
|
|
159
|
+
</div>
|
|
160
|
+
|
|
161
|
+
<div class="method-description">
|
|
162
|
+
</div>
|
|
163
|
+
</div>
|
|
164
|
+
|
|
165
|
+
<div id="method-M000080" class="method-detail">
|
|
166
|
+
<a name="M000080"></a>
|
|
167
|
+
|
|
168
|
+
<div class="method-heading">
|
|
169
|
+
<a href="Response.src/M000080.html" target="Code" class="method-signature"
|
|
170
|
+
onclick="popupCode('Response.src/M000080.html');return false;">
|
|
171
|
+
<span class="method-name">partial_buffer</span><span class="method-args">()</span>
|
|
172
|
+
</a>
|
|
173
|
+
</div>
|
|
174
|
+
|
|
175
|
+
<div class="method-description">
|
|
176
|
+
</div>
|
|
177
|
+
</div>
|
|
178
|
+
|
|
179
|
+
<div id="method-M000081" class="method-detail">
|
|
180
|
+
<a name="M000081"></a>
|
|
181
|
+
|
|
182
|
+
<div class="method-heading">
|
|
183
|
+
<a href="Response.src/M000081.html" target="Code" class="method-signature"
|
|
184
|
+
onclick="popupCode('Response.src/M000081.html');return false;">
|
|
185
|
+
<span class="method-name">reserve_buffer</span><span class="method-args">()</span>
|
|
186
|
+
</a>
|
|
187
|
+
</div>
|
|
188
|
+
|
|
189
|
+
<div class="method-description">
|
|
190
|
+
<p>
|
|
191
|
+
return‘s <a href="Response.html#M000078">new</a> buffer
|
|
192
|
+
</p>
|
|
193
|
+
</div>
|
|
194
|
+
</div>
|
|
195
|
+
|
|
196
|
+
<div id="method-M000082" class="method-detail">
|
|
197
|
+
<a name="M000082"></a>
|
|
198
|
+
|
|
199
|
+
<div class="method-heading">
|
|
200
|
+
<a href="Response.src/M000082.html" target="Code" class="method-signature"
|
|
201
|
+
onclick="popupCode('Response.src/M000082.html');return false;">
|
|
202
|
+
<span class="method-name">send</span><span class="method-args">()</span>
|
|
203
|
+
</a>
|
|
204
|
+
</div>
|
|
205
|
+
|
|
206
|
+
<div class="method-description">
|
|
207
|
+
</div>
|
|
208
|
+
</div>
|
|
209
|
+
|
|
210
|
+
<div id="method-M000079" class="method-detail">
|
|
211
|
+
<a name="M000079"></a>
|
|
212
|
+
|
|
213
|
+
<div class="method-heading">
|
|
214
|
+
<a href="Response.src/M000079.html" target="Code" class="method-signature"
|
|
215
|
+
onclick="popupCode('Response.src/M000079.html');return false;">
|
|
216
|
+
<span class="method-name">update_output</span><span class="method-args">(output)</span>
|
|
217
|
+
</a>
|
|
218
|
+
</div>
|
|
219
|
+
|
|
220
|
+
<div class="method-description">
|
|
221
|
+
</div>
|
|
222
|
+
</div>
|
|
223
|
+
|
|
224
|
+
<div id="method-M000083" class="method-detail">
|
|
225
|
+
<a name="M000083"></a>
|
|
226
|
+
|
|
227
|
+
<div class="method-heading">
|
|
228
|
+
<a href="Response.src/M000083.html" target="Code" class="method-signature"
|
|
229
|
+
onclick="popupCode('Response.src/M000083.html');return false;">
|
|
230
|
+
<span class="method-name">wait_thread</span><span class="method-args">(thread)</span>
|
|
231
|
+
</a>
|
|
232
|
+
</div>
|
|
233
|
+
|
|
234
|
+
<div class="method-description">
|
|
235
|
+
</div>
|
|
236
|
+
</div>
|
|
237
|
+
|
|
238
|
+
|
|
239
|
+
</div>
|
|
240
|
+
|
|
241
|
+
|
|
242
|
+
</div>
|
|
243
|
+
|
|
244
|
+
|
|
245
|
+
<div id="validator-badges">
|
|
246
|
+
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
|
|
247
|
+
</div>
|
|
248
|
+
|
|
249
|
+
</body>
|
|
250
|
+
</html>
|