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.
Files changed (200) hide show
  1. data/ext/esi/esi_parser.c +1 -0
  2. data/ext/esi/extconf.rb +2 -0
  3. data/ext/esi/parser.c +2 -2
  4. data/ext/esi/parser.h +2 -0
  5. data/ext/esi/parser.rl +2 -2
  6. data/ext/esi/test/common.rl +46 -0
  7. data/ext/esi/test/parser.c +1901 -0
  8. data/ext/esi/test/parser.h +127 -0
  9. data/ext/esi/test/parser.rl +611 -0
  10. data/ext/esi/test/test.c +2 -2
  11. data/lib/esi/cache.rb +1 -1
  12. data/lib/esi/version.rb +1 -1
  13. data/test/benchmarks/perf-trunk-n1000-c1.csv +100 -100
  14. data/test/benchmarks/perf-trunk-n1000-c2.csv +100 -100
  15. data/test/benchmarks/perf-trunk-n1000-c3.csv +100 -100
  16. data/test/benchmarks/perf-trunk-n1000-c4.csv +100 -100
  17. data/test/benchmarks/perf-trunk-n1000-c5.csv +100 -100
  18. data/test/integration/docs/large-no-cache.html +688 -0
  19. data/test/integration/handler_test.rb +7 -2
  20. data/test/load_test_ab.rb +1 -1
  21. metadata +7 -222
  22. data/doc/rdoc/classes/ESI/CParser.html +0 -122
  23. data/doc/rdoc/classes/ESI/Cache.html +0 -178
  24. data/doc/rdoc/classes/ESI/Cache.src/M000087.html +0 -17
  25. data/doc/rdoc/classes/ESI/Cache.src/M000088.html +0 -20
  26. data/doc/rdoc/classes/ESI/Config.html +0 -314
  27. data/doc/rdoc/classes/ESI/Config.src/M000049.html +0 -18
  28. data/doc/rdoc/classes/ESI/Config.src/M000050.html +0 -18
  29. data/doc/rdoc/classes/ESI/Config.src/M000051.html +0 -35
  30. data/doc/rdoc/classes/ESI/Config.src/M000052.html +0 -40
  31. data/doc/rdoc/classes/ESI/Config.src/M000053.html +0 -23
  32. data/doc/rdoc/classes/ESI/Config.src/M000054.html +0 -18
  33. data/doc/rdoc/classes/ESI/Config.src/M000055.html +0 -20
  34. data/doc/rdoc/classes/ESI/Config.src/M000056.html +0 -24
  35. data/doc/rdoc/classes/ESI/Config/CacheConfig.html +0 -212
  36. data/doc/rdoc/classes/ESI/Config/CacheConfig.src/M000060.html +0 -19
  37. data/doc/rdoc/classes/ESI/Config/CacheConfig.src/M000061.html +0 -19
  38. data/doc/rdoc/classes/ESI/Config/CacheConfig.src/M000062.html +0 -18
  39. data/doc/rdoc/classes/ESI/Config/CacheConfig.src/M000063.html +0 -18
  40. data/doc/rdoc/classes/ESI/Config/CacheConfig.src/M000064.html +0 -18
  41. data/doc/rdoc/classes/ESI/Config/ConfigRouter.html +0 -187
  42. data/doc/rdoc/classes/ESI/Config/ConfigRouter.src/M000057.html +0 -19
  43. data/doc/rdoc/classes/ESI/Config/ConfigRouter.src/M000058.html +0 -21
  44. data/doc/rdoc/classes/ESI/Config/ConfigRouter.src/M000059.html +0 -21
  45. data/doc/rdoc/classes/ESI/Dispatcher.html +0 -174
  46. data/doc/rdoc/classes/ESI/Dispatcher.src/M000092.html +0 -19
  47. data/doc/rdoc/classes/ESI/Dispatcher.src/M000093.html +0 -27
  48. data/doc/rdoc/classes/ESI/Fragment.html +0 -218
  49. data/doc/rdoc/classes/ESI/Fragment.src/M000111.html +0 -20
  50. data/doc/rdoc/classes/ESI/Fragment.src/M000112.html +0 -18
  51. data/doc/rdoc/classes/ESI/Fragment.src/M000113.html +0 -18
  52. data/doc/rdoc/classes/ESI/Invalidator.html +0 -131
  53. data/doc/rdoc/classes/ESI/Invalidator.src/M000004.html +0 -41
  54. data/doc/rdoc/classes/ESI/Log.html +0 -221
  55. data/doc/rdoc/classes/ESI/Log.src/M000030.html +0 -18
  56. data/doc/rdoc/classes/ESI/Log.src/M000031.html +0 -18
  57. data/doc/rdoc/classes/ESI/Log.src/M000032.html +0 -18
  58. data/doc/rdoc/classes/ESI/Log.src/M000033.html +0 -18
  59. data/doc/rdoc/classes/ESI/Log.src/M000034.html +0 -18
  60. data/doc/rdoc/classes/ESI/Log.src/M000035.html +0 -18
  61. data/doc/rdoc/classes/ESI/Log.src/M000036.html +0 -18
  62. data/doc/rdoc/classes/ESI/MemcachedCache.html +0 -314
  63. data/doc/rdoc/classes/ESI/MemcachedCache.src/M000037.html +0 -24
  64. data/doc/rdoc/classes/ESI/MemcachedCache.src/M000038.html +0 -22
  65. data/doc/rdoc/classes/ESI/MemcachedCache.src/M000039.html +0 -19
  66. data/doc/rdoc/classes/ESI/MemcachedCache.src/M000040.html +0 -23
  67. data/doc/rdoc/classes/ESI/MemcachedCache.src/M000041.html +0 -18
  68. data/doc/rdoc/classes/ESI/MemcachedCache.src/M000042.html +0 -19
  69. data/doc/rdoc/classes/ESI/MemcachedCache.src/M000043.html +0 -18
  70. data/doc/rdoc/classes/ESI/MemcachedCache.src/M000044.html +0 -18
  71. data/doc/rdoc/classes/ESI/MemcachedCache.src/M000045.html +0 -17
  72. data/doc/rdoc/classes/ESI/OutputAdapter.html +0 -204
  73. data/doc/rdoc/classes/ESI/OutputAdapter.src/M000094.html +0 -37
  74. data/doc/rdoc/classes/ESI/OutputAdapter.src/M000095.html +0 -18
  75. data/doc/rdoc/classes/ESI/OutputAdapter.src/M000096.html +0 -18
  76. data/doc/rdoc/classes/ESI/OutputAdapter.src/M000097.html +0 -18
  77. data/doc/rdoc/classes/ESI/Parser.html +0 -184
  78. data/doc/rdoc/classes/ESI/Parser.src/M000065.html +0 -51
  79. data/doc/rdoc/classes/ESI/Parser.src/M000066.html +0 -39
  80. data/doc/rdoc/classes/ESI/Parser.src/M000067.html +0 -19
  81. data/doc/rdoc/classes/ESI/Processor.html +0 -194
  82. data/doc/rdoc/classes/ESI/Processor.src/M000046.html +0 -26
  83. data/doc/rdoc/classes/ESI/Processor.src/M000047.html +0 -44
  84. data/doc/rdoc/classes/ESI/Processor.src/M000048.html +0 -26
  85. data/doc/rdoc/classes/ESI/Proxy.html +0 -304
  86. data/doc/rdoc/classes/ESI/Proxy.src/M000071.html +0 -20
  87. data/doc/rdoc/classes/ESI/Proxy.src/M000072.html +0 -63
  88. data/doc/rdoc/classes/ESI/Proxy.src/M000073.html +0 -62
  89. data/doc/rdoc/classes/ESI/Proxy.src/M000074.html +0 -24
  90. data/doc/rdoc/classes/ESI/Proxy.src/M000075.html +0 -19
  91. data/doc/rdoc/classes/ESI/Proxy.src/M000076.html +0 -22
  92. data/doc/rdoc/classes/ESI/Proxy.src/M000077.html +0 -18
  93. data/doc/rdoc/classes/ESI/Proxy.src/M000078.html +0 -28
  94. data/doc/rdoc/classes/ESI/Proxy.src/M000079.html +0 -29
  95. data/doc/rdoc/classes/ESI/RackAdapter.html +0 -214
  96. data/doc/rdoc/classes/ESI/RackAdapter.src/M000068.html +0 -18
  97. data/doc/rdoc/classes/ESI/RackAdapter.src/M000069.html +0 -34
  98. data/doc/rdoc/classes/ESI/RackAdapter.src/M000070.html +0 -17
  99. data/doc/rdoc/classes/ESI/RackConfig.html +0 -173
  100. data/doc/rdoc/classes/ESI/RackConfig.src/M000089.html +0 -28
  101. data/doc/rdoc/classes/ESI/RackConfig.src/M000090.html +0 -18
  102. data/doc/rdoc/classes/ESI/RackConfig.src/M000091.html +0 -20
  103. data/doc/rdoc/classes/ESI/Request.html +0 -158
  104. data/doc/rdoc/classes/ESI/Request.src/M000098.html +0 -18
  105. data/doc/rdoc/classes/ESI/Request.src/M000099.html +0 -18
  106. data/doc/rdoc/classes/ESI/Response.html +0 -250
  107. data/doc/rdoc/classes/ESI/Response.src/M000080.html +0 -23
  108. data/doc/rdoc/classes/ESI/Response.src/M000081.html +0 -18
  109. data/doc/rdoc/classes/ESI/Response.src/M000082.html +0 -21
  110. data/doc/rdoc/classes/ESI/Response.src/M000083.html +0 -20
  111. data/doc/rdoc/classes/ESI/Response.src/M000084.html +0 -25
  112. data/doc/rdoc/classes/ESI/Response.src/M000085.html +0 -18
  113. data/doc/rdoc/classes/ESI/Response.src/M000086.html +0 -33
  114. data/doc/rdoc/classes/ESI/Router.html +0 -212
  115. data/doc/rdoc/classes/ESI/Router.src/M000109.html +0 -36
  116. data/doc/rdoc/classes/ESI/Router.src/M000110.html +0 -25
  117. data/doc/rdoc/classes/ESI/RubyCache.html +0 -278
  118. data/doc/rdoc/classes/ESI/RubyCache.src/M000100.html +0 -20
  119. data/doc/rdoc/classes/ESI/RubyCache.src/M000101.html +0 -20
  120. data/doc/rdoc/classes/ESI/RubyCache.src/M000102.html +0 -20
  121. data/doc/rdoc/classes/ESI/RubyCache.src/M000103.html +0 -22
  122. data/doc/rdoc/classes/ESI/RubyCache.src/M000104.html +0 -18
  123. data/doc/rdoc/classes/ESI/RubyCache.src/M000105.html +0 -22
  124. data/doc/rdoc/classes/ESI/RubyCache.src/M000106.html +0 -18
  125. data/doc/rdoc/classes/ESI/RubyCache.src/M000107.html +0 -18
  126. data/doc/rdoc/classes/ESI/RubyCache.src/M000108.html +0 -18
  127. data/doc/rdoc/classes/ESI/Tag.html +0 -141
  128. data/doc/rdoc/classes/ESI/Tag/Attempt.html +0 -113
  129. data/doc/rdoc/classes/ESI/Tag/Base.html +0 -237
  130. data/doc/rdoc/classes/ESI/Tag/Base.src/M000026.html +0 -23
  131. data/doc/rdoc/classes/ESI/Tag/Base.src/M000027.html +0 -22
  132. data/doc/rdoc/classes/ESI/Tag/Base.src/M000028.html +0 -22
  133. data/doc/rdoc/classes/ESI/Tag/Base.src/M000029.html +0 -17
  134. data/doc/rdoc/classes/ESI/Tag/Container.html +0 -206
  135. data/doc/rdoc/classes/ESI/Tag/Container.src/M000015.html +0 -20
  136. data/doc/rdoc/classes/ESI/Tag/Container.src/M000016.html +0 -22
  137. data/doc/rdoc/classes/ESI/Tag/Container.src/M000017.html +0 -25
  138. data/doc/rdoc/classes/ESI/Tag/Except.html +0 -184
  139. data/doc/rdoc/classes/ESI/Tag/Except.src/M000018.html +0 -21
  140. data/doc/rdoc/classes/ESI/Tag/Except.src/M000019.html +0 -20
  141. data/doc/rdoc/classes/ESI/Tag/Except.src/M000020.html +0 -18
  142. data/doc/rdoc/classes/ESI/Tag/Include.html +0 -257
  143. data/doc/rdoc/classes/ESI/Tag/Include.src/M000005.html +0 -20
  144. data/doc/rdoc/classes/ESI/Tag/Include.src/M000006.html +0 -18
  145. data/doc/rdoc/classes/ESI/Tag/Include.src/M000007.html +0 -34
  146. data/doc/rdoc/classes/ESI/Tag/Include.src/M000008.html +0 -22
  147. data/doc/rdoc/classes/ESI/Tag/Include.src/M000009.html +0 -27
  148. data/doc/rdoc/classes/ESI/Tag/Include.src/M000010.html +0 -30
  149. data/doc/rdoc/classes/ESI/Tag/Include.src/M000011.html +0 -51
  150. data/doc/rdoc/classes/ESI/Tag/Include/Request.html +0 -199
  151. data/doc/rdoc/classes/ESI/Tag/Include/Request.src/M000012.html +0 -18
  152. data/doc/rdoc/classes/ESI/Tag/Include/Request.src/M000013.html +0 -44
  153. data/doc/rdoc/classes/ESI/Tag/Include/Request/Error.html +0 -155
  154. data/doc/rdoc/classes/ESI/Tag/Include/Request/Error.src/M000014.html +0 -19
  155. data/doc/rdoc/classes/ESI/Tag/Invalidate.html +0 -171
  156. data/doc/rdoc/classes/ESI/Tag/Invalidate.src/M000023.html +0 -19
  157. data/doc/rdoc/classes/ESI/Tag/Invalidate.src/M000024.html +0 -51
  158. data/doc/rdoc/classes/ESI/Tag/Invalidate.src/M000025.html +0 -19
  159. data/doc/rdoc/classes/ESI/Tag/Try.html +0 -154
  160. data/doc/rdoc/classes/ESI/Tag/Try.src/M000021.html +0 -38
  161. data/doc/rdoc/classes/ESI/Tag/Try.src/M000022.html +0 -18
  162. data/doc/rdoc/classes/MultiDirHandler.html +0 -198
  163. data/doc/rdoc/classes/MultiDirHandler.src/M000001.html +0 -20
  164. data/doc/rdoc/classes/MultiDirHandler.src/M000002.html +0 -28
  165. data/doc/rdoc/classes/MultiDirHandler.src/M000003.html +0 -22
  166. data/doc/rdoc/created.rid +0 -1
  167. data/doc/rdoc/files/COPYING.html +0 -167
  168. data/doc/rdoc/files/LICENSE.html +0 -605
  169. data/doc/rdoc/files/README.html +0 -361
  170. data/doc/rdoc/files/ext/esi/common_rl.html +0 -160
  171. data/doc/rdoc/files/ext/esi/esi_parser_c.html +0 -101
  172. data/doc/rdoc/files/ext/esi/parser_c.html +0 -101
  173. data/doc/rdoc/files/ext/esi/parser_h.html +0 -101
  174. data/doc/rdoc/files/ext/esi/parser_rl.html +0 -867
  175. data/doc/rdoc/files/ext/esi/test/test_c.html +0 -101
  176. data/doc/rdoc/files/lib/esi/cache_rb.html +0 -120
  177. data/doc/rdoc/files/lib/esi/config_rb.html +0 -115
  178. data/doc/rdoc/files/lib/esi/dispatcher_rb.html +0 -110
  179. data/doc/rdoc/files/lib/esi/invalidator_rb.html +0 -114
  180. data/doc/rdoc/files/lib/esi/logger_rb.html +0 -108
  181. data/doc/rdoc/files/lib/esi/parser_rb.html +0 -120
  182. data/doc/rdoc/files/lib/esi/processor_rb.html +0 -115
  183. data/doc/rdoc/files/lib/esi/proxy_rb.html +0 -123
  184. data/doc/rdoc/files/lib/esi/rack_adapter_rb.html +0 -117
  185. data/doc/rdoc/files/lib/esi/response_rb.html +0 -116
  186. data/doc/rdoc/files/lib/esi/router_rb.html +0 -107
  187. data/doc/rdoc/files/lib/esi/tag/attempt_rb.html +0 -114
  188. data/doc/rdoc/files/lib/esi/tag/base_rb.html +0 -114
  189. data/doc/rdoc/files/lib/esi/tag/container_rb.html +0 -115
  190. data/doc/rdoc/files/lib/esi/tag/except_rb.html +0 -114
  191. data/doc/rdoc/files/lib/esi/tag/include_rb.html +0 -116
  192. data/doc/rdoc/files/lib/esi/tag/invalidate_rb.html +0 -115
  193. data/doc/rdoc/files/lib/esi/tag/try_rb.html +0 -115
  194. data/doc/rdoc/files/lib/esi/version_rb.html +0 -101
  195. data/doc/rdoc/files/lib/multi_dirhandler_rb.html +0 -109
  196. data/doc/rdoc/fr_class_index.html +0 -57
  197. data/doc/rdoc/fr_file_index.html +0 -55
  198. data/doc/rdoc/fr_method_index.html +0 -139
  199. data/doc/rdoc/index.html +0 -24
  200. data/doc/rdoc/rdoc-style.css +0 -208
@@ -1,62 +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_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 77</span>
14
- 77: <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
- 78: <span class="ruby-identifier">status</span> = <span class="ruby-identifier">read_status</span>( <span class="ruby-identifier">proxy_response</span> )
16
- 79:
17
- 80: <span class="ruby-identifier">headers</span> = <span class="ruby-identifier">copy_headers</span>( <span class="ruby-identifier">proxy_response</span> )
18
- 81:
19
- 82: <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">&quot;Surrogate-Control&quot;</span>]
20
- 83: <span class="ruby-ivar">@control</span> = {}
21
- 84: <span class="ruby-identifier">proxy_response</span>.<span class="ruby-identifier">header</span>[<span class="ruby-value str">&quot;Surrogate-Control&quot;</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
- 85: <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
- 86: <span class="ruby-ivar">@control</span>[<span class="ruby-identifier">k</span>] = <span class="ruby-identifier">v</span>
24
- 87: <span class="ruby-keyword kw">end</span>
25
- 88: <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">&gt;</span> <span class="ruby-value">0</span>
26
- 89: <span class="ruby-ivar">@cache_buffer</span> = <span class="ruby-constant">StringIO</span>.<span class="ruby-identifier">new</span>
27
- 90: <span class="ruby-keyword kw">end</span>
28
- 91: <span class="ruby-keyword kw">end</span>
29
- 92:
30
- 93: <span class="ruby-comment cmt"># build the initial HTTP HEAD response</span>
31
- 94: <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>]]
32
- 95: <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">&lt;&lt;</span> <span class="ruby-node">&quot;#{k}: #{v}\r\n&quot;</span> }
33
- 96:
34
- 97: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">status</span> <span class="ruby-operator">&gt;=</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> )
35
- 98: <span class="ruby-identifier">http_response</span>.<span class="ruby-identifier">write</span> <span class="ruby-identifier">header</span>
36
- 99: <span class="ruby-identifier">http_response</span>.<span class="ruby-identifier">write</span> <span class="ruby-value str">&quot;\r\n&quot;</span>
37
- 100: <span class="ruby-identifier">proxy_direct</span>( <span class="ruby-identifier">http_response</span>, <span class="ruby-identifier">proxy_response</span> )
38
- 101: <span class="ruby-keyword kw">elsif</span> <span class="ruby-identifier">http_request</span>.<span class="ruby-identifier">params</span>[<span class="ruby-value str">&quot;HTTP_VERSION&quot;</span>] <span class="ruby-operator">==</span> <span class="ruby-value str">&quot;HTTP/1.0&quot;</span> <span class="ruby-keyword kw">and</span> <span class="ruby-identifier">http_request</span>.<span class="ruby-identifier">params</span>[<span class="ruby-value str">&quot;REQUEST_METHOD&quot;</span>] <span class="ruby-operator">!=</span> <span class="ruby-value str">&quot;HEAD&quot;</span>
39
- 102: <span class="ruby-identifier">body</span> = <span class="ruby-identifier">proxy_response</span>.<span class="ruby-identifier">read_body</span>
40
- 103: <span class="ruby-identifier">buffer</span> = <span class="ruby-constant">StringIO</span>.<span class="ruby-identifier">new</span>
41
- 104: <span class="ruby-identifier">send_esi_buffered</span>( <span class="ruby-identifier">buffer</span>, <span class="ruby-identifier">http_request</span>, <span class="ruby-identifier">http_params</span>, <span class="ruby-identifier">body</span> )
42
- 105: <span class="ruby-identifier">buffer</span>.<span class="ruby-identifier">rewind</span>
43
- 106: <span class="ruby-identifier">header</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-node">&quot;Content-Length: #{buffer.size}\r\n\r\n&quot;</span>
44
- 107: <span class="ruby-identifier">http_response</span>.<span class="ruby-identifier">write</span>( <span class="ruby-identifier">header</span> )
45
- 108: <span class="ruby-identifier">buffer</span> = <span class="ruby-identifier">buffer</span>.<span class="ruby-identifier">read</span> <span class="ruby-comment cmt"># replace with in memory</span>
46
- 109: <span class="ruby-identifier">http_response</span>.<span class="ruby-identifier">write</span>( <span class="ruby-identifier">buffer</span> )
47
- 110: <span class="ruby-ivar">@cache_buffer</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-identifier">header</span> <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@cache_buffer</span>
48
- 111: <span class="ruby-ivar">@cache_buffer</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-identifier">buffer</span> <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@cache_buffer</span>
49
- 112: [<span class="ruby-value">0</span>,<span class="ruby-identifier">buffer</span>.<span class="ruby-identifier">size</span>]
50
- 113: <span class="ruby-keyword kw">else</span>
51
- 114: <span class="ruby-comment cmt"># write current http header into the cache</span>
52
- 115: <span class="ruby-ivar">@cache_buffer</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-identifier">header</span> <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@cache_buffer</span>
53
- 116: <span class="ruby-identifier">header</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-value str">&quot;Transfer-Encoding: chunked\r\n\r\n&quot;</span> <span class="ruby-comment cmt"># don't save this to the cache</span>
54
- 117: <span class="ruby-comment cmt"># now we don't know the content-length yet, but we save a spot for it</span>
55
- 118: <span class="ruby-ivar">@cache_buffer</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-value str">&quot;Content-Length: \r\n\r\n&quot;</span> <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@cache_buffer</span>
56
- 119: <span class="ruby-identifier">http_response</span>.<span class="ruby-identifier">write</span>( <span class="ruby-identifier">header</span> )
57
- 120: <span class="ruby-keyword kw">return</span> [<span class="ruby-value">0</span>,<span class="ruby-value">0</span>] <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">&quot;REQUEST_METHOD&quot;</span>] <span class="ruby-operator">==</span> <span class="ruby-value str">&quot;HEAD&quot;</span>
58
- 121: <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> )
59
- 122: <span class="ruby-keyword kw">end</span>
60
- 123: <span class="ruby-keyword kw">end</span></pre>
61
- </body>
62
- </html>
@@ -1,24 +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>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 125</span>
14
- 125: <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">proxy_response</span> )
15
- 126: <span class="ruby-identifier">bytes_sent</span> = <span class="ruby-value">0</span>
16
- 127: <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>
17
- 128: <span class="ruby-identifier">http_response</span>.<span class="ruby-identifier">write</span> <span class="ruby-identifier">fragment</span>
18
- 129: <span class="ruby-identifier">bytes_sent</span> <span class="ruby-operator">+=</span> <span class="ruby-identifier">fragment</span>.<span class="ruby-identifier">size</span>
19
- 130: <span class="ruby-keyword kw">end</span>
20
- 131: <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>)
21
- 132: <span class="ruby-keyword kw">return</span> [<span class="ruby-value">0</span>,<span class="ruby-identifier">bytes_sent</span>]
22
- 133: <span class="ruby-keyword kw">end</span></pre>
23
- </body>
24
- </html>
@@ -1,19 +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>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 135</span>
14
- 135: <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
- 136: <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
- 137: <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
- 138: <span class="ruby-keyword kw">end</span></pre>
18
- </body>
19
- </html>
@@ -1,22 +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_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 140</span>
14
- 140: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">send_esi_buffered</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
- 141: <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">response</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> )
16
- 142: <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> )
17
- 143: <span class="ruby-identifier">parser</span>.<span class="ruby-identifier">process</span> <span class="ruby-identifier">buffer</span>
18
- 144: <span class="ruby-identifier">parser</span>.<span class="ruby-identifier">finish</span>
19
- 145: <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>)
20
- 146: <span class="ruby-keyword kw">end</span></pre>
21
- </body>
22
- </html>
@@ -1,18 +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>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 148</span>
14
- 148: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">read_status</span>(<span class="ruby-identifier">response</span>)
15
- 149: <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
- 150: <span class="ruby-keyword kw">end</span></pre>
17
- </body>
18
- </html>
@@ -1,28 +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>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 152</span>
14
- 152: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">http_params</span>(<span class="ruby-identifier">params</span>)
15
- 153: <span class="ruby-identifier">updated_params</span> = {}
16
- 154: <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
- 155: <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
- 156: <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
- 157: <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
- 158: <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
- 159: <span class="ruby-identifier">updated_params</span>[<span class="ruby-identifier">k</span>] = <span class="ruby-identifier">v</span>
22
- 160: <span class="ruby-keyword kw">end</span>
23
- 161: <span class="ruby-keyword kw">end</span>
24
- 162: <span class="ruby-keyword kw">end</span>
25
- 163: <span class="ruby-identifier">updated_params</span>
26
- 164: <span class="ruby-keyword kw">end</span></pre>
27
- </body>
28
- </html>
@@ -1,29 +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>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 166</span>
14
- 166: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">copy_headers</span>(<span class="ruby-identifier">response</span>)
15
- 167: <span class="ruby-identifier">headers</span> = {}
16
- 168: <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
- 169: <span class="ruby-comment cmt"># for Set-Cookie we need to split on ,</span>
18
- 170: <span class="ruby-comment cmt"># some edge cases with , since things like expires might be a date with , in them.</span>
19
- 171: <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
- 172:
21
- 173: <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
- 174:
23
- 175: <span class="ruby-identifier">headers</span>[<span class="ruby-identifier">k</span>] = <span class="ruby-identifier">v</span>
24
- 176: <span class="ruby-keyword kw">end</span>
25
- 177: <span class="ruby-identifier">headers</span>[<span class="ruby-value str">&quot;Server&quot;</span>] = <span class="ruby-constant">SERVER</span>
26
- 178: <span class="ruby-identifier">headers</span>
27
- 179: <span class="ruby-keyword kw">end</span></pre>
28
- </body>
29
- </html>
@@ -1,214 +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::RackAdapter</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::RackAdapter</td>
54
- </tr>
55
- <tr class="top-aligned-row">
56
- <td><strong>In:</strong></td>
57
- <td>
58
- <a href="../../files/lib/esi/rack_adapter_rb.html">
59
- lib/esi/rack_adapter.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
- <div id="description">
82
- <pre>
83
- create wrappers for response
84
- </pre>
85
- <p>
86
- class <a href="Response.html">ESI::Response</a> &lt; Rack::Response
87
- </p>
88
- <pre>
89
- class Writer
90
- def initialize( writer )
91
- @writer = writer
92
- end
93
- def write(data)
94
- @writer.write( data )
95
- end
96
- end
97
- def socket
98
- Writer.new(self)
99
- end
100
- </pre>
101
- <p>
102
- end
103
- </p>
104
-
105
- </div>
106
-
107
-
108
- </div>
109
-
110
- <div id="method-list">
111
- <h3 class="section-bar">Methods</h3>
112
-
113
- <div class="name-list">
114
- <a href="#M000069">call</a>&nbsp;&nbsp;
115
- <a href="#M000070">each</a>&nbsp;&nbsp;
116
- <a href="#M000068">new</a>&nbsp;&nbsp;
117
- </div>
118
- </div>
119
-
120
- </div>
121
-
122
-
123
- <!-- if includes -->
124
- <div id="includes">
125
- <h3 class="section-bar">Included Modules</h3>
126
-
127
- <div id="includes-list">
128
- <span class="include-name"><a href="Log.html">ESI::Log</a></span>
129
- </div>
130
- </div>
131
-
132
- <div id="section">
133
-
134
-
135
-
136
-
137
-
138
- <div id="attribute-list">
139
- <h3 class="section-bar">Attributes</h3>
140
-
141
- <div class="name-list">
142
- <table>
143
- <tr class="top-aligned-row context-row">
144
- <td class="context-item-name">config</td>
145
- <td class="context-item-value">&nbsp;[R]&nbsp;</td>
146
- <td class="context-item-desc"></td>
147
- </tr>
148
- </table>
149
- </div>
150
- </div>
151
-
152
-
153
-
154
- <!-- if method_list -->
155
- <div id="methods">
156
- <h3 class="section-bar">Public Class methods</h3>
157
-
158
- <div id="method-M000068" class="method-detail">
159
- <a name="M000068"></a>
160
-
161
- <div class="method-heading">
162
- <a href="RackAdapter.src/M000068.html" target="Code" class="method-signature"
163
- onclick="popupCode('RackAdapter.src/M000068.html');return false;">
164
- <span class="method-name">new</span><span class="method-args">( config )</span>
165
- </a>
166
- </div>
167
-
168
- <div class="method-description">
169
- </div>
170
- </div>
171
-
172
- <h3 class="section-bar">Public Instance methods</h3>
173
-
174
- <div id="method-M000069" class="method-detail">
175
- <a name="M000069"></a>
176
-
177
- <div class="method-heading">
178
- <a href="RackAdapter.src/M000069.html" target="Code" class="method-signature"
179
- onclick="popupCode('RackAdapter.src/M000069.html');return false;">
180
- <span class="method-name">call</span><span class="method-args">(env)</span>
181
- </a>
182
- </div>
183
-
184
- <div class="method-description">
185
- </div>
186
- </div>
187
-
188
- <div id="method-M000070" class="method-detail">
189
- <a name="M000070"></a>
190
-
191
- <div class="method-heading">
192
- <a href="RackAdapter.src/M000070.html" target="Code" class="method-signature"
193
- onclick="popupCode('RackAdapter.src/M000070.html');return false;">
194
- <span class="method-name">each</span><span class="method-args">()</span>
195
- </a>
196
- </div>
197
-
198
- <div class="method-description">
199
- </div>
200
- </div>
201
-
202
-
203
- </div>
204
-
205
-
206
- </div>
207
-
208
-
209
- <div id="validator-badges">
210
- <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
211
- </div>
212
-
213
- </body>
214
- </html>
@@ -1,18 +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::RackAdapter)</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/rack_adapter.rb, line 60</span>
14
- 60: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">initialize</span>( <span class="ruby-identifier">config</span> )
15
- 61: <span class="ruby-ivar">@config</span> = <span class="ruby-identifier">config</span>
16
- 62: <span class="ruby-keyword kw">end</span></pre>
17
- </body>
18
- </html>
@@ -1,34 +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>call (ESI::RackAdapter)</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/rack_adapter.rb, line 64</span>
14
- 64: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">call</span>(<span class="ruby-identifier">env</span>)
15
- 65: <span class="ruby-identifier">start</span> = <span class="ruby-constant">Time</span>.<span class="ruby-identifier">now</span>
16
- 66: <span class="ruby-identifier">request</span> = <span class="ruby-constant">ESI</span><span class="ruby-operator">::</span><span class="ruby-constant">Request</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">env</span>)
17
- 67: <span class="ruby-identifier">puts</span> <span class="ruby-identifier">request</span>.<span class="ruby-identifier">params</span>[<span class="ruby-value str">&quot;HTTP_VERSION&quot;</span>]
18
- 68:
19
- 69: <span class="ruby-identifier">url</span> = <span class="ruby-ivar">@config</span>.<span class="ruby-identifier">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">&quot;REQUEST_URI&quot;</span>])
20
- 70:
21
- 71: <span class="ruby-identifier">chunk_count</span> = <span class="ruby-value">0</span>, <span class="ruby-identifier">bytes_sent</span> = <span class="ruby-value">0</span>, <span class="ruby-identifier">status</span> = <span class="ruby-value">200</span>, <span class="ruby-identifier">sent_from_cache</span> = <span class="ruby-keyword kw">false</span>
22
- 72: <span class="ruby-constant">Rack</span><span class="ruby-operator">::</span><span class="ruby-constant">Response</span>.<span class="ruby-identifier">new</span>.<span class="ruby-identifier">finish</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">response</span><span class="ruby-operator">|</span>
23
- 73: <span class="ruby-keyword kw">begin</span>
24
- 74: <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> = <span class="ruby-constant">ESI</span><span class="ruby-operator">::</span><span class="ruby-constant">Proxy</span>.<span class="ruby-identifier">new</span>(<span class="ruby-ivar">@config</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>)
25
- 75: <span class="ruby-keyword kw">rescue</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">e</span>
26
- 76: <span class="ruby-identifier">log_error</span> <span class="ruby-node">&quot;\n#{e.message}: error at #{e.backtrace.first} msg at #{__FILE__}:#{__LINE__}\n&quot;</span>
27
- 77: <span class="ruby-keyword kw">ensure</span>
28
- 78: <span class="ruby-identifier">log_request</span> <span class="ruby-node">&quot;\n#{url}, #{Time.now - start} seconds with status #{status} #{sent_from_cache ? &quot;from cache&quot; : ''} and #{chunk_count} chunks, #{bytes_sent} bytes\n&quot;</span>
29
- 79: <span class="ruby-keyword kw">end</span>
30
- 80: <span class="ruby-keyword kw">end</span>
31
- 81:
32
- 82: <span class="ruby-keyword kw">end</span></pre>
33
- </body>
34
- </html>