rfuzz 0.7 → 0.8
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/Browser.html +15 -15
- data/doc/rdoc/classes/RFuzz/Browser.src/{M000068.html → M000083.html} +0 -0
- data/doc/rdoc/classes/RFuzz/Browser.src/{M000069.html → M000084.html} +0 -0
- data/doc/rdoc/classes/RFuzz/Browser.src/{M000070.html → M000085.html} +0 -0
- data/doc/rdoc/classes/RFuzz/HttpClient.html +114 -57
- data/doc/rdoc/classes/RFuzz/HttpClient.src/M000019.html +12 -13
- data/doc/rdoc/classes/RFuzz/HttpClient.src/{M000011.html → M000020.html} +20 -20
- data/doc/rdoc/classes/RFuzz/HttpClient.src/M000021.html +28 -0
- data/doc/rdoc/classes/RFuzz/HttpClient.src/M000022.html +30 -0
- data/doc/rdoc/classes/RFuzz/HttpClient.src/M000023.html +35 -0
- data/doc/rdoc/classes/RFuzz/HttpClient.src/M000024.html +22 -0
- data/doc/rdoc/classes/RFuzz/HttpClient.src/M000025.html +44 -0
- data/doc/rdoc/classes/RFuzz/HttpClient.src/M000026.html +38 -0
- data/doc/rdoc/classes/RFuzz/HttpClient.src/{M000016.html → M000027.html} +12 -12
- data/doc/rdoc/classes/RFuzz/HttpClient.src/{M000017.html → M000028.html} +20 -20
- data/doc/rdoc/classes/RFuzz/HttpClient.src/{M000018.html → M000029.html} +4 -4
- data/doc/rdoc/classes/RFuzz/HttpClient.src/M000030.html +26 -0
- data/doc/rdoc/classes/RFuzz/HttpClientError.html +118 -0
- data/doc/rdoc/classes/RFuzz/HttpEncoding.html +7 -4
- data/doc/rdoc/classes/RFuzz/HttpEncoding.src/M000001.html +12 -12
- data/doc/rdoc/classes/RFuzz/HttpEncoding.src/M000002.html +4 -4
- data/doc/rdoc/classes/RFuzz/HttpEncoding.src/M000003.html +12 -12
- data/doc/rdoc/classes/RFuzz/HttpEncoding.src/M000004.html +4 -4
- data/doc/rdoc/classes/RFuzz/HttpEncoding.src/M000005.html +18 -18
- data/doc/rdoc/classes/RFuzz/HttpEncoding.src/M000006.html +4 -4
- data/doc/rdoc/classes/RFuzz/HttpEncoding.src/M000007.html +6 -6
- data/doc/rdoc/classes/RFuzz/HttpEncoding.src/M000008.html +6 -6
- data/doc/rdoc/classes/RFuzz/HttpEncoding.src/M000009.html +18 -18
- data/doc/rdoc/classes/RFuzz/HttpResponse.html +74 -13
- data/doc/rdoc/classes/RFuzz/HttpResponse.src/M000031.html +22 -0
- data/doc/rdoc/classes/RFuzz/HttpResponse.src/M000032.html +18 -0
- data/doc/rdoc/classes/RFuzz/HttpResponse.src/M000033.html +18 -0
- data/doc/rdoc/classes/RFuzz/Notifier.html +49 -31
- data/doc/rdoc/classes/RFuzz/Notifier.src/{M000044.html → M000058.html} +3 -3
- data/doc/rdoc/classes/RFuzz/Notifier.src/{M000045.html → M000059.html} +3 -3
- data/doc/rdoc/classes/RFuzz/Notifier.src/{M000047.html → M000060.html} +2 -2
- data/doc/rdoc/classes/RFuzz/Notifier.src/{M000048.html → M000061.html} +2 -2
- data/doc/rdoc/classes/RFuzz/Notifier.src/{M000049.html → M000062.html} +2 -2
- data/doc/rdoc/classes/RFuzz/Notifier.src/{M000046.html → M000063.html} +4 -4
- data/doc/rdoc/classes/RFuzz/Notifier.src/M000064.html +17 -0
- data/doc/rdoc/classes/RFuzz/PushBackIO.html +296 -0
- data/doc/rdoc/classes/RFuzz/PushBackIO.src/M000010.html +19 -0
- data/doc/rdoc/classes/RFuzz/PushBackIO.src/M000011.html +20 -0
- data/doc/rdoc/classes/RFuzz/PushBackIO.src/M000012.html +19 -0
- data/doc/rdoc/classes/RFuzz/PushBackIO.src/M000013.html +18 -0
- data/doc/rdoc/classes/RFuzz/PushBackIO.src/M000014.html +44 -0
- data/doc/rdoc/classes/RFuzz/PushBackIO.src/M000015.html +18 -0
- data/doc/rdoc/classes/RFuzz/PushBackIO.src/M000016.html +18 -0
- data/doc/rdoc/classes/RFuzz/PushBackIO.src/M000017.html +18 -0
- data/doc/rdoc/classes/RFuzz/PushBackIO.src/M000018.html +22 -0
- data/doc/rdoc/classes/RFuzz/RandomGenerator.html +62 -62
- data/doc/rdoc/classes/RFuzz/RandomGenerator.src/{M000032.html → M000046.html} +0 -0
- data/doc/rdoc/classes/RFuzz/RandomGenerator.src/{M000033.html → M000047.html} +0 -0
- data/doc/rdoc/classes/RFuzz/RandomGenerator.src/{M000036.html → M000050.html} +0 -0
- data/doc/rdoc/classes/RFuzz/RandomGenerator.src/{M000037.html → M000051.html} +0 -0
- data/doc/rdoc/classes/RFuzz/RandomGenerator.src/{M000038.html → M000052.html} +0 -0
- data/doc/rdoc/classes/RFuzz/RandomGenerator.src/{M000039.html → M000053.html} +0 -0
- data/doc/rdoc/classes/RFuzz/RandomGenerator.src/{M000040.html → M000054.html} +0 -0
- data/doc/rdoc/classes/RFuzz/RandomGenerator.src/{M000041.html → M000055.html} +0 -0
- data/doc/rdoc/classes/RFuzz/RandomGenerator.src/{M000042.html → M000056.html} +0 -0
- data/doc/rdoc/classes/RFuzz/RandomGenerator.src/{M000043.html → M000057.html} +0 -0
- data/doc/rdoc/classes/RFuzz/Sampler.html +60 -60
- data/doc/rdoc/classes/RFuzz/Sampler.src/{M000056.html → M000071.html} +0 -0
- data/doc/rdoc/classes/RFuzz/Sampler.src/{M000057.html → M000072.html} +0 -0
- data/doc/rdoc/classes/RFuzz/Sampler.src/{M000058.html → M000073.html} +0 -0
- data/doc/rdoc/classes/RFuzz/Sampler.src/{M000059.html → M000074.html} +0 -0
- data/doc/rdoc/classes/RFuzz/Sampler.src/{M000060.html → M000075.html} +0 -0
- data/doc/rdoc/classes/RFuzz/Sampler.src/{M000061.html → M000076.html} +0 -0
- data/doc/rdoc/classes/RFuzz/Sampler.src/{M000062.html → M000077.html} +0 -0
- data/doc/rdoc/classes/RFuzz/Sampler.src/{M000063.html → M000078.html} +0 -0
- data/doc/rdoc/classes/RFuzz/Sampler.src/{M000064.html → M000079.html} +0 -0
- data/doc/rdoc/classes/RFuzz/Sampler.src/{M000065.html → M000080.html} +0 -0
- data/doc/rdoc/classes/RFuzz/Sampler.src/{M000066.html → M000081.html} +0 -0
- data/doc/rdoc/classes/RFuzz/Sampler.src/{M000067.html → M000082.html} +0 -0
- data/doc/rdoc/classes/RFuzz/Session.html +63 -63
- data/doc/rdoc/classes/RFuzz/Session.src/{M000020.html → M000034.html} +0 -0
- data/doc/rdoc/classes/RFuzz/Session.src/{M000021.html → M000035.html} +0 -0
- data/doc/rdoc/classes/RFuzz/Session.src/{M000022.html → M000036.html} +0 -0
- data/doc/rdoc/classes/RFuzz/Session.src/{M000023.html → M000037.html} +0 -0
- data/doc/rdoc/classes/RFuzz/Session.src/{M000024.html → M000038.html} +0 -0
- data/doc/rdoc/classes/RFuzz/Session.src/{M000025.html → M000039.html} +0 -0
- data/doc/rdoc/classes/RFuzz/Session.src/{M000026.html → M000040.html} +0 -0
- data/doc/rdoc/classes/RFuzz/Session.src/{M000027.html → M000041.html} +0 -0
- data/doc/rdoc/classes/RFuzz/Session.src/{M000028.html → M000042.html} +0 -0
- data/doc/rdoc/classes/RFuzz/Session.src/{M000029.html → M000043.html} +0 -0
- data/doc/rdoc/classes/RFuzz/Session.src/{M000030.html → M000044.html} +0 -0
- data/doc/rdoc/classes/RFuzz/Session.src/{M000031.html → M000045.html} +0 -0
- data/doc/rdoc/classes/RFuzz/StatsTracker.html +32 -32
- data/doc/rdoc/classes/RFuzz/StatsTracker.src/{M000050.html → M000065.html} +0 -0
- data/doc/rdoc/classes/RFuzz/StatsTracker.src/{M000051.html → M000066.html} +0 -0
- data/doc/rdoc/classes/RFuzz/StatsTracker.src/{M000052.html → M000067.html} +0 -0
- data/doc/rdoc/classes/RFuzz/StatsTracker.src/{M000053.html → M000068.html} +0 -0
- data/doc/rdoc/classes/RFuzz/StatsTracker.src/{M000054.html → M000069.html} +0 -0
- data/doc/rdoc/classes/RFuzz/StatsTracker.src/{M000055.html → M000070.html} +0 -0
- data/doc/rdoc/classes/RFuzz.html +7 -1
- data/doc/rdoc/created.rid +1 -1
- data/doc/rdoc/files/lib/rfuzz/client_rb.html +2 -2
- data/doc/rdoc/files/lib/rfuzz/pushbackio_rb.html +108 -0
- data/doc/rdoc/fr_class_index.html +2 -0
- data/doc/rdoc/fr_file_index.html +1 -0
- data/doc/rdoc/fr_method_index.html +76 -61
- data/examples/cl_watcher.rb +12 -9
- data/examples/hpricot_pudding.rb +1 -1
- data/examples/mongrel_test_suite/test/http/protocol_parameters.rb +0 -3
- data/examples/mongrel_test_suite/test/rails/catastrophe.rb +26 -0
- data/examples/mongrel_test_suite/test/rails/conditional.rb +81 -0
- data/examples/mongrel_test_suite/test/rails/put.rb +25 -0
- data/examples/mongrel_test_suite/test/rails/redirect.rb +13 -0
- data/examples/mongrel_test_suite/test/rails/static_files.rb +47 -2
- data/examples/rails_security_test.rb +61 -0
- data/ext/http11_client/http11_client.c +15 -1
- data/ext/http11_client/http11_parser.c +627 -203
- data/ext/http11_client/http11_parser.h +2 -0
- data/ext/http11_client/http11_parser.rl +8 -4
- data/lib/rfuzz/client.rb +124 -115
- data/lib/rfuzz/pushbackio.rb +90 -0
- metadata +86 -60
- data/doc/rdoc/classes/RFuzz/HttpClient.src/M000010.html +0 -24
- data/doc/rdoc/classes/RFuzz/HttpClient.src/M000012.html +0 -50
- data/doc/rdoc/classes/RFuzz/HttpClient.src/M000013.html +0 -49
- data/doc/rdoc/classes/RFuzz/HttpClient.src/M000014.html +0 -57
- data/doc/rdoc/classes/RFuzz/HttpClient.src/M000015.html +0 -37
@@ -0,0 +1,44 @@
|
|
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 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>
|
43
|
+
</body>
|
44
|
+
</html>
|
@@ -0,0 +1,38 @@
|
|
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 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>
|
37
|
+
</body>
|
38
|
+
</html>
|
@@ -10,17 +10,17 @@
|
|
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 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>
|
25
25
|
</body>
|
26
26
|
</html>
|
@@ -10,25 +10,25 @@
|
|
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
|
-
|
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>
|
33
33
|
</body>
|
34
34
|
</html>
|
@@ -10,9 +10,9 @@
|
|
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 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>
|
17
17
|
</body>
|
18
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 451</span>
|
14
|
+
451: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">notify</span>(<span class="ruby-identifier">event</span>)
|
15
|
+
452: <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
|
+
453:
|
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>
|
25
|
+
</body>
|
26
|
+
</html>
|
@@ -0,0 +1,118 @@
|
|
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: RFuzz::HttpClientError</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">RFuzz::HttpClientError</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
|
+
<tr class="top-aligned-row">
|
66
|
+
<td><strong>Parent:</strong></td>
|
67
|
+
<td>
|
68
|
+
StandardError
|
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
|
+
<p>
|
83
|
+
Thrown for errors not related to the protocol format (HttpClientParserError
|
84
|
+
are thrown for that).
|
85
|
+
</p>
|
86
|
+
|
87
|
+
</div>
|
88
|
+
|
89
|
+
|
90
|
+
</div>
|
91
|
+
|
92
|
+
|
93
|
+
</div>
|
94
|
+
|
95
|
+
|
96
|
+
<!-- if includes -->
|
97
|
+
|
98
|
+
<div id="section">
|
99
|
+
|
100
|
+
|
101
|
+
|
102
|
+
|
103
|
+
|
104
|
+
|
105
|
+
|
106
|
+
|
107
|
+
<!-- if method_list -->
|
108
|
+
|
109
|
+
|
110
|
+
</div>
|
111
|
+
|
112
|
+
|
113
|
+
<div id="validator-badges">
|
114
|
+
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
|
115
|
+
</div>
|
116
|
+
|
117
|
+
</body>
|
118
|
+
</html>
|
@@ -118,6 +118,11 @@ but you can use it as well.
|
|
118
118
|
<td>=</td>
|
119
119
|
<td class="context-item-value">"Cookie"</td>
|
120
120
|
</tr>
|
121
|
+
<tr class="top-aligned-row context-row">
|
122
|
+
<td class="context-item-name">FIELD_ENCODING</td>
|
123
|
+
<td>=</td>
|
124
|
+
<td class="context-item-value">"%s: %s\r\n"</td>
|
125
|
+
</tr>
|
121
126
|
</table>
|
122
127
|
</div>
|
123
128
|
</div>
|
@@ -248,9 +253,7 @@ with & separating them.
|
|
248
253
|
|
249
254
|
<div class="method-description">
|
250
255
|
<p>
|
251
|
-
|
252
|
-
faster. Use this rather than the cgi.rb version since it’s faster.
|
253
|
-
(Stolen from Camping).
|
256
|
+
Escapes a URI.
|
254
257
|
</p>
|
255
258
|
</div>
|
256
259
|
</div>
|
@@ -287,7 +290,7 @@ changing the characters used in the second parameter (which defaults to
|
|
287
290
|
|
288
291
|
<div class="method-description">
|
289
292
|
<p>
|
290
|
-
Unescapes a URI escaped string.
|
293
|
+
Unescapes a URI escaped string.
|
291
294
|
</p>
|
292
295
|
</div>
|
293
296
|
</div>
|
@@ -10,17 +10,17 @@
|
|
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 63</span>
|
14
|
+
63: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">encode_cookies</span>(<span class="ruby-identifier">cookies</span>)
|
15
|
+
64: <span class="ruby-identifier">result</span> = <span class="ruby-value str">""</span>
|
16
|
+
65: <span class="ruby-identifier">cookies</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
|
+
66: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">v</span>.<span class="ruby-identifier">kind_of?</span> <span class="ruby-constant">Array</span>
|
18
|
+
67: <span class="ruby-identifier">v</span>.<span class="ruby-identifier">each</span> {<span class="ruby-operator">|</span><span class="ruby-identifier">x</span><span class="ruby-operator">|</span> <span class="ruby-identifier">result</span> <span class="ruby-operator"><<</span> <span class="ruby-identifier">encode_field</span>(<span class="ruby-constant">COOKIE</span>, <span class="ruby-identifier">encode_param</span>(<span class="ruby-identifier">k</span>,<span class="ruby-identifier">x</span>)) }
|
19
|
+
68: <span class="ruby-keyword kw">else</span>
|
20
|
+
69: <span class="ruby-identifier">result</span> <span class="ruby-operator"><<</span> <span class="ruby-identifier">encode_field</span>(<span class="ruby-constant">COOKIE</span>, <span class="ruby-identifier">encode_param</span>(<span class="ruby-identifier">k</span>,<span class="ruby-identifier">v</span>))
|
21
|
+
70: <span class="ruby-keyword kw">end</span>
|
22
|
+
71: <span class="ruby-keyword kw">end</span>
|
23
|
+
72: <span class="ruby-keyword kw">return</span> <span class="ruby-identifier">result</span>
|
24
|
+
73: <span class="ruby-keyword kw">end</span></pre>
|
25
25
|
</body>
|
26
26
|
</html>
|
@@ -10,9 +10,9 @@
|
|
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 76</span>
|
14
|
+
76: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">encode_field</span>(<span class="ruby-identifier">k</span>,<span class="ruby-identifier">v</span>)
|
15
|
+
77: <span class="ruby-constant">FIELD_ENCODING</span> <span class="ruby-operator">%</span> [<span class="ruby-identifier">k</span>,<span class="ruby-identifier">v</span>]
|
16
|
+
78: <span class="ruby-keyword kw">end</span></pre>
|
17
17
|
</body>
|
18
18
|
</html>
|
@@ -10,17 +10,17 @@
|
|
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 82</span>
|
14
|
+
82: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">encode_headers</span>(<span class="ruby-identifier">head</span>)
|
15
|
+
83: <span class="ruby-identifier">result</span> = <span class="ruby-value str">""</span>
|
16
|
+
84: <span class="ruby-identifier">head</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
|
+
85: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">v</span>.<span class="ruby-identifier">kind_of?</span> <span class="ruby-constant">Array</span>
|
18
|
+
86: <span class="ruby-identifier">v</span>.<span class="ruby-identifier">each</span> {<span class="ruby-operator">|</span><span class="ruby-identifier">x</span><span class="ruby-operator">|</span> <span class="ruby-identifier">result</span> <span class="ruby-operator"><<</span> <span class="ruby-identifier">encode_field</span>(<span class="ruby-identifier">k</span>,<span class="ruby-identifier">x</span>) }
|
19
|
+
87: <span class="ruby-keyword kw">else</span>
|
20
|
+
88: <span class="ruby-identifier">result</span> <span class="ruby-operator"><<</span> <span class="ruby-identifier">encode_field</span>(<span class="ruby-identifier">k</span>,<span class="ruby-identifier">v</span>)
|
21
|
+
89: <span class="ruby-keyword kw">end</span>
|
22
|
+
90: <span class="ruby-keyword kw">end</span>
|
23
|
+
91: <span class="ruby-keyword kw">return</span> <span class="ruby-identifier">result</span>
|
24
|
+
92: <span class="ruby-keyword kw">end</span></pre>
|
25
25
|
</body>
|
26
26
|
</html>
|
@@ -10,9 +10,9 @@
|
|
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 95</span>
|
14
|
+
95: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">encode_param</span>(<span class="ruby-identifier">k</span>,<span class="ruby-identifier">v</span>)
|
15
|
+
96: <span class="ruby-identifier">escape</span>(<span class="ruby-identifier">k</span>) <span class="ruby-operator">+</span> <span class="ruby-value str">"="</span> <span class="ruby-operator">+</span> <span class="ruby-identifier">escape</span>(<span class="ruby-identifier">v</span>)
|
16
|
+
97: <span class="ruby-keyword kw">end</span></pre>
|
17
17
|
</body>
|
18
18
|
</html>
|
@@ -10,23 +10,23 @@
|
|
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
|
-
|
13
|
+
<pre> <span class="ruby-comment cmt"># File lib/rfuzz/client.rb, line 101</span>
|
14
|
+
101: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">encode_query</span>(<span class="ruby-identifier">uri</span>, <span class="ruby-identifier">query</span>)
|
15
|
+
102: <span class="ruby-identifier">params</span> = []
|
16
|
+
103:
|
17
|
+
104: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">query</span>
|
18
|
+
105: <span class="ruby-identifier">query</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>
|
19
|
+
106: <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">v</span>.<span class="ruby-identifier">kind_of?</span> <span class="ruby-constant">Array</span>
|
20
|
+
107: <span class="ruby-identifier">v</span>.<span class="ruby-identifier">each</span> {<span class="ruby-operator">|</span><span class="ruby-identifier">x</span><span class="ruby-operator">|</span> <span class="ruby-identifier">params</span> <span class="ruby-operator"><<</span> <span class="ruby-identifier">encode_param</span>(<span class="ruby-identifier">k</span>,<span class="ruby-identifier">x</span>) }
|
21
|
+
108: <span class="ruby-keyword kw">else</span>
|
22
|
+
109: <span class="ruby-identifier">params</span> <span class="ruby-operator"><<</span> <span class="ruby-identifier">encode_param</span>(<span class="ruby-identifier">k</span>,<span class="ruby-identifier">v</span>)
|
23
|
+
110: <span class="ruby-keyword kw">end</span>
|
24
|
+
111: <span class="ruby-keyword kw">end</span>
|
25
|
+
112:
|
26
|
+
113: <span class="ruby-identifier">uri</span> <span class="ruby-operator">+=</span> <span class="ruby-value str">"?"</span> <span class="ruby-operator">+</span> <span class="ruby-identifier">params</span>.<span class="ruby-identifier">join</span>(<span class="ruby-value str">'&'</span>)
|
27
|
+
114: <span class="ruby-keyword kw">end</span>
|
28
|
+
115:
|
29
|
+
116: <span class="ruby-keyword kw">return</span> <span class="ruby-identifier">uri</span>
|
30
|
+
117: <span class="ruby-keyword kw">end</span></pre>
|
31
31
|
</body>
|
32
32
|
</html>
|
@@ -10,9 +10,9 @@
|
|
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 122</span>
|
14
|
+
122: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">encode_host</span>(<span class="ruby-identifier">host</span>, <span class="ruby-identifier">port</span>)
|
15
|
+
123: <span class="ruby-identifier">host</span> <span class="ruby-operator">+</span> (<span class="ruby-identifier">port</span>.<span class="ruby-identifier">to_i</span> <span class="ruby-operator">!=</span> <span class="ruby-value">80</span> <span class="ruby-operator">?</span> <span class="ruby-node">":#{port}"</span> <span class="ruby-operator">:</span> <span class="ruby-value str">""</span>)
|
16
|
+
124: <span class="ruby-keyword kw">end</span></pre>
|
17
17
|
</body>
|
18
18
|
</html>
|
@@ -10,11 +10,11 @@
|
|
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
|
-
|
13
|
+
<pre> <span class="ruby-comment cmt"># File lib/rfuzz/client.rb, line 127</span>
|
14
|
+
127: <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">escape</span>(<span class="ruby-identifier">s</span>)
|
15
|
+
128: <span class="ruby-identifier">s</span>.<span class="ruby-identifier">to_s</span>.<span class="ruby-identifier">gsub</span>(<span class="ruby-regexp re">/([^ a-zA-Z0-9_.-]+)/n</span>) {
|
16
|
+
129: <span class="ruby-value str">'%'</span><span class="ruby-operator">+</span><span class="ruby-identifier">$1</span>.<span class="ruby-identifier">unpack</span>(<span class="ruby-value str">'H2'</span><span class="ruby-operator">*</span><span class="ruby-identifier">$1</span>.<span class="ruby-identifier">size</span>).<span class="ruby-identifier">join</span>(<span class="ruby-value str">'%'</span>).<span class="ruby-identifier">upcase</span>
|
17
|
+
130: }.<span class="ruby-identifier">tr</span>(<span class="ruby-value str">' '</span>, <span class="ruby-value str">'+'</span>)
|
18
|
+
131: <span class="ruby-keyword kw">end</span></pre>
|
19
19
|
</body>
|
20
20
|
</html>
|