rfuzz 0.6

Sign up to get free protection for your applications and to get access to all the features.
Files changed (136) hide show
  1. data/COPYING +55 -0
  2. data/LICENSE +55 -0
  3. data/README +252 -0
  4. data/Rakefile +48 -0
  5. data/doc/rdoc/classes/RFuzz.html +146 -0
  6. data/doc/rdoc/classes/RFuzz/HttpClient.html +481 -0
  7. data/doc/rdoc/classes/RFuzz/HttpClient.src/M000010.html +24 -0
  8. data/doc/rdoc/classes/RFuzz/HttpClient.src/M000011.html +34 -0
  9. data/doc/rdoc/classes/RFuzz/HttpClient.src/M000012.html +49 -0
  10. data/doc/rdoc/classes/RFuzz/HttpClient.src/M000013.html +49 -0
  11. data/doc/rdoc/classes/RFuzz/HttpClient.src/M000014.html +57 -0
  12. data/doc/rdoc/classes/RFuzz/HttpClient.src/M000015.html +37 -0
  13. data/doc/rdoc/classes/RFuzz/HttpClient.src/M000016.html +26 -0
  14. data/doc/rdoc/classes/RFuzz/HttpClient.src/M000017.html +34 -0
  15. data/doc/rdoc/classes/RFuzz/HttpClient.src/M000018.html +18 -0
  16. data/doc/rdoc/classes/RFuzz/HttpClient.src/M000019.html +26 -0
  17. data/doc/rdoc/classes/RFuzz/HttpEncoding.html +294 -0
  18. data/doc/rdoc/classes/RFuzz/HttpEncoding.src/M000001.html +26 -0
  19. data/doc/rdoc/classes/RFuzz/HttpEncoding.src/M000002.html +18 -0
  20. data/doc/rdoc/classes/RFuzz/HttpEncoding.src/M000003.html +26 -0
  21. data/doc/rdoc/classes/RFuzz/HttpEncoding.src/M000004.html +18 -0
  22. data/doc/rdoc/classes/RFuzz/HttpEncoding.src/M000005.html +32 -0
  23. data/doc/rdoc/classes/RFuzz/HttpEncoding.src/M000006.html +18 -0
  24. data/doc/rdoc/classes/RFuzz/HttpEncoding.src/M000007.html +20 -0
  25. data/doc/rdoc/classes/RFuzz/HttpEncoding.src/M000008.html +20 -0
  26. data/doc/rdoc/classes/RFuzz/HttpEncoding.src/M000009.html +32 -0
  27. data/doc/rdoc/classes/RFuzz/HttpResponse.html +180 -0
  28. data/doc/rdoc/classes/RFuzz/Notifier.html +252 -0
  29. data/doc/rdoc/classes/RFuzz/Notifier.src/M000044.html +17 -0
  30. data/doc/rdoc/classes/RFuzz/Notifier.src/M000045.html +17 -0
  31. data/doc/rdoc/classes/RFuzz/Notifier.src/M000046.html +17 -0
  32. data/doc/rdoc/classes/RFuzz/Notifier.src/M000047.html +17 -0
  33. data/doc/rdoc/classes/RFuzz/Notifier.src/M000048.html +17 -0
  34. data/doc/rdoc/classes/RFuzz/Notifier.src/M000049.html +17 -0
  35. data/doc/rdoc/classes/RFuzz/RandomGenerator.html +362 -0
  36. data/doc/rdoc/classes/RFuzz/RandomGenerator.src/M000032.html +21 -0
  37. data/doc/rdoc/classes/RFuzz/RandomGenerator.src/M000033.html +23 -0
  38. data/doc/rdoc/classes/RFuzz/RandomGenerator.src/M000036.html +22 -0
  39. data/doc/rdoc/classes/RFuzz/RandomGenerator.src/M000037.html +20 -0
  40. data/doc/rdoc/classes/RFuzz/RandomGenerator.src/M000038.html +22 -0
  41. data/doc/rdoc/classes/RFuzz/RandomGenerator.src/M000039.html +20 -0
  42. data/doc/rdoc/classes/RFuzz/RandomGenerator.src/M000040.html +18 -0
  43. data/doc/rdoc/classes/RFuzz/RandomGenerator.src/M000041.html +18 -0
  44. data/doc/rdoc/classes/RFuzz/RandomGenerator.src/M000042.html +22 -0
  45. data/doc/rdoc/classes/RFuzz/RandomGenerator.src/M000043.html +18 -0
  46. data/doc/rdoc/classes/RFuzz/Sampler.html +383 -0
  47. data/doc/rdoc/classes/RFuzz/Sampler.src/M000056.html +19 -0
  48. data/doc/rdoc/classes/RFuzz/Sampler.src/M000057.html +23 -0
  49. data/doc/rdoc/classes/RFuzz/Sampler.src/M000058.html +26 -0
  50. data/doc/rdoc/classes/RFuzz/Sampler.src/M000059.html +18 -0
  51. data/doc/rdoc/classes/RFuzz/Sampler.src/M000060.html +18 -0
  52. data/doc/rdoc/classes/RFuzz/Sampler.src/M000061.html +18 -0
  53. data/doc/rdoc/classes/RFuzz/Sampler.src/M000062.html +18 -0
  54. data/doc/rdoc/classes/RFuzz/Sampler.src/M000063.html +19 -0
  55. data/doc/rdoc/classes/RFuzz/Sampler.src/M000064.html +18 -0
  56. data/doc/rdoc/classes/RFuzz/Sampler.src/M000065.html +23 -0
  57. data/doc/rdoc/classes/RFuzz/Sampler.src/M000066.html +18 -0
  58. data/doc/rdoc/classes/RFuzz/Sampler.src/M000067.html +20 -0
  59. data/doc/rdoc/classes/RFuzz/Session.html +415 -0
  60. data/doc/rdoc/classes/RFuzz/Session.src/M000020.html +31 -0
  61. data/doc/rdoc/classes/RFuzz/Session.src/M000021.html +18 -0
  62. data/doc/rdoc/classes/RFuzz/Session.src/M000022.html +18 -0
  63. data/doc/rdoc/classes/RFuzz/Session.src/M000023.html +34 -0
  64. data/doc/rdoc/classes/RFuzz/Session.src/M000024.html +19 -0
  65. data/doc/rdoc/classes/RFuzz/Session.src/M000025.html +19 -0
  66. data/doc/rdoc/classes/RFuzz/Session.src/M000026.html +26 -0
  67. data/doc/rdoc/classes/RFuzz/Session.src/M000027.html +29 -0
  68. data/doc/rdoc/classes/RFuzz/Session.src/M000028.html +19 -0
  69. data/doc/rdoc/classes/RFuzz/Session.src/M000029.html +18 -0
  70. data/doc/rdoc/classes/RFuzz/Session.src/M000030.html +18 -0
  71. data/doc/rdoc/classes/RFuzz/Session.src/M000031.html +23 -0
  72. data/doc/rdoc/classes/RFuzz/StatsTracker.html +242 -0
  73. data/doc/rdoc/classes/RFuzz/StatsTracker.src/M000050.html +19 -0
  74. data/doc/rdoc/classes/RFuzz/StatsTracker.src/M000051.html +19 -0
  75. data/doc/rdoc/classes/RFuzz/StatsTracker.src/M000052.html +18 -0
  76. data/doc/rdoc/classes/RFuzz/StatsTracker.src/M000053.html +18 -0
  77. data/doc/rdoc/classes/RFuzz/StatsTracker.src/M000054.html +28 -0
  78. data/doc/rdoc/classes/RFuzz/StatsTracker.src/M000055.html +18 -0
  79. data/doc/rdoc/created.rid +1 -0
  80. data/doc/rdoc/files/COPYING.html +168 -0
  81. data/doc/rdoc/files/LICENSE.html +168 -0
  82. data/doc/rdoc/files/README.html +473 -0
  83. data/doc/rdoc/files/lib/rfuzz/client_rb.html +111 -0
  84. data/doc/rdoc/files/lib/rfuzz/random_rb.html +116 -0
  85. data/doc/rdoc/files/lib/rfuzz/rfuzz_rb.html +109 -0
  86. data/doc/rdoc/files/lib/rfuzz/session_rb.html +111 -0
  87. data/doc/rdoc/files/lib/rfuzz/stats_rb.html +113 -0
  88. data/doc/rdoc/fr_class_index.html +35 -0
  89. data/doc/rdoc/fr_file_index.html +34 -0
  90. data/doc/rdoc/fr_method_index.html +93 -0
  91. data/doc/rdoc/index.html +24 -0
  92. data/doc/rdoc/rdoc-style.css +208 -0
  93. data/examples/amazon_headers.rb +38 -0
  94. data/examples/hpricot_pudding.rb +22 -0
  95. data/examples/kill_routes.rb +26 -0
  96. data/examples/mongrel_test_suite/lib/gen.rb +24 -0
  97. data/examples/mongrel_test_suite/test/camping/static_files.rb +9 -0
  98. data/examples/mongrel_test_suite/test/camping/upload_file.rb +9 -0
  99. data/examples/mongrel_test_suite/test/camping/upload_progress.rb +9 -0
  100. data/examples/mongrel_test_suite/test/http/base_protocol.rb +23 -0
  101. data/examples/mongrel_test_suite/test/nitro/upload_file.rb +9 -0
  102. data/examples/mongrel_test_suite/test/nitro/upload_progress.rb +9 -0
  103. data/examples/mongrel_test_suite/test/rails/static_files.rb +9 -0
  104. data/examples/mongrel_test_suite/test/rails/upload_file.rb +9 -0
  105. data/examples/mongrel_test_suite/test/rails/upload_progress.rb +9 -0
  106. data/examples/perftest.rb +30 -0
  107. data/ext/fuzzrnd/ext_help.h +14 -0
  108. data/ext/fuzzrnd/extconf.rb +6 -0
  109. data/ext/fuzzrnd/fuzzrnd.c +149 -0
  110. data/ext/http11_client/ext_help.h +14 -0
  111. data/ext/http11_client/extconf.rb +6 -0
  112. data/ext/http11_client/http11_client.c +288 -0
  113. data/ext/http11_client/http11_parser.c +629 -0
  114. data/ext/http11_client/http11_parser.h +46 -0
  115. data/ext/http11_client/http11_parser.rl +169 -0
  116. data/lib/rfuzz/client.rb +498 -0
  117. data/lib/rfuzz/random.rb +110 -0
  118. data/lib/rfuzz/rfuzz.rb +12 -0
  119. data/lib/rfuzz/session.rb +154 -0
  120. data/lib/rfuzz/stats.rb +159 -0
  121. data/resources/defaults.yaml +2 -0
  122. data/resources/words.txt +3310 -0
  123. data/test/coverage/index.html +388 -0
  124. data/test/coverage/lib-rfuzz-client_rb.html +1127 -0
  125. data/test/coverage/lib-rfuzz-random_rb.html +739 -0
  126. data/test/coverage/lib-rfuzz-session_rb.html +783 -0
  127. data/test/coverage/lib-rfuzz-stats_rb.html +788 -0
  128. data/test/server.rb +101 -0
  129. data/test/test_client.rb +164 -0
  130. data/test/test_fuzzrnd.rb +31 -0
  131. data/test/test_httpparser.rb +48 -0
  132. data/test/test_random.rb +75 -0
  133. data/test/test_session.rb +33 -0
  134. data/test/test_stats.rb +45 -0
  135. data/tools/rakehelp.rb +119 -0
  136. metadata +201 -0
@@ -0,0 +1,24 @@
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 (RFuzz::HttpClient)</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/rfuzz/client.rb, line 210</span>
14
+ 210: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">initialize</span>(<span class="ruby-identifier">host</span>, <span class="ruby-identifier">port</span>, <span class="ruby-identifier">options</span> = {})
15
+ 211: <span class="ruby-ivar">@options</span> = <span class="ruby-identifier">options</span>
16
+ 212: <span class="ruby-ivar">@host</span> = <span class="ruby-identifier">host</span>
17
+ 213: <span class="ruby-ivar">@port</span> = <span class="ruby-identifier">port</span>
18
+ 214: <span class="ruby-ivar">@cookies</span> = <span class="ruby-identifier">options</span>[<span class="ruby-identifier">:cookies</span>] <span class="ruby-operator">||</span> {}
19
+ 215: <span class="ruby-ivar">@allowed_methods</span> = <span class="ruby-identifier">options</span>[<span class="ruby-identifier">:allowed_methods</span>] <span class="ruby-operator">||</span> [<span class="ruby-identifier">:put</span>, <span class="ruby-identifier">:get</span>, <span class="ruby-identifier">:post</span>, <span class="ruby-identifier">:delete</span>, <span class="ruby-identifier">:head</span>]
20
+ 216: <span class="ruby-ivar">@notifier</span> = <span class="ruby-identifier">options</span>[<span class="ruby-identifier">:notifier</span>]
21
+ 217: <span class="ruby-ivar">@redirect</span> = <span class="ruby-identifier">options</span>[<span class="ruby-identifier">:redirect</span>] <span class="ruby-operator">||</span> <span class="ruby-keyword kw">false</span>
22
+ 218: <span class="ruby-keyword kw">end</span></pre>
23
+ </body>
24
+ </html>
@@ -0,0 +1,34 @@
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>build_request (RFuzz::HttpClient)</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/rfuzz/client.rb, line 226</span>
14
+ 226: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">build_request</span>(<span class="ruby-identifier">out</span>, <span class="ruby-identifier">method</span>, <span class="ruby-identifier">uri</span>, <span class="ruby-identifier">req</span>)
15
+ 227: <span class="ruby-identifier">ops</span> = <span class="ruby-ivar">@options</span>.<span class="ruby-identifier">merge</span>(<span class="ruby-identifier">req</span>)
16
+ 228: <span class="ruby-identifier">query</span> = <span class="ruby-identifier">ops</span>[<span class="ruby-identifier">:query</span>]
17
+ 229:
18
+ 230: <span class="ruby-comment cmt"># merge head differently since that's typically what they mean</span>
19
+ 231: <span class="ruby-identifier">head</span> = <span class="ruby-identifier">req</span>[<span class="ruby-identifier">:head</span>] <span class="ruby-operator">||</span> {}
20
+ 232: <span class="ruby-identifier">head</span> = <span class="ruby-identifier">ops</span>[<span class="ruby-identifier">:head</span>].<span class="ruby-identifier">merge</span>(<span class="ruby-identifier">head</span>) <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">ops</span>[<span class="ruby-identifier">:head</span>]
21
+ 233:
22
+ 234: <span class="ruby-comment cmt"># setup basic headers we always need</span>
23
+ 235: <span class="ruby-identifier">head</span>[<span class="ruby-constant">HOST</span>] = <span class="ruby-identifier">encode_host</span>(<span class="ruby-ivar">@host</span>,<span class="ruby-ivar">@port</span>)
24
+ 236: <span class="ruby-identifier">head</span>[<span class="ruby-constant">CONTENT_LENGTH</span>] = <span class="ruby-identifier">ops</span>[<span class="ruby-identifier">:body</span>] <span class="ruby-operator">?</span> <span class="ruby-identifier">ops</span>[<span class="ruby-identifier">:body</span>].<span class="ruby-identifier">length</span> <span class="ruby-operator">:</span> <span class="ruby-value">0</span>
25
+ 237:
26
+ 238: <span class="ruby-comment cmt"># blast it out</span>
27
+ 239: <span class="ruby-identifier">out</span>.<span class="ruby-identifier">write</span>(<span class="ruby-constant">HTTP_REQUEST_HEADER</span> <span class="ruby-operator">%</span> [<span class="ruby-identifier">method</span>, <span class="ruby-identifier">encode_query</span>(<span class="ruby-identifier">uri</span>,<span class="ruby-identifier">query</span>)])
28
+ 240: <span class="ruby-identifier">out</span>.<span class="ruby-identifier">write</span>(<span class="ruby-identifier">encode_headers</span>(<span class="ruby-identifier">head</span>))
29
+ 241: <span class="ruby-identifier">out</span>.<span class="ruby-identifier">write</span>(<span class="ruby-identifier">encode_cookies</span>(<span class="ruby-ivar">@cookies</span>.<span class="ruby-identifier">merge</span>(<span class="ruby-identifier">req</span>[<span class="ruby-identifier">:cookies</span>] <span class="ruby-operator">||</span> {})))
30
+ 242: <span class="ruby-identifier">out</span>.<span class="ruby-identifier">write</span>(<span class="ruby-value str">&quot;\r\n&quot;</span>)
31
+ 243: <span class="ruby-identifier">ops</span>[<span class="ruby-identifier">:body</span>] <span class="ruby-operator">||</span> <span class="ruby-value str">&quot;&quot;</span>
32
+ 244: <span class="ruby-keyword kw">end</span></pre>
33
+ </body>
34
+ </html>
@@ -0,0 +1,49 @@
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_chunks (RFuzz::HttpClient)</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/rfuzz/client.rb, line 246</span>
14
+ 246: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">read_chunks</span>(<span class="ruby-identifier">input</span>, <span class="ruby-identifier">out</span>, <span class="ruby-identifier">parser</span>)
15
+ 247: <span class="ruby-keyword kw">begin</span>
16
+ 248: <span class="ruby-keyword kw">until</span> <span class="ruby-identifier">input</span>.<span class="ruby-identifier">closed?</span>
17
+ 249: <span class="ruby-identifier">parser</span>.<span class="ruby-identifier">reset</span>
18
+ 250: <span class="ruby-identifier">chunk</span> = <span class="ruby-constant">HttpResponse</span>.<span class="ruby-identifier">new</span>
19
+ 251: <span class="ruby-identifier">line</span> = <span class="ruby-identifier">input</span>.<span class="ruby-identifier">readline</span>(<span class="ruby-value str">&quot;\r\n&quot;</span>)
20
+ 252: <span class="ruby-identifier">nread</span> = <span class="ruby-identifier">parser</span>.<span class="ruby-identifier">execute</span>(<span class="ruby-identifier">chunk</span>, <span class="ruby-identifier">line</span>, <span class="ruby-value">0</span>)
21
+ 253:
22
+ 254: <span class="ruby-keyword kw">if</span> <span class="ruby-operator">!</span><span class="ruby-identifier">parser</span>.<span class="ruby-identifier">finished?</span>
23
+ 255: <span class="ruby-comment cmt"># tried to read this header but couldn't</span>
24
+ 256: <span class="ruby-keyword kw">return</span> <span class="ruby-identifier">:incomplete_header</span>, <span class="ruby-identifier">line</span>
25
+ 257: <span class="ruby-keyword kw">end</span>
26
+ 258:
27
+ 259: <span class="ruby-identifier">size</span> = <span class="ruby-identifier">chunk</span>.<span class="ruby-identifier">http_chunk_size</span> <span class="ruby-value">? </span><span class="ruby-identifier">chunk</span>.<span class="ruby-identifier">http_chunk_size</span>.<span class="ruby-identifier">to_i</span>(<span class="ruby-identifier">base</span>=<span class="ruby-value">16</span>) <span class="ruby-operator">:</span> <span class="ruby-value">0</span>
28
+ 260:
29
+ 261: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">size</span> <span class="ruby-operator">==</span> <span class="ruby-value">0</span>
30
+ 262: <span class="ruby-keyword kw">return</span> <span class="ruby-identifier">:finished</span>, <span class="ruby-keyword kw">nil</span>
31
+ 263: <span class="ruby-keyword kw">end</span>
32
+ 264: <span class="ruby-identifier">remain</span> = <span class="ruby-identifier">size</span> <span class="ruby-operator">-</span><span class="ruby-identifier">out</span>.<span class="ruby-identifier">write</span>(<span class="ruby-identifier">input</span>.<span class="ruby-identifier">read</span>(<span class="ruby-identifier">size</span>))
33
+ 265: <span class="ruby-keyword kw">return</span> <span class="ruby-identifier">:incomplete_body</span>, <span class="ruby-identifier">remain</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">remain</span> <span class="ruby-operator">&gt;</span> <span class="ruby-value">0</span>
34
+ 266:
35
+ 267: <span class="ruby-identifier">line</span> = <span class="ruby-identifier">input</span>.<span class="ruby-identifier">read</span>(<span class="ruby-value">2</span>)
36
+ 268: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">line</span>.<span class="ruby-identifier">nil?</span> <span class="ruby-keyword kw">or</span> <span class="ruby-identifier">line</span>.<span class="ruby-identifier">length</span> <span class="ruby-operator">&lt;</span> <span class="ruby-value">2</span>
37
+ 269: <span class="ruby-keyword kw">return</span> <span class="ruby-identifier">:incomplete_trailer</span>, <span class="ruby-identifier">line</span>
38
+ 270: <span class="ruby-keyword kw">elsif</span> <span class="ruby-identifier">line</span> <span class="ruby-operator">!=</span> <span class="ruby-value str">&quot;\r\n&quot;</span>
39
+ 271: <span class="ruby-identifier">raise</span> <span class="ruby-constant">HttpClientParserError</span>.<span class="ruby-identifier">new</span>(<span class="ruby-value str">&quot;invalid chunked encoding trailer&quot;</span>)
40
+ 272: <span class="ruby-keyword kw">end</span>
41
+ 273: <span class="ruby-keyword kw">end</span>
42
+ 274: <span class="ruby-keyword kw">rescue</span> <span class="ruby-constant">EOFError</span>
43
+ 275: <span class="ruby-comment cmt"># this is thrown when the header read is attempted and </span>
44
+ 276: <span class="ruby-comment cmt"># there's nothing in the buffer</span>
45
+ 277: <span class="ruby-keyword kw">return</span> <span class="ruby-identifier">:eof_error</span>, <span class="ruby-keyword kw">nil</span>
46
+ 278: <span class="ruby-keyword kw">end</span>
47
+ 279: <span class="ruby-keyword kw">end</span></pre>
48
+ </body>
49
+ </html>
@@ -0,0 +1,49 @@
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_chunked_encoding (RFuzz::HttpClient)</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/rfuzz/client.rb, line 281</span>
14
+ 281: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">read_chunked_encoding</span>(<span class="ruby-identifier">resp</span>, <span class="ruby-identifier">sock</span>, <span class="ruby-identifier">parser</span>)
15
+ 282: <span class="ruby-identifier">out</span> = <span class="ruby-constant">StringIO</span>.<span class="ruby-identifier">new</span>
16
+ 283: <span class="ruby-identifier">input</span> = <span class="ruby-constant">StringIO</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">resp</span>.<span class="ruby-identifier">http_body</span>)
17
+ 284:
18
+ 285: <span class="ruby-comment cmt"># read from the http body first, then continue at the socket</span>
19
+ 286: <span class="ruby-identifier">status</span>, <span class="ruby-identifier">result</span> = <span class="ruby-identifier">read_chunks</span>(<span class="ruby-identifier">input</span>, <span class="ruby-identifier">out</span>, <span class="ruby-identifier">parser</span>)
20
+ 287:
21
+ 288: <span class="ruby-keyword kw">case</span> <span class="ruby-identifier">status</span>
22
+ 289: <span class="ruby-keyword kw">when</span> <span class="ruby-identifier">:incomplete_trailer</span>
23
+ 290: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">result</span>.<span class="ruby-identifier">nil?</span>
24
+ 291: <span class="ruby-identifier">sock</span>.<span class="ruby-identifier">read</span>(<span class="ruby-value">2</span>)
25
+ 292: <span class="ruby-keyword kw">else</span>
26
+ 293: <span class="ruby-identifier">sock</span>.<span class="ruby-identifier">read</span>(<span class="ruby-identifier">result</span>.<span class="ruby-identifier">length</span> <span class="ruby-operator">-</span> <span class="ruby-value">2</span>)
27
+ 294: <span class="ruby-keyword kw">end</span>
28
+ 295: <span class="ruby-keyword kw">when</span> <span class="ruby-identifier">:incomplete_body</span>
29
+ 296: <span class="ruby-identifier">out</span>.<span class="ruby-identifier">write</span>(<span class="ruby-identifier">sock</span>.<span class="ruby-identifier">read</span>(<span class="ruby-identifier">result</span>)) <span class="ruby-comment cmt"># read the remaining</span>
30
+ 297: <span class="ruby-identifier">sock</span>.<span class="ruby-identifier">read</span>(<span class="ruby-value">2</span>)
31
+ 298: <span class="ruby-keyword kw">when</span> <span class="ruby-identifier">:incomplete_header</span>
32
+ 299: <span class="ruby-comment cmt"># push what we read back onto the socket, but backwards</span>
33
+ 300: <span class="ruby-identifier">result</span>.<span class="ruby-identifier">reverse!</span>
34
+ 301: <span class="ruby-identifier">result</span>.<span class="ruby-identifier">each_byte</span> {<span class="ruby-operator">|</span><span class="ruby-identifier">b</span><span class="ruby-operator">|</span> <span class="ruby-identifier">sock</span>.<span class="ruby-identifier">ungetc</span>(<span class="ruby-identifier">b</span>) }
35
+ 302: <span class="ruby-keyword kw">when</span> <span class="ruby-identifier">:finished</span>
36
+ 303: <span class="ruby-comment cmt"># all done, get out</span>
37
+ 304: <span class="ruby-identifier">out</span>.<span class="ruby-identifier">rewind</span>; <span class="ruby-keyword kw">return</span> <span class="ruby-identifier">out</span>.<span class="ruby-identifier">read</span>
38
+ 305: <span class="ruby-keyword kw">when</span> <span class="ruby-identifier">:eof_error</span>
39
+ 306: <span class="ruby-comment cmt"># read everything we could, ignore</span>
40
+ 307: <span class="ruby-keyword kw">end</span>
41
+ 308:
42
+ 309: <span class="ruby-comment cmt"># then continue reading them from the socket</span>
43
+ 310: <span class="ruby-identifier">status</span>, <span class="ruby-identifier">result</span> = <span class="ruby-identifier">read_chunks</span>(<span class="ruby-identifier">sock</span>, <span class="ruby-identifier">out</span>, <span class="ruby-identifier">parser</span>)
44
+ 311:
45
+ 312: <span class="ruby-comment cmt"># and now the http_body is the chunk</span>
46
+ 313: <span class="ruby-identifier">out</span>.<span class="ruby-identifier">rewind</span>; <span class="ruby-keyword kw">return</span> <span class="ruby-identifier">out</span>.<span class="ruby-identifier">read</span>
47
+ 314: <span class="ruby-keyword kw">end</span></pre>
48
+ </body>
49
+ </html>
@@ -0,0 +1,57 @@
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_response (RFuzz::HttpClient)</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/rfuzz/client.rb, line 323</span>
14
+ 323: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">read_response</span>(<span class="ruby-identifier">sock</span>)
15
+ 324: <span class="ruby-identifier">data</span>, <span class="ruby-identifier">resp</span> = <span class="ruby-keyword kw">nil</span>, <span class="ruby-keyword kw">nil</span>
16
+ 325: <span class="ruby-identifier">parser</span> = <span class="ruby-constant">HttpClientParser</span>.<span class="ruby-identifier">new</span>
17
+ 326: <span class="ruby-identifier">resp</span> = <span class="ruby-constant">HttpResponse</span>.<span class="ruby-identifier">new</span>
18
+ 327:
19
+ 328: <span class="ruby-identifier">notify</span> <span class="ruby-identifier">:read_header</span> <span class="ruby-keyword kw">do</span>
20
+ 329: <span class="ruby-identifier">data</span> = <span class="ruby-identifier">sock</span>.<span class="ruby-identifier">readpartial</span>(<span class="ruby-value">1024</span>)
21
+ 330: <span class="ruby-identifier">nread</span> = <span class="ruby-identifier">parser</span>.<span class="ruby-identifier">execute</span>(<span class="ruby-identifier">resp</span>, <span class="ruby-identifier">data</span>, <span class="ruby-value">0</span>)
22
+ 331:
23
+ 332: <span class="ruby-keyword kw">while</span> <span class="ruby-keyword kw">not</span> <span class="ruby-identifier">parser</span>.<span class="ruby-identifier">finished?</span>
24
+ 333: <span class="ruby-identifier">data</span> <span class="ruby-operator">+=</span> <span class="ruby-identifier">sock</span>.<span class="ruby-identifier">readpartial</span>(<span class="ruby-value">1024</span>)
25
+ 334: <span class="ruby-identifier">nread</span> <span class="ruby-operator">+=</span> <span class="ruby-identifier">parser</span>.<span class="ruby-identifier">execute</span>(<span class="ruby-identifier">resp</span>, <span class="ruby-identifier">data</span>, <span class="ruby-identifier">nread</span>)
26
+ 335: <span class="ruby-keyword kw">end</span>
27
+ 336: <span class="ruby-keyword kw">end</span>
28
+ 337:
29
+ 338: <span class="ruby-identifier">notify</span> <span class="ruby-identifier">:read_body</span> <span class="ruby-keyword kw">do</span>
30
+ 339: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">resp</span>[<span class="ruby-constant">TRANSFER_ENCODING</span>] <span class="ruby-keyword kw">and</span> <span class="ruby-identifier">resp</span>[<span class="ruby-constant">TRANSFER_ENCODING</span>].<span class="ruby-identifier">index</span>(<span class="ruby-value str">&quot;chunked&quot;</span>)
31
+ 340: <span class="ruby-identifier">resp</span>.<span class="ruby-identifier">http_body</span> = <span class="ruby-identifier">read_chunked_encoding</span>(<span class="ruby-identifier">resp</span>, <span class="ruby-identifier">sock</span>, <span class="ruby-identifier">parser</span>)
32
+ 341: <span class="ruby-keyword kw">elsif</span> <span class="ruby-identifier">resp</span>[<span class="ruby-constant">CONTENT_LENGTH</span>]
33
+ 342: <span class="ruby-identifier">cl</span> = <span class="ruby-identifier">resp</span>[<span class="ruby-constant">CONTENT_LENGTH</span>].<span class="ruby-identifier">to_i</span>
34
+ 343: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">cl</span> <span class="ruby-operator">-</span> <span class="ruby-identifier">resp</span>.<span class="ruby-identifier">http_body</span>.<span class="ruby-identifier">length</span> <span class="ruby-operator">&gt;</span> <span class="ruby-value">0</span>
35
+ 344: <span class="ruby-identifier">resp</span>.<span class="ruby-identifier">http_body</span> <span class="ruby-operator">+=</span> <span class="ruby-identifier">sock</span>.<span class="ruby-identifier">read</span>(<span class="ruby-identifier">cl</span> <span class="ruby-operator">-</span> <span class="ruby-identifier">resp</span>.<span class="ruby-identifier">http_body</span>.<span class="ruby-identifier">length</span>)
36
+ 345: <span class="ruby-keyword kw">elsif</span> <span class="ruby-identifier">cl</span> <span class="ruby-operator">&lt;</span> <span class="ruby-identifier">resp</span>.<span class="ruby-identifier">http_body</span>.<span class="ruby-identifier">length</span>
37
+ 346: <span class="ruby-constant">STDERR</span>.<span class="ruby-identifier">puts</span> <span class="ruby-node">&quot;Web site sucks, they said Content-Length: #{cl}, but sent a longer body length: #{resp.http_body.length}&quot;</span>
38
+ 347: <span class="ruby-keyword kw">end</span>
39
+ 348: <span class="ruby-keyword kw">else</span>
40
+ 349: <span class="ruby-identifier">resp</span>.<span class="ruby-identifier">http_body</span> <span class="ruby-operator">+=</span> <span class="ruby-identifier">sock</span>.<span class="ruby-identifier">read</span>
41
+ 350: <span class="ruby-keyword kw">end</span>
42
+ 351: <span class="ruby-keyword kw">end</span>
43
+ 352:
44
+ 353: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">resp</span>[<span class="ruby-constant">SET_COOKIE</span>]
45
+ 354: <span class="ruby-identifier">cookies</span> = <span class="ruby-identifier">query_parse</span>(<span class="ruby-identifier">resp</span>[<span class="ruby-constant">SET_COOKIE</span>], <span class="ruby-value str">';,'</span>)
46
+ 355: <span class="ruby-ivar">@cookies</span>.<span class="ruby-identifier">merge!</span> <span class="ruby-identifier">cookies</span>
47
+ 356: <span class="ruby-ivar">@cookies</span>.<span class="ruby-identifier">delete</span> <span class="ruby-value str">&quot;path&quot;</span>
48
+ 357: <span class="ruby-keyword kw">end</span>
49
+ 358:
50
+ 359: <span class="ruby-identifier">notify</span> <span class="ruby-identifier">:close</span> <span class="ruby-keyword kw">do</span>
51
+ 360: <span class="ruby-identifier">sock</span>.<span class="ruby-identifier">close</span>
52
+ 361: <span class="ruby-keyword kw">end</span>
53
+ 362:
54
+ 363: <span class="ruby-identifier">resp</span>
55
+ 364: <span class="ruby-keyword kw">end</span></pre>
56
+ </body>
57
+ </html>
@@ -0,0 +1,37 @@
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_request (RFuzz::HttpClient)</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/rfuzz/client.rb, line 368</span>
14
+ 368: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">send_request</span>(<span class="ruby-identifier">method</span>, <span class="ruby-identifier">uri</span>, <span class="ruby-identifier">req</span>)
15
+ 369: <span class="ruby-keyword kw">begin</span>
16
+ 370: <span class="ruby-identifier">sock</span> = <span class="ruby-keyword kw">nil</span>
17
+ 371: <span class="ruby-identifier">notify</span> <span class="ruby-identifier">:connect</span> <span class="ruby-keyword kw">do</span>
18
+ 372: <span class="ruby-identifier">sock</span> = <span class="ruby-constant">TCPSocket</span>.<span class="ruby-identifier">new</span>(<span class="ruby-ivar">@host</span>, <span class="ruby-ivar">@port</span>)
19
+ 373: <span class="ruby-keyword kw">end</span>
20
+ 374:
21
+ 375: <span class="ruby-identifier">out</span> = <span class="ruby-constant">StringIO</span>.<span class="ruby-identifier">new</span>
22
+ 376: <span class="ruby-identifier">body</span> = <span class="ruby-identifier">build_request</span>(<span class="ruby-identifier">out</span>, <span class="ruby-identifier">method</span>, <span class="ruby-identifier">uri</span>, <span class="ruby-identifier">req</span>)
23
+ 377:
24
+ 378: <span class="ruby-identifier">notify</span> <span class="ruby-identifier">:send_request</span> <span class="ruby-keyword kw">do</span>
25
+ 379: <span class="ruby-identifier">sock</span>.<span class="ruby-identifier">write</span>(<span class="ruby-identifier">out</span>.<span class="ruby-identifier">string</span> <span class="ruby-operator">+</span> <span class="ruby-identifier">body</span>)
26
+ 380: <span class="ruby-identifier">sock</span>.<span class="ruby-identifier">flush</span>
27
+ 381: <span class="ruby-keyword kw">end</span>
28
+ 382:
29
+ 383: <span class="ruby-keyword kw">return</span> <span class="ruby-identifier">read_response</span>(<span class="ruby-identifier">sock</span>)
30
+ 384: <span class="ruby-keyword kw">rescue</span> <span class="ruby-constant">Object</span>
31
+ 385: <span class="ruby-identifier">raise</span> <span class="ruby-identifier">$!</span>
32
+ 386: <span class="ruby-keyword kw">ensure</span>
33
+ 387: <span class="ruby-identifier">sock</span>.<span class="ruby-identifier">close</span> <span class="ruby-keyword kw">unless</span> (<span class="ruby-operator">!</span><span class="ruby-identifier">sock</span> <span class="ruby-keyword kw">or</span> <span class="ruby-identifier">sock</span>.<span class="ruby-identifier">closed?</span>)
34
+ 388: <span class="ruby-keyword kw">end</span>
35
+ 389: <span class="ruby-keyword kw">end</span></pre>
36
+ </body>
37
+ </html>
@@ -0,0 +1,26 @@
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>method_missing (RFuzz::HttpClient)</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/rfuzz/client.rb, line 396</span>
14
+ 396: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">method_missing</span>(<span class="ruby-identifier">symbol</span>, <span class="ruby-operator">*</span><span class="ruby-identifier">args</span>)
15
+ 397: <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@allowed_methods</span>.<span class="ruby-identifier">include?</span> <span class="ruby-identifier">symbol</span>
16
+ 398: <span class="ruby-identifier">method</span> = <span class="ruby-identifier">symbol</span>.<span class="ruby-identifier">to_s</span>.<span class="ruby-identifier">upcase</span>
17
+ 399: <span class="ruby-identifier">resp</span> = <span class="ruby-identifier">send_request</span>(<span class="ruby-identifier">method</span>, <span class="ruby-identifier">args</span>[<span class="ruby-value">0</span>], <span class="ruby-identifier">args</span>[<span class="ruby-value">1</span>] <span class="ruby-operator">||</span> {})
18
+ 400: <span class="ruby-identifier">resp</span> = <span class="ruby-identifier">redirect</span>(<span class="ruby-identifier">symbol</span>, <span class="ruby-identifier">resp</span>) <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@redirect</span>
19
+ 401:
20
+ 402: <span class="ruby-keyword kw">return</span> <span class="ruby-identifier">resp</span>
21
+ 403: <span class="ruby-keyword kw">else</span>
22
+ 404: <span class="ruby-identifier">raise</span> <span class="ruby-node">&quot;Invalid method: #{symbol}&quot;</span>
23
+ 405: <span class="ruby-keyword kw">end</span>
24
+ 406: <span class="ruby-keyword kw">end</span></pre>
25
+ </body>
26
+ </html>
@@ -0,0 +1,34 @@
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>redirect (RFuzz::HttpClient)</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/rfuzz/client.rb, line 409</span>
14
+ 409: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">redirect</span>(<span class="ruby-identifier">method</span>, <span class="ruby-identifier">resp</span>, <span class="ruby-operator">*</span><span class="ruby-identifier">args</span>)
15
+ 410: <span class="ruby-ivar">@redirect</span>.<span class="ruby-identifier">times</span> <span class="ruby-keyword kw">do</span>
16
+ 411: <span class="ruby-keyword kw">break</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">resp</span>.<span class="ruby-identifier">http_status</span>.<span class="ruby-identifier">index</span>(<span class="ruby-value str">&quot;3&quot;</span>) <span class="ruby-operator">!=</span> <span class="ruby-value">0</span>
17
+ 412:
18
+ 413: <span class="ruby-identifier">host</span> = <span class="ruby-identifier">encode_host</span>(<span class="ruby-ivar">@host</span>,<span class="ruby-ivar">@port</span>)
19
+ 414: <span class="ruby-identifier">location</span> = <span class="ruby-identifier">resp</span>[<span class="ruby-constant">LOCATION</span>]
20
+ 415:
21
+ 416: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">location</span>.<span class="ruby-identifier">index</span>(<span class="ruby-identifier">host</span>) <span class="ruby-operator">==</span> <span class="ruby-value">0</span>
22
+ 417: <span class="ruby-comment cmt"># begins with the host so strip that off</span>
23
+ 418: <span class="ruby-identifier">location</span> = <span class="ruby-identifier">location</span>[<span class="ruby-identifier">host</span>.<span class="ruby-identifier">length</span> <span class="ruby-operator">..</span> <span class="ruby-value">-1</span>]
24
+ 419: <span class="ruby-keyword kw">end</span>
25
+ 420:
26
+ 421: <span class="ruby-ivar">@notifier</span>.<span class="ruby-identifier">redirect</span>(<span class="ruby-identifier">:begins</span>) <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@notifier</span>
27
+ 422: <span class="ruby-identifier">resp</span> = <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">send</span>(<span class="ruby-identifier">method</span>, <span class="ruby-identifier">location</span>, <span class="ruby-operator">*</span><span class="ruby-identifier">args</span>)
28
+ 423: <span class="ruby-ivar">@notifier</span>.<span class="ruby-identifier">redirect</span>(<span class="ruby-identifier">:ends</span>) <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@notifier</span>
29
+ 424: <span class="ruby-keyword kw">end</span>
30
+ 425:
31
+ 426: <span class="ruby-keyword kw">return</span> <span class="ruby-identifier">resp</span>
32
+ 427: <span class="ruby-keyword kw">end</span></pre>
33
+ </body>
34
+ </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>reset (RFuzz::HttpClient)</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/rfuzz/client.rb, line 431</span>
14
+ 431: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">reset</span>
15
+ 432: <span class="ruby-ivar">@cookies</span>.<span class="ruby-identifier">clear</span>
16
+ 433: <span class="ruby-keyword kw">end</span></pre>
17
+ </body>
18
+ </html>
@@ -0,0 +1,26 @@
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>notify (RFuzz::HttpClient)</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/rfuzz/client.rb, line 442</span>
14
+ 442: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">notify</span>(<span class="ruby-identifier">event</span>)
15
+ 443: <span class="ruby-ivar">@notifier</span>.<span class="ruby-identifier">send</span>(<span class="ruby-identifier">event</span>, <span class="ruby-identifier">:begins</span>) <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@notifier</span>
16
+ 444:
17
+ 445: <span class="ruby-keyword kw">begin</span>
18
+ 446: <span class="ruby-keyword kw">yield</span>
19
+ 447: <span class="ruby-ivar">@notifier</span>.<span class="ruby-identifier">send</span>(<span class="ruby-identifier">event</span>, <span class="ruby-identifier">:ends</span>) <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@notifier</span>
20
+ 448: <span class="ruby-keyword kw">rescue</span> <span class="ruby-constant">Object</span>
21
+ 449: <span class="ruby-ivar">@notifier</span>.<span class="ruby-identifier">send</span>(<span class="ruby-identifier">event</span>, <span class="ruby-identifier">:error</span>) <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@notifier</span>
22
+ 450: <span class="ruby-identifier">raise</span> <span class="ruby-identifier">$!</span>
23
+ 451: <span class="ruby-keyword kw">end</span>
24
+ 452: <span class="ruby-keyword kw">end</span></pre>
25
+ </body>
26
+ </html>
@@ -0,0 +1,294 @@
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>Module: RFuzz::HttpEncoding</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>Module</strong></td>
53
+ <td class="class-name-in-header">RFuzz::HttpEncoding</td>
54
+ </tr>
55
+ <tr class="top-aligned-row">
56
+ <td><strong>In:</strong></td>
57
+ <td>
58
+ <a href="../../files/lib/rfuzz/client_rb.html">
59
+ lib/rfuzz/client.rb
60
+ </a>
61
+ <br />
62
+ </td>
63
+ </tr>
64
+
65
+ </table>
66
+ </div>
67
+ <!-- banner header -->
68
+
69
+ <div id="bodyContent">
70
+
71
+
72
+
73
+ <div id="contextContent">
74
+
75
+ <div id="description">
76
+ <p>
77
+ A mixin that has most of the HTTP encoding methods you need to work with
78
+ the protocol. It&#8217;s used by <a href="HttpClient.html">HttpClient</a>,
79
+ but you can use it as well.
80
+ </p>
81
+
82
+ </div>
83
+
84
+
85
+ </div>
86
+
87
+ <div id="method-list">
88
+ <h3 class="section-bar">Methods</h3>
89
+
90
+ <div class="name-list">
91
+ <a href="#M000001">encode_cookies</a>&nbsp;&nbsp;
92
+ <a href="#M000002">encode_field</a>&nbsp;&nbsp;
93
+ <a href="#M000003">encode_headers</a>&nbsp;&nbsp;
94
+ <a href="#M000006">encode_host</a>&nbsp;&nbsp;
95
+ <a href="#M000004">encode_param</a>&nbsp;&nbsp;
96
+ <a href="#M000005">encode_query</a>&nbsp;&nbsp;
97
+ <a href="#M000007">escape</a>&nbsp;&nbsp;
98
+ <a href="#M000009">query_parse</a>&nbsp;&nbsp;
99
+ <a href="#M000008">unescape</a>&nbsp;&nbsp;
100
+ </div>
101
+ </div>
102
+
103
+ </div>
104
+
105
+
106
+ <!-- if includes -->
107
+
108
+ <div id="section">
109
+
110
+
111
+
112
+
113
+
114
+
115
+
116
+
117
+ <!-- if method_list -->
118
+ <div id="methods">
119
+ <h3 class="section-bar">Public Instance methods</h3>
120
+
121
+ <div id="method-M000001" class="method-detail">
122
+ <a name="M000001"></a>
123
+
124
+ <div class="method-heading">
125
+ <a href="HttpEncoding.src/M000001.html" target="Code" class="method-signature"
126
+ onclick="popupCode('HttpEncoding.src/M000001.html');return false;">
127
+ <span class="method-name">encode_cookies</span><span class="method-args">(cookies)</span>
128
+ </a>
129
+ </div>
130
+
131
+ <div class="method-description">
132
+ <p>
133
+ Converts a Hash of cookies to the appropriate simple cookie headers.
134
+ </p>
135
+ </div>
136
+ </div>
137
+
138
+ <div id="method-M000002" class="method-detail">
139
+ <a name="M000002"></a>
140
+
141
+ <div class="method-heading">
142
+ <a href="HttpEncoding.src/M000002.html" target="Code" class="method-signature"
143
+ onclick="popupCode('HttpEncoding.src/M000002.html');return false;">
144
+ <span class="method-name">encode_field</span><span class="method-args">(k,v)</span>
145
+ </a>
146
+ </div>
147
+
148
+ <div class="method-description">
149
+ <p>
150
+ Encode HTTP header fields of &quot;k: v\r\n&quot;
151
+ </p>
152
+ </div>
153
+ </div>
154
+
155
+ <div id="method-M000003" class="method-detail">
156
+ <a name="M000003"></a>
157
+
158
+ <div class="method-heading">
159
+ <a href="HttpEncoding.src/M000003.html" target="Code" class="method-signature"
160
+ onclick="popupCode('HttpEncoding.src/M000003.html');return false;">
161
+ <span class="method-name">encode_headers</span><span class="method-args">(head)</span>
162
+ </a>
163
+ </div>
164
+
165
+ <div class="method-description">
166
+ <p>
167
+ Encodes the headers given in the hash returning a string you can use.
168
+ </p>
169
+ </div>
170
+ </div>
171
+
172
+ <div id="method-M000006" class="method-detail">
173
+ <a name="M000006"></a>
174
+
175
+ <div class="method-heading">
176
+ <a href="HttpEncoding.src/M000006.html" target="Code" class="method-signature"
177
+ onclick="popupCode('HttpEncoding.src/M000006.html');return false;">
178
+ <span class="method-name">encode_host</span><span class="method-args">(host, port)</span>
179
+ </a>
180
+ </div>
181
+
182
+ <div class="method-description">
183
+ <p>
184
+ HTTP is kind of retarded that you have to specify a Host header, but if you
185
+ include port 80 then further redirects will tack on the :80 which is
186
+ annoying.
187
+ </p>
188
+ </div>
189
+ </div>
190
+
191
+ <div id="method-M000004" class="method-detail">
192
+ <a name="M000004"></a>
193
+
194
+ <div class="method-heading">
195
+ <a href="HttpEncoding.src/M000004.html" target="Code" class="method-signature"
196
+ onclick="popupCode('HttpEncoding.src/M000004.html');return false;">
197
+ <span class="method-name">encode_param</span><span class="method-args">(k,v)</span>
198
+ </a>
199
+ </div>
200
+
201
+ <div class="method-description">
202
+ <p>
203
+ URL encodes a single k=v parameter.
204
+ </p>
205
+ </div>
206
+ </div>
207
+
208
+ <div id="method-M000005" class="method-detail">
209
+ <a name="M000005"></a>
210
+
211
+ <div class="method-heading">
212
+ <a href="HttpEncoding.src/M000005.html" target="Code" class="method-signature"
213
+ onclick="popupCode('HttpEncoding.src/M000005.html');return false;">
214
+ <span class="method-name">encode_query</span><span class="method-args">(uri, query)</span>
215
+ </a>
216
+ </div>
217
+
218
+ <div class="method-description">
219
+ <p>
220
+ Takes a query string and encodes it as a URL encoded set of key=value pairs
221
+ with &amp; separating them.
222
+ </p>
223
+ </div>
224
+ </div>
225
+
226
+ <div id="method-M000007" class="method-detail">
227
+ <a name="M000007"></a>
228
+
229
+ <div class="method-heading">
230
+ <a href="HttpEncoding.src/M000007.html" target="Code" class="method-signature"
231
+ onclick="popupCode('HttpEncoding.src/M000007.html');return false;">
232
+ <span class="method-name">escape</span><span class="method-args">(s)</span>
233
+ </a>
234
+ </div>
235
+
236
+ <div class="method-description">
237
+ <p>
238
+ Performs URI escaping so that you can construct proper query strings
239
+ faster. Use this rather than the cgi.rb version since it&#8217;s faster.
240
+ (Stolen from Camping).
241
+ </p>
242
+ </div>
243
+ </div>
244
+
245
+ <div id="method-M000009" class="method-detail">
246
+ <a name="M000009"></a>
247
+
248
+ <div class="method-heading">
249
+ <a href="HttpEncoding.src/M000009.html" target="Code" class="method-signature"
250
+ onclick="popupCode('HttpEncoding.src/M000009.html');return false;">
251
+ <span class="method-name">query_parse</span><span class="method-args">(qs, d = '&amp;;')</span>
252
+ </a>
253
+ </div>
254
+
255
+ <div class="method-description">
256
+ <p>
257
+ Parses a query string by breaking it up at the &#8217;&amp;&#8217; and
258
+ &#8217;;&#8217; characters. You can also use this to parse cookies by
259
+ changing the characters used in the second parameter (which defaults to
260
+ &#8217;&amp;;&#8217;.
261
+ </p>
262
+ </div>
263
+ </div>
264
+
265
+ <div id="method-M000008" class="method-detail">
266
+ <a name="M000008"></a>
267
+
268
+ <div class="method-heading">
269
+ <a href="HttpEncoding.src/M000008.html" target="Code" class="method-signature"
270
+ onclick="popupCode('HttpEncoding.src/M000008.html');return false;">
271
+ <span class="method-name">unescape</span><span class="method-args">(s)</span>
272
+ </a>
273
+ </div>
274
+
275
+ <div class="method-description">
276
+ <p>
277
+ Unescapes a URI escaped string. (Stolen from Camping).
278
+ </p>
279
+ </div>
280
+ </div>
281
+
282
+
283
+ </div>
284
+
285
+
286
+ </div>
287
+
288
+
289
+ <div id="validator-badges">
290
+ <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
291
+ </div>
292
+
293
+ </body>
294
+ </html>