rfuzz 0.8 → 0.9
Sign up to get free protection for your applications and to get access to all the features.
- data/Rakefile +1 -1
- data/doc/rdoc/classes/RFuzz.html +1 -1
- data/doc/rdoc/classes/RFuzz/Browser.html +15 -15
- data/doc/rdoc/classes/RFuzz/Browser.src/M000084.html +12 -10
- data/doc/rdoc/classes/RFuzz/Browser.src/M000085.html +10 -11
- data/doc/rdoc/classes/RFuzz/Browser.src/M000086.html +24 -0
- data/doc/rdoc/classes/RFuzz/HttpClient.html +72 -64
- data/doc/rdoc/classes/RFuzz/HttpClient.src/M000020.html +12 -21
- data/doc/rdoc/classes/RFuzz/HttpClient.src/M000021.html +21 -15
- data/doc/rdoc/classes/RFuzz/HttpClient.src/M000022.html +15 -17
- data/doc/rdoc/classes/RFuzz/HttpClient.src/M000023.html +17 -22
- data/doc/rdoc/classes/RFuzz/HttpClient.src/M000024.html +22 -9
- data/doc/rdoc/classes/RFuzz/HttpClient.src/M000025.html +9 -31
- data/doc/rdoc/classes/RFuzz/HttpClient.src/M000026.html +31 -25
- data/doc/rdoc/classes/RFuzz/HttpClient.src/M000027.html +25 -13
- data/doc/rdoc/classes/RFuzz/HttpClient.src/M000028.html +13 -21
- data/doc/rdoc/classes/RFuzz/HttpClient.src/M000029.html +21 -5
- data/doc/rdoc/classes/RFuzz/HttpClient.src/M000030.html +5 -13
- data/doc/rdoc/classes/RFuzz/HttpClient.src/M000031.html +26 -0
- data/doc/rdoc/classes/RFuzz/HttpResponse.html +15 -15
- data/doc/rdoc/classes/RFuzz/HttpResponse.src/M000032.html +9 -5
- data/doc/rdoc/classes/RFuzz/HttpResponse.src/M000033.html +5 -5
- data/doc/rdoc/classes/RFuzz/HttpResponse.src/M000034.html +18 -0
- data/doc/rdoc/classes/RFuzz/Notifier.html +36 -36
- data/doc/rdoc/classes/RFuzz/Notifier.src/M000059.html +4 -4
- data/doc/rdoc/classes/RFuzz/Notifier.src/M000060.html +4 -4
- data/doc/rdoc/classes/RFuzz/Notifier.src/M000061.html +4 -4
- data/doc/rdoc/classes/RFuzz/Notifier.src/M000062.html +4 -4
- data/doc/rdoc/classes/RFuzz/Notifier.src/M000063.html +4 -4
- data/doc/rdoc/classes/RFuzz/Notifier.src/M000064.html +4 -4
- data/doc/rdoc/classes/RFuzz/Notifier.src/{M000058.html → M000065.html} +4 -4
- data/doc/rdoc/classes/RFuzz/PushBackIO.html +55 -40
- data/doc/rdoc/classes/RFuzz/PushBackIO.src/M000010.html +2 -1
- data/doc/rdoc/classes/RFuzz/PushBackIO.src/M000011.html +6 -5
- data/doc/rdoc/classes/RFuzz/PushBackIO.src/M000012.html +8 -6
- data/doc/rdoc/classes/RFuzz/PushBackIO.src/M000013.html +7 -5
- data/doc/rdoc/classes/RFuzz/PushBackIO.src/M000014.html +6 -31
- data/doc/rdoc/classes/RFuzz/PushBackIO.src/M000015.html +32 -5
- data/doc/rdoc/classes/RFuzz/PushBackIO.src/M000016.html +6 -5
- data/doc/rdoc/classes/RFuzz/PushBackIO.src/M000017.html +6 -5
- data/doc/rdoc/classes/RFuzz/PushBackIO.src/M000018.html +5 -9
- data/doc/rdoc/classes/RFuzz/PushBackIO.src/M000019.html +22 -0
- data/doc/rdoc/classes/RFuzz/RandomGenerator.html +62 -62
- data/doc/rdoc/classes/RFuzz/RandomGenerator.src/M000047.html +8 -10
- data/doc/rdoc/classes/RFuzz/RandomGenerator.src/M000048.html +23 -0
- data/doc/rdoc/classes/RFuzz/RandomGenerator.src/M000051.html +9 -7
- data/doc/rdoc/classes/RFuzz/RandomGenerator.src/M000052.html +7 -9
- data/doc/rdoc/classes/RFuzz/RandomGenerator.src/M000053.html +9 -7
- data/doc/rdoc/classes/RFuzz/RandomGenerator.src/M000054.html +7 -5
- data/doc/rdoc/classes/RFuzz/RandomGenerator.src/M000055.html +5 -5
- data/doc/rdoc/classes/RFuzz/RandomGenerator.src/M000056.html +5 -9
- data/doc/rdoc/classes/RFuzz/RandomGenerator.src/M000057.html +9 -5
- data/doc/rdoc/classes/RFuzz/RandomGenerator.src/M000058.html +18 -0
- data/doc/rdoc/classes/RFuzz/Sampler.html +60 -60
- data/doc/rdoc/classes/RFuzz/Sampler.src/M000072.html +6 -10
- data/doc/rdoc/classes/RFuzz/Sampler.src/M000073.html +10 -13
- data/doc/rdoc/classes/RFuzz/Sampler.src/M000074.html +13 -5
- data/doc/rdoc/classes/RFuzz/Sampler.src/M000075.html +5 -5
- data/doc/rdoc/classes/RFuzz/Sampler.src/M000076.html +5 -5
- data/doc/rdoc/classes/RFuzz/Sampler.src/M000077.html +5 -5
- data/doc/rdoc/classes/RFuzz/Sampler.src/M000078.html +5 -6
- data/doc/rdoc/classes/RFuzz/Sampler.src/M000079.html +6 -5
- data/doc/rdoc/classes/RFuzz/Sampler.src/M000080.html +5 -10
- data/doc/rdoc/classes/RFuzz/Sampler.src/M000081.html +10 -5
- data/doc/rdoc/classes/RFuzz/Sampler.src/M000082.html +5 -7
- data/doc/rdoc/classes/RFuzz/Sampler.src/M000083.html +20 -0
- data/doc/rdoc/classes/RFuzz/Session.html +63 -63
- data/doc/rdoc/classes/RFuzz/Session.src/M000035.html +18 -5
- data/doc/rdoc/classes/RFuzz/Session.src/M000036.html +5 -5
- data/doc/rdoc/classes/RFuzz/Session.src/M000037.html +5 -21
- data/doc/rdoc/classes/RFuzz/Session.src/M000038.html +21 -6
- data/doc/rdoc/classes/RFuzz/Session.src/M000039.html +6 -6
- data/doc/rdoc/classes/RFuzz/Session.src/M000040.html +6 -13
- data/doc/rdoc/classes/RFuzz/Session.src/M000041.html +13 -16
- data/doc/rdoc/classes/RFuzz/Session.src/M000042.html +16 -6
- data/doc/rdoc/classes/RFuzz/Session.src/M000043.html +6 -5
- data/doc/rdoc/classes/RFuzz/Session.src/M000044.html +5 -5
- data/doc/rdoc/classes/RFuzz/Session.src/M000045.html +5 -10
- data/doc/rdoc/classes/RFuzz/Session.src/M000046.html +23 -0
- data/doc/rdoc/classes/RFuzz/StatsTracker.html +32 -32
- data/doc/rdoc/classes/RFuzz/StatsTracker.src/M000066.html +6 -6
- data/doc/rdoc/classes/RFuzz/StatsTracker.src/M000067.html +6 -5
- data/doc/rdoc/classes/RFuzz/StatsTracker.src/M000068.html +5 -5
- data/doc/rdoc/classes/RFuzz/StatsTracker.src/M000069.html +5 -15
- data/doc/rdoc/classes/RFuzz/StatsTracker.src/M000070.html +15 -5
- data/doc/rdoc/classes/RFuzz/StatsTracker.src/{M000065.html → M000071.html} +5 -6
- data/doc/rdoc/created.rid +1 -1
- data/doc/rdoc/files/lib/rfuzz/client_rb.html +1 -1
- data/doc/rdoc/files/lib/rfuzz/pushbackio_rb.html +1 -1
- data/doc/rdoc/files/lib/rfuzz/session_rb.html +1 -1
- data/doc/rdoc/fr_method_index.html +76 -75
- data/examples/kill_routes.rb +5 -4
- data/examples/mongrel_test_suite/test/rails/put.rb +14 -7
- data/examples/random_sockets.rb +37 -0
- data/examples/randomizer.rb +19 -0
- data/ext/http11_client/http11_parser.c +33 -34
- data/lib/rfuzz/client.rb +1 -1
- data/lib/rfuzz/pushbackio.rb +16 -2
- data/lib/rfuzz/session.rb +1 -1
- metadata +14 -11
- data/doc/rdoc/classes/RFuzz/Browser.src/M000083.html +0 -25
- data/doc/rdoc/classes/RFuzz/HttpClient.src/M000019.html +0 -25
- data/doc/rdoc/classes/RFuzz/HttpResponse.src/M000031.html +0 -22
- data/doc/rdoc/classes/RFuzz/RandomGenerator.src/M000046.html +0 -21
- data/doc/rdoc/classes/RFuzz/RandomGenerator.src/M000050.html +0 -22
- data/doc/rdoc/classes/RFuzz/Sampler.src/M000071.html +0 -19
- data/doc/rdoc/classes/RFuzz/Session.src/M000034.html +0 -31
@@ -5,24 +5,30 @@
|
|
5
5
|
|
6
6
|
<html>
|
7
7
|
<head>
|
8
|
-
<title>
|
8
|
+
<title>build_request (RFuzz::HttpClient)</title>
|
9
9
|
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
|
10
10
|
<link rel="stylesheet" href="../../.././rdoc-style.css" type="text/css" media="screen" />
|
11
11
|
</head>
|
12
12
|
<body class="standalone-code">
|
13
|
-
<pre> <span class="ruby-comment cmt"># File lib/rfuzz/client.rb, line
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
13
|
+
<pre> <span class="ruby-comment cmt"># File lib/rfuzz/client.rb, line 247</span>
|
14
|
+
247: <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
|
+
248: <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
|
+
249: <span class="ruby-identifier">query</span> = <span class="ruby-identifier">ops</span>[<span class="ruby-identifier">:query</span>]
|
17
|
+
250:
|
18
|
+
251: <span class="ruby-comment cmt"># merge head differently since that's typically what they mean</span>
|
19
|
+
252: <span class="ruby-identifier">head</span> = <span class="ruby-identifier">req</span>[<span class="ruby-identifier">:head</span>] <span class="ruby-operator">||</span> {}
|
20
|
+
253: <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
|
+
254:
|
22
|
+
255: <span class="ruby-comment cmt"># setup basic headers we always need</span>
|
23
|
+
256: <span class="ruby-identifier">head</span>[<span class="ruby-constant">REQ_HOST</span>] = <span class="ruby-identifier">encode_host</span>(<span class="ruby-ivar">@host</span>,<span class="ruby-ivar">@port</span>)
|
24
|
+
257: <span class="ruby-identifier">head</span>[<span class="ruby-constant">REQ_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
|
+
258:
|
26
|
+
259: <span class="ruby-comment cmt"># blast it out</span>
|
27
|
+
260: <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
|
+
261: <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
|
+
262: <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
|
+
263: <span class="ruby-identifier">out</span>.<span class="ruby-identifier">write</span>(<span class="ruby-constant">CRLF</span>)
|
31
|
+
264: <span class="ruby-identifier">ops</span>[<span class="ruby-identifier">:body</span>] <span class="ruby-operator">||</span> <span class="ruby-value str">""</span>
|
32
|
+
265: <span class="ruby-keyword kw">end</span></pre>
|
27
33
|
</body>
|
28
34
|
</html>
|
@@ -5,26 +5,24 @@
|
|
5
5
|
|
6
6
|
<html>
|
7
7
|
<head>
|
8
|
-
<title>
|
8
|
+
<title>read_parsed_header (RFuzz::HttpClient)</title>
|
9
9
|
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
|
10
10
|
<link rel="stylesheet" href="../../.././rdoc-style.css" type="text/css" media="screen" />
|
11
11
|
</head>
|
12
12
|
<body class="standalone-code">
|
13
|
-
<pre> <span class="ruby-comment cmt"># File lib/rfuzz/client.rb, line
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
299: <span class="ruby-keyword kw">return</span> <span class="ruby-identifier">resp</span>
|
28
|
-
300: <span class="ruby-keyword kw">end</span></pre>
|
13
|
+
<pre> <span class="ruby-comment cmt"># File lib/rfuzz/client.rb, line 270</span>
|
14
|
+
270: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">read_parsed_header</span>
|
15
|
+
271: <span class="ruby-ivar">@parser</span>.<span class="ruby-identifier">reset</span>
|
16
|
+
272: <span class="ruby-identifier">resp</span> = <span class="ruby-constant">HttpResponse</span>.<span class="ruby-identifier">new</span>
|
17
|
+
273: <span class="ruby-identifier">data</span> = <span class="ruby-ivar">@sock</span>.<span class="ruby-identifier">read</span>(<span class="ruby-constant">CHUNK_SIZE</span>, <span class="ruby-identifier">partial</span>=<span class="ruby-keyword kw">true</span>)
|
18
|
+
274: <span class="ruby-identifier">nread</span> = <span class="ruby-ivar">@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>)
|
19
|
+
275:
|
20
|
+
276: <span class="ruby-keyword kw">while</span> <span class="ruby-operator">!</span><span class="ruby-ivar">@parser</span>.<span class="ruby-identifier">finished?</span>
|
21
|
+
277: <span class="ruby-identifier">data</span> <span class="ruby-operator"><<</span> <span class="ruby-ivar">@sock</span>.<span class="ruby-identifier">read</span>(<span class="ruby-constant">CHUNK_SIZE</span>, <span class="ruby-identifier">partial</span>=<span class="ruby-keyword kw">true</span>)
|
22
|
+
278: <span class="ruby-identifier">nread</span> = <span class="ruby-ivar">@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>)
|
23
|
+
279: <span class="ruby-keyword kw">end</span>
|
24
|
+
280:
|
25
|
+
281: <span class="ruby-keyword kw">return</span> <span class="ruby-identifier">resp</span>
|
26
|
+
282: <span class="ruby-keyword kw">end</span></pre>
|
29
27
|
</body>
|
30
28
|
</html>
|
@@ -5,31 +5,26 @@
|
|
5
5
|
|
6
6
|
<html>
|
7
7
|
<head>
|
8
|
-
<title>
|
8
|
+
<title>read_chunked_header (RFuzz::HttpClient)</title>
|
9
9
|
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
|
10
10
|
<link rel="stylesheet" href="../../.././rdoc-style.css" type="text/css" media="screen" />
|
11
11
|
</head>
|
12
12
|
<body class="standalone-code">
|
13
|
-
<pre> <span class="ruby-comment cmt"># File lib/rfuzz/client.rb, line
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
321: <span class="ruby-keyword kw">end</span>
|
30
|
-
322: <span class="ruby-keyword kw">end</span>
|
31
|
-
323:
|
32
|
-
324: <span class="ruby-identifier">header</span>
|
33
|
-
325: <span class="ruby-keyword kw">end</span></pre>
|
13
|
+
<pre> <span class="ruby-comment cmt"># File lib/rfuzz/client.rb, line 286</span>
|
14
|
+
286: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">read_chunked_header</span>
|
15
|
+
287: <span class="ruby-identifier">resp</span> = <span class="ruby-identifier">read_parsed_header</span>
|
16
|
+
288: <span class="ruby-ivar">@sock</span>.<span class="ruby-identifier">push</span>(<span class="ruby-identifier">resp</span>.<span class="ruby-identifier">http_body</span>)
|
17
|
+
289:
|
18
|
+
290: <span class="ruby-keyword kw">if</span> <span class="ruby-operator">!</span><span class="ruby-identifier">resp</span>.<span class="ruby-identifier">last_chunk?</span>
|
19
|
+
291: <span class="ruby-identifier">resp</span>.<span class="ruby-identifier">http_body</span> = <span class="ruby-ivar">@sock</span>.<span class="ruby-identifier">read</span>(<span class="ruby-identifier">resp</span>.<span class="ruby-identifier">chunk_size</span>)
|
20
|
+
292:
|
21
|
+
293: <span class="ruby-identifier">trail</span> = <span class="ruby-ivar">@sock</span>.<span class="ruby-identifier">read</span>(<span class="ruby-value">2</span>)
|
22
|
+
294: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">trail</span> <span class="ruby-operator">!=</span> <span class="ruby-constant">CRLF</span>
|
23
|
+
295: <span class="ruby-identifier">raise</span> <span class="ruby-constant">HttpClientParserError</span>.<span class="ruby-identifier">new</span>(<span class="ruby-node">"Chunk ended in #{trail.inspect} not #{CRLF.inspect}"</span>)
|
24
|
+
296: <span class="ruby-keyword kw">end</span>
|
25
|
+
297: <span class="ruby-keyword kw">end</span>
|
26
|
+
298:
|
27
|
+
299: <span class="ruby-keyword kw">return</span> <span class="ruby-identifier">resp</span>
|
28
|
+
300: <span class="ruby-keyword kw">end</span></pre>
|
34
29
|
</body>
|
35
30
|
</html>
|
@@ -5,18 +5,31 @@
|
|
5
5
|
|
6
6
|
<html>
|
7
7
|
<head>
|
8
|
-
<title>
|
8
|
+
<title>read_chunked_body (RFuzz::HttpClient)</title>
|
9
9
|
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
|
10
10
|
<link rel="stylesheet" href="../../.././rdoc-style.css" type="text/css" media="screen" />
|
11
11
|
</head>
|
12
12
|
<body class="standalone-code">
|
13
|
-
<pre> <span class="ruby-comment cmt"># File lib/rfuzz/client.rb, line
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
13
|
+
<pre> <span class="ruby-comment cmt"># File lib/rfuzz/client.rb, line 306</span>
|
14
|
+
306: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">read_chunked_body</span>(<span class="ruby-identifier">header</span>)
|
15
|
+
307: <span class="ruby-ivar">@sock</span>.<span class="ruby-identifier">push</span>(<span class="ruby-identifier">header</span>.<span class="ruby-identifier">http_body</span>)
|
16
|
+
308: <span class="ruby-identifier">header</span>.<span class="ruby-identifier">http_body</span> = <span class="ruby-value str">""</span>
|
17
|
+
309: <span class="ruby-identifier">header</span>.<span class="ruby-identifier">raw_chunks</span> = []
|
18
|
+
310:
|
19
|
+
311: <span class="ruby-keyword kw">while</span> <span class="ruby-keyword kw">true</span>
|
20
|
+
312: <span class="ruby-ivar">@notifier</span>.<span class="ruby-identifier">read_chunk</span>(<span class="ruby-identifier">:begins</span>) <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@notifier</span>
|
21
|
+
313: <span class="ruby-identifier">chunk</span> = <span class="ruby-identifier">read_chunked_header</span>
|
22
|
+
314: <span class="ruby-identifier">header</span>.<span class="ruby-identifier">raw_chunks</span> <span class="ruby-operator"><<</span> <span class="ruby-identifier">chunk</span>
|
23
|
+
315: <span class="ruby-keyword kw">if</span> <span class="ruby-operator">!</span><span class="ruby-identifier">chunk</span>.<span class="ruby-identifier">last_chunk?</span>
|
24
|
+
316: <span class="ruby-identifier">header</span>.<span class="ruby-identifier">http_body</span> <span class="ruby-operator"><<</span> <span class="ruby-identifier">chunk</span>.<span class="ruby-identifier">http_body</span>
|
25
|
+
317: <span class="ruby-ivar">@notifier</span>.<span class="ruby-identifier">read_chunk</span>(<span class="ruby-identifier">:end</span>) <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@notifier</span>
|
26
|
+
318: <span class="ruby-keyword kw">else</span>
|
27
|
+
319: <span class="ruby-ivar">@notifier</span>.<span class="ruby-identifier">read_chunk</span>(<span class="ruby-identifier">:end</span>) <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@notifier</span>
|
28
|
+
320: <span class="ruby-keyword kw">break</span> <span class="ruby-comment cmt"># last chunk, done</span>
|
29
|
+
321: <span class="ruby-keyword kw">end</span>
|
30
|
+
322: <span class="ruby-keyword kw">end</span>
|
31
|
+
323:
|
32
|
+
324: <span class="ruby-identifier">header</span>
|
33
|
+
325: <span class="ruby-keyword kw">end</span></pre>
|
21
34
|
</body>
|
22
35
|
</html>
|
@@ -5,40 +5,18 @@
|
|
5
5
|
|
6
6
|
<html>
|
7
7
|
<head>
|
8
|
-
<title>
|
8
|
+
<title>store_cookies (RFuzz::HttpClient)</title>
|
9
9
|
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
|
10
10
|
<link rel="stylesheet" href="../../.././rdoc-style.css" type="text/css" media="screen" />
|
11
11
|
</head>
|
12
12
|
<body class="standalone-code">
|
13
|
-
<pre> <span class="ruby-comment cmt"># File lib/rfuzz/client.rb, line
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
351: <span class="ruby-identifier">notify</span> <span class="ruby-identifier">:read_body</span> <span class="ruby-keyword kw">do</span>
|
22
|
-
352: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">resp</span>.<span class="ruby-identifier">chunked_encoding?</span>
|
23
|
-
353: <span class="ruby-identifier">read_chunked_body</span>(<span class="ruby-identifier">resp</span>)
|
24
|
-
354: <span class="ruby-keyword kw">elsif</span> <span class="ruby-identifier">resp</span>[<span class="ruby-constant">CONTENT_LENGTH</span>]
|
25
|
-
355: <span class="ruby-identifier">needs</span> = <span class="ruby-identifier">resp</span>[<span class="ruby-constant">CONTENT_LENGTH</span>].<span class="ruby-identifier">to_i</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>
|
26
|
-
356: <span class="ruby-comment cmt"># Some requests can actually give a content length, and then not have content</span>
|
27
|
-
357: <span class="ruby-comment cmt"># so we ignore HttpClientError exceptions and pray that's good enough</span>
|
28
|
-
358: <span class="ruby-identifier">resp</span>.<span class="ruby-identifier">http_body</span> <span class="ruby-operator">+=</span> <span class="ruby-ivar">@sock</span>.<span class="ruby-identifier">read</span>(<span class="ruby-identifier">needs</span>) <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">needs</span> <span class="ruby-operator">></span> <span class="ruby-value">0</span> <span class="ruby-keyword kw">rescue</span> <span class="ruby-constant">HttpClientError</span>
|
29
|
-
359: <span class="ruby-keyword kw">else</span>
|
30
|
-
360: <span class="ruby-keyword kw">while</span> <span class="ruby-keyword kw">true</span>
|
31
|
-
361: <span class="ruby-keyword kw">begin</span>
|
32
|
-
362: <span class="ruby-identifier">resp</span>.<span class="ruby-identifier">http_body</span> <span class="ruby-operator">+=</span> <span class="ruby-ivar">@sock</span>.<span class="ruby-identifier">read</span>(<span class="ruby-constant">CHUNK_SIZE</span>, <span class="ruby-identifier">partial</span>=<span class="ruby-keyword kw">true</span>)
|
33
|
-
363: <span class="ruby-keyword kw">rescue</span> <span class="ruby-constant">HttpClientError</span>
|
34
|
-
364: <span class="ruby-keyword kw">break</span> <span class="ruby-comment cmt"># this is fine, they closed the socket then</span>
|
35
|
-
365: <span class="ruby-keyword kw">end</span>
|
36
|
-
366: <span class="ruby-keyword kw">end</span>
|
37
|
-
367: <span class="ruby-keyword kw">end</span>
|
38
|
-
368: <span class="ruby-keyword kw">end</span>
|
39
|
-
369:
|
40
|
-
370: <span class="ruby-identifier">store_cookies</span>(<span class="ruby-identifier">resp</span>)
|
41
|
-
371: <span class="ruby-keyword kw">return</span> <span class="ruby-identifier">resp</span>
|
42
|
-
372: <span class="ruby-keyword kw">end</span></pre>
|
13
|
+
<pre> <span class="ruby-comment cmt"># File lib/rfuzz/client.rb, line 329</span>
|
14
|
+
329: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">store_cookies</span>(<span class="ruby-identifier">resp</span>)
|
15
|
+
330: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">resp</span>[<span class="ruby-constant">SET_COOKIE</span>]
|
16
|
+
331: <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>)
|
17
|
+
332: <span class="ruby-ivar">@cookies</span>.<span class="ruby-identifier">merge!</span> <span class="ruby-identifier">cookies</span>
|
18
|
+
333: <span class="ruby-ivar">@cookies</span>.<span class="ruby-identifier">delete</span> <span class="ruby-value str">"path"</span>
|
19
|
+
334: <span class="ruby-keyword kw">end</span>
|
20
|
+
335: <span class="ruby-keyword kw">end</span></pre>
|
43
21
|
</body>
|
44
22
|
</html>
|
@@ -5,34 +5,40 @@
|
|
5
5
|
|
6
6
|
<html>
|
7
7
|
<head>
|
8
|
-
<title>
|
8
|
+
<title>read_response (RFuzz::HttpClient)</title>
|
9
9
|
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
|
10
10
|
<link rel="stylesheet" href="../../.././rdoc-style.css" type="text/css" media="screen" />
|
11
11
|
</head>
|
12
12
|
<body class="standalone-code">
|
13
|
-
<pre> <span class="ruby-comment cmt"># File lib/rfuzz/client.rb, line
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
13
|
+
<pre> <span class="ruby-comment cmt"># File lib/rfuzz/client.rb, line 344</span>
|
14
|
+
344: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">read_response</span>
|
15
|
+
345: <span class="ruby-identifier">resp</span> = <span class="ruby-constant">HttpResponse</span>.<span class="ruby-identifier">new</span>
|
16
|
+
346:
|
17
|
+
347: <span class="ruby-identifier">notify</span> <span class="ruby-identifier">:read_header</span> <span class="ruby-keyword kw">do</span>
|
18
|
+
348: <span class="ruby-identifier">resp</span> = <span class="ruby-identifier">read_parsed_header</span>
|
19
|
+
349: <span class="ruby-keyword kw">end</span>
|
20
|
+
350:
|
21
|
+
351: <span class="ruby-identifier">notify</span> <span class="ruby-identifier">:read_body</span> <span class="ruby-keyword kw">do</span>
|
22
|
+
352: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">resp</span>.<span class="ruby-identifier">chunked_encoding?</span>
|
23
|
+
353: <span class="ruby-identifier">read_chunked_body</span>(<span class="ruby-identifier">resp</span>)
|
24
|
+
354: <span class="ruby-keyword kw">elsif</span> <span class="ruby-identifier">resp</span>[<span class="ruby-constant">CONTENT_LENGTH</span>]
|
25
|
+
355: <span class="ruby-identifier">needs</span> = <span class="ruby-identifier">resp</span>[<span class="ruby-constant">CONTENT_LENGTH</span>].<span class="ruby-identifier">to_i</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>
|
26
|
+
356: <span class="ruby-comment cmt"># Some requests can actually give a content length, and then not have content</span>
|
27
|
+
357: <span class="ruby-comment cmt"># so we ignore HttpClientError exceptions and pray that's good enough</span>
|
28
|
+
358: <span class="ruby-identifier">resp</span>.<span class="ruby-identifier">http_body</span> <span class="ruby-operator">+=</span> <span class="ruby-ivar">@sock</span>.<span class="ruby-identifier">read</span>(<span class="ruby-identifier">needs</span>) <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">needs</span> <span class="ruby-operator">></span> <span class="ruby-value">0</span> <span class="ruby-keyword kw">rescue</span> <span class="ruby-constant">HttpClientError</span>
|
29
|
+
359: <span class="ruby-keyword kw">else</span>
|
30
|
+
360: <span class="ruby-keyword kw">while</span> <span class="ruby-keyword kw">true</span>
|
31
|
+
361: <span class="ruby-keyword kw">begin</span>
|
32
|
+
362: <span class="ruby-identifier">resp</span>.<span class="ruby-identifier">http_body</span> <span class="ruby-operator">+=</span> <span class="ruby-ivar">@sock</span>.<span class="ruby-identifier">read</span>(<span class="ruby-constant">CHUNK_SIZE</span>, <span class="ruby-identifier">partial</span>=<span class="ruby-keyword kw">true</span>)
|
33
|
+
363: <span class="ruby-keyword kw">rescue</span> <span class="ruby-constant">HttpClientError</span>
|
34
|
+
364: <span class="ruby-keyword kw">break</span> <span class="ruby-comment cmt"># this is fine, they closed the socket then</span>
|
35
|
+
365: <span class="ruby-keyword kw">end</span>
|
36
|
+
366: <span class="ruby-keyword kw">end</span>
|
37
|
+
367: <span class="ruby-keyword kw">end</span>
|
38
|
+
368: <span class="ruby-keyword kw">end</span>
|
39
|
+
369:
|
40
|
+
370: <span class="ruby-identifier">store_cookies</span>(<span class="ruby-identifier">resp</span>)
|
41
|
+
371: <span class="ruby-keyword kw">return</span> <span class="ruby-identifier">resp</span>
|
42
|
+
372: <span class="ruby-keyword kw">end</span></pre>
|
37
43
|
</body>
|
38
44
|
</html>
|
@@ -5,22 +5,34 @@
|
|
5
5
|
|
6
6
|
<html>
|
7
7
|
<head>
|
8
|
-
<title>
|
8
|
+
<title>send_request (RFuzz::HttpClient)</title>
|
9
9
|
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
|
10
10
|
<link rel="stylesheet" href="../../.././rdoc-style.css" type="text/css" media="screen" />
|
11
11
|
</head>
|
12
12
|
<body class="standalone-code">
|
13
|
-
<pre> <span class="ruby-comment cmt"># File lib/rfuzz/client.rb, line
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
13
|
+
<pre> <span class="ruby-comment cmt"># File lib/rfuzz/client.rb, line 376</span>
|
14
|
+
376: <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
|
+
377: <span class="ruby-keyword kw">begin</span>
|
16
|
+
378: <span class="ruby-identifier">notify</span> <span class="ruby-identifier">:connect</span> <span class="ruby-keyword kw">do</span>
|
17
|
+
379: <span class="ruby-ivar">@sock</span> = <span class="ruby-constant">PushBackIO</span>.<span class="ruby-identifier">new</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>))
|
18
|
+
380: <span class="ruby-keyword kw">end</span>
|
19
|
+
381:
|
20
|
+
382: <span class="ruby-identifier">out</span> = <span class="ruby-constant">StringIO</span>.<span class="ruby-identifier">new</span>
|
21
|
+
383: <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>)
|
22
|
+
384:
|
23
|
+
385: <span class="ruby-identifier">notify</span> <span class="ruby-identifier">:send_request</span> <span class="ruby-keyword kw">do</span>
|
24
|
+
386: <span class="ruby-ivar">@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>)
|
25
|
+
387: <span class="ruby-ivar">@sock</span>.<span class="ruby-identifier">flush</span>
|
26
|
+
388: <span class="ruby-keyword kw">end</span>
|
27
|
+
389:
|
28
|
+
390: <span class="ruby-keyword kw">return</span> <span class="ruby-identifier">read_response</span>
|
29
|
+
391: <span class="ruby-keyword kw">rescue</span> <span class="ruby-constant">Object</span>
|
30
|
+
392: <span class="ruby-identifier">raise</span> <span class="ruby-identifier">$!</span>
|
31
|
+
393: <span class="ruby-keyword kw">ensure</span>
|
32
|
+
394: <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@sock</span>
|
33
|
+
395: <span class="ruby-identifier">notify</span>(<span class="ruby-identifier">:close</span>) { <span class="ruby-ivar">@sock</span>.<span class="ruby-identifier">close</span> }
|
34
|
+
396: <span class="ruby-keyword kw">end</span>
|
35
|
+
397: <span class="ruby-keyword kw">end</span>
|
36
|
+
398: <span class="ruby-keyword kw">end</span></pre>
|
25
37
|
</body>
|
26
38
|
</html>
|
@@ -5,30 +5,22 @@
|
|
5
5
|
|
6
6
|
<html>
|
7
7
|
<head>
|
8
|
-
<title>
|
8
|
+
<title>method_missing (RFuzz::HttpClient)</title>
|
9
9
|
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
|
10
10
|
<link rel="stylesheet" href="../../.././rdoc-style.css" type="text/css" media="screen" />
|
11
11
|
</head>
|
12
12
|
<body class="standalone-code">
|
13
|
-
<pre> <span class="ruby-comment cmt"># File lib/rfuzz/client.rb, line
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
429:
|
26
|
-
430: <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
|
-
431: <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
|
-
432: <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
|
-
433: <span class="ruby-keyword kw">end</span>
|
30
|
-
434:
|
31
|
-
435: <span class="ruby-keyword kw">return</span> <span class="ruby-identifier">resp</span>
|
32
|
-
436: <span class="ruby-keyword kw">end</span></pre>
|
13
|
+
<pre> <span class="ruby-comment cmt"># File lib/rfuzz/client.rb, line 405</span>
|
14
|
+
405: <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
|
+
406: <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
|
+
407: <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
|
+
408: <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
|
+
409: <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
|
+
410:
|
20
|
+
411: <span class="ruby-keyword kw">return</span> <span class="ruby-identifier">resp</span>
|
21
|
+
412: <span class="ruby-keyword kw">else</span>
|
22
|
+
413: <span class="ruby-identifier">raise</span> <span class="ruby-constant">HttpClientError</span>.<span class="ruby-identifier">new</span>(<span class="ruby-node">"Invalid method: #{symbol}"</span>)
|
23
|
+
414: <span class="ruby-keyword kw">end</span>
|
24
|
+
415: <span class="ruby-keyword kw">end</span></pre>
|
33
25
|
</body>
|
34
26
|
</html>
|
@@ -5,14 +5,30 @@
|
|
5
5
|
|
6
6
|
<html>
|
7
7
|
<head>
|
8
|
-
<title>
|
8
|
+
<title>redirect (RFuzz::HttpClient)</title>
|
9
9
|
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
|
10
10
|
<link rel="stylesheet" href="../../.././rdoc-style.css" type="text/css" media="screen" />
|
11
11
|
</head>
|
12
12
|
<body class="standalone-code">
|
13
|
-
<pre> <span class="ruby-comment cmt"># File lib/rfuzz/client.rb, line
|
14
|
-
|
15
|
-
|
16
|
-
|
13
|
+
<pre> <span class="ruby-comment cmt"># File lib/rfuzz/client.rb, line 418</span>
|
14
|
+
418: <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
|
+
419: <span class="ruby-ivar">@redirect</span>.<span class="ruby-identifier">times</span> <span class="ruby-keyword kw">do</span>
|
16
|
+
420: <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">"3"</span>) <span class="ruby-operator">!=</span> <span class="ruby-value">0</span>
|
17
|
+
421:
|
18
|
+
422: <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
|
+
423: <span class="ruby-identifier">location</span> = <span class="ruby-identifier">resp</span>[<span class="ruby-constant">LOCATION</span>]
|
20
|
+
424:
|
21
|
+
425: <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
|
+
426: <span class="ruby-comment cmt"># begins with the host so strip that off</span>
|
23
|
+
427: <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
|
+
428: <span class="ruby-keyword kw">end</span>
|
25
|
+
429:
|
26
|
+
430: <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
|
+
431: <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
|
+
432: <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
|
+
433: <span class="ruby-keyword kw">end</span>
|
30
|
+
434:
|
31
|
+
435: <span class="ruby-keyword kw">return</span> <span class="ruby-identifier">resp</span>
|
32
|
+
436: <span class="ruby-keyword kw">end</span></pre>
|
17
33
|
</body>
|
18
34
|
</html>
|
@@ -5,22 +5,14 @@
|
|
5
5
|
|
6
6
|
<html>
|
7
7
|
<head>
|
8
|
-
<title>
|
8
|
+
<title>reset (RFuzz::HttpClient)</title>
|
9
9
|
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
|
10
10
|
<link rel="stylesheet" href="../../.././rdoc-style.css" type="text/css" media="screen" />
|
11
11
|
</head>
|
12
12
|
<body class="standalone-code">
|
13
|
-
<pre> <span class="ruby-comment cmt"># File lib/rfuzz/client.rb, line
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
454: <span class="ruby-keyword kw">begin</span>
|
18
|
-
455: <span class="ruby-keyword kw">yield</span>
|
19
|
-
456: <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
|
-
457: <span class="ruby-keyword kw">rescue</span> <span class="ruby-constant">Object</span>
|
21
|
-
458: <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
|
-
459: <span class="ruby-identifier">raise</span> <span class="ruby-identifier">$!</span>
|
23
|
-
460: <span class="ruby-keyword kw">end</span>
|
24
|
-
461: <span class="ruby-keyword kw">end</span></pre>
|
13
|
+
<pre> <span class="ruby-comment cmt"># File lib/rfuzz/client.rb, line 440</span>
|
14
|
+
440: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">reset</span>
|
15
|
+
441: <span class="ruby-ivar">@cookies</span>.<span class="ruby-identifier">clear</span>
|
16
|
+
442: <span class="ruby-keyword kw">end</span></pre>
|
25
17
|
</body>
|
26
18
|
</html>
|