rbkb 0.6.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (101) hide show
  1. data/History.txt +74 -0
  2. data/README.rdoc +149 -0
  3. data/Rakefile +47 -0
  4. data/bin/b64 +5 -0
  5. data/bin/bgrep +5 -0
  6. data/bin/blit +5 -0
  7. data/bin/c +5 -0
  8. data/bin/crc32 +5 -0
  9. data/bin/d64 +5 -0
  10. data/bin/dedump +5 -0
  11. data/bin/feed +5 -0
  12. data/bin/hexify +5 -0
  13. data/bin/len +5 -0
  14. data/bin/plugsrv +271 -0
  15. data/bin/rex +10 -0
  16. data/bin/rstrings +5 -0
  17. data/bin/slice +5 -0
  18. data/bin/telson +5 -0
  19. data/bin/unhexify +5 -0
  20. data/bin/urldec +5 -0
  21. data/bin/urlenc +5 -0
  22. data/bin/xor +5 -0
  23. data/cli_usage.rdoc +285 -0
  24. data/doctor-bag.jpg +0 -0
  25. data/lib/rbkb.rb +51 -0
  26. data/lib/rbkb/cli.rb +219 -0
  27. data/lib/rbkb/cli/b64.rb +35 -0
  28. data/lib/rbkb/cli/bgrep.rb +86 -0
  29. data/lib/rbkb/cli/blit.rb +89 -0
  30. data/lib/rbkb/cli/chars.rb +24 -0
  31. data/lib/rbkb/cli/crc32.rb +35 -0
  32. data/lib/rbkb/cli/d64.rb +28 -0
  33. data/lib/rbkb/cli/dedump.rb +52 -0
  34. data/lib/rbkb/cli/feed.rb +229 -0
  35. data/lib/rbkb/cli/hexify.rb +65 -0
  36. data/lib/rbkb/cli/len.rb +76 -0
  37. data/lib/rbkb/cli/rstrings.rb +108 -0
  38. data/lib/rbkb/cli/slice.rb +47 -0
  39. data/lib/rbkb/cli/telson.rb +87 -0
  40. data/lib/rbkb/cli/unhexify.rb +50 -0
  41. data/lib/rbkb/cli/urldec.rb +35 -0
  42. data/lib/rbkb/cli/urlenc.rb +35 -0
  43. data/lib/rbkb/cli/xor.rb +43 -0
  44. data/lib/rbkb/extends.rb +725 -0
  45. data/lib/rbkb/http.rb +21 -0
  46. data/lib/rbkb/http/base.rb +172 -0
  47. data/lib/rbkb/http/body.rb +214 -0
  48. data/lib/rbkb/http/common.rb +74 -0
  49. data/lib/rbkb/http/headers.rb +370 -0
  50. data/lib/rbkb/http/parameters.rb +104 -0
  51. data/lib/rbkb/http/request.rb +58 -0
  52. data/lib/rbkb/http/response.rb +86 -0
  53. data/lib/rbkb/plug.rb +9 -0
  54. data/lib/rbkb/plug/blit.rb +222 -0
  55. data/lib/rbkb/plug/cli.rb +83 -0
  56. data/lib/rbkb/plug/feed_import.rb +74 -0
  57. data/lib/rbkb/plug/peer.rb +67 -0
  58. data/lib/rbkb/plug/plug.rb +215 -0
  59. data/lib/rbkb/plug/proxy.rb +26 -0
  60. data/lib/rbkb/plug/unix_domain.rb +75 -0
  61. data/lib_usage.rdoc +176 -0
  62. data/rbkb.gemspec +38 -0
  63. data/spec/rbkb_spec.rb +7 -0
  64. data/spec/spec_helper.rb +16 -0
  65. data/tasks/ann.rake +80 -0
  66. data/tasks/bones.rake +20 -0
  67. data/tasks/gem.rake +201 -0
  68. data/tasks/git.rake +40 -0
  69. data/tasks/notes.rake +27 -0
  70. data/tasks/post_load.rake +34 -0
  71. data/tasks/rdoc.rake +51 -0
  72. data/tasks/rubyforge.rake +55 -0
  73. data/tasks/setup.rb +292 -0
  74. data/tasks/spec.rake +54 -0
  75. data/tasks/svn.rake +47 -0
  76. data/tasks/test.rake +40 -0
  77. data/test/test_cli_b64.rb +35 -0
  78. data/test/test_cli_bgrep.rb +137 -0
  79. data/test/test_cli_blit.rb +11 -0
  80. data/test/test_cli_chars.rb +21 -0
  81. data/test/test_cli_crc32.rb +108 -0
  82. data/test/test_cli_d64.rb +22 -0
  83. data/test/test_cli_dedump.rb +118 -0
  84. data/test/test_cli_feed.rb +11 -0
  85. data/test/test_cli_helper.rb +96 -0
  86. data/test/test_cli_hexify.rb +63 -0
  87. data/test/test_cli_len.rb +96 -0
  88. data/test/test_cli_rstrings.rb +15 -0
  89. data/test/test_cli_slice.rb +73 -0
  90. data/test/test_cli_telson.rb +11 -0
  91. data/test/test_cli_unhexify.rb +43 -0
  92. data/test/test_cli_urldec.rb +50 -0
  93. data/test/test_cli_urlenc.rb +44 -0
  94. data/test/test_cli_xor.rb +71 -0
  95. data/test/test_helper.rb +5 -0
  96. data/test/test_http.rb +27 -0
  97. data/test/test_http_helper.rb +60 -0
  98. data/test/test_http_request.rb +136 -0
  99. data/test/test_http_response.rb +222 -0
  100. data/test/test_rbkb.rb +19 -0
  101. metadata +238 -0
@@ -0,0 +1,11 @@
1
+ require File.join(File.dirname(__FILE__), "test_cli_helper.rb")
2
+
3
+ class TestCliTelson < Test::Unit::TestCase
4
+ include CliTest
5
+
6
+ def setup
7
+ @cli_class = Rbkb::Cli::Telson
8
+ super()
9
+ end
10
+
11
+ end
@@ -0,0 +1,43 @@
1
+ require File.join(File.dirname(__FILE__), "test_cli_helper.rb")
2
+ require 'rbkb/cli/unhexify'
3
+
4
+ class TestCliUnhexify < Test::Unit::TestCase
5
+ include CliTest
6
+
7
+ def setup
8
+ @cli_class = Rbkb::Cli::Unhexify
9
+ super()
10
+ end
11
+
12
+ def test_string_arg
13
+ assert_equal 0, go_with_args(%w(666f6f))
14
+ assert_equal("foo", @stdout_io.string)
15
+ end
16
+
17
+ def test_string_arg_with_delim_arg
18
+ assert_equal 0, go_with_args(%w(-d : 66:6f:6f))
19
+ assert_equal("foo", @stdout_io.string)
20
+ end
21
+
22
+ def test_stdin
23
+ @stdin_io.write("666f6f") ; @stdin_io.rewind
24
+ assert_equal 0, go_with_args
25
+ assert_equal("foo", @stdout_io.string)
26
+ end
27
+
28
+ def test_stdin_with_delim_default_allchars
29
+ @stdin_io.write((0..255).map {|x| x.to_s(16)}.join(' ')); @stdin_io.rewind
30
+ assert_equal 0, go_with_args
31
+ assert_equal((0..255).map {|x| x.chr}.join, @stdout_io.string)
32
+ end
33
+
34
+
35
+ def test_file_input
36
+ with_testfile do |fname, tf|
37
+ tf.write "6865785f746573745f666f6f"; tf.close
38
+ assert_equal 0, go_with_args(["-f", fname])
39
+ assert_equal("hex_test_foo", @stdout_io.string)
40
+ end
41
+ end
42
+
43
+ end
@@ -0,0 +1,50 @@
1
+ require File.join(File.dirname(__FILE__), "test_cli_helper.rb")
2
+ require 'rbkb/cli/urldec'
3
+
4
+ class TestCliUrldec < Test::Unit::TestCase
5
+ include CliTest
6
+
7
+ def setup
8
+ @cli_class = Rbkb::Cli::Urldec
9
+ super()
10
+ end
11
+
12
+ def test_basic_string_arg
13
+ assert_equal 0, run_with_args(["foo"])
14
+ assert_equal "foo", @stdout_io.string
15
+ end
16
+
17
+ def test_basic_string_arg_with_space
18
+ assert_equal 0, run_with_args(["f%20oo"])
19
+ assert_equal "f oo", @stdout_io.string
20
+ end
21
+
22
+ def test_basic_string_arg_with_space_plus
23
+ assert_equal 0, run_with_args(["f+oo"])
24
+ assert_equal "f oo", @stdout_io.string
25
+ end
26
+
27
+ def test_basic_string_arg_with_space_plus_p_arg
28
+ assert_equal 0, run_with_args(["-p", "f+oo"])
29
+ assert_equal "f oo", @stdout_io.string
30
+ end
31
+
32
+ def test_basic_string_arg_with_space_plus_plus_arg
33
+ assert_equal 0, run_with_args(["--plus", "f+oo"])
34
+ assert_equal "f oo", @stdout_io.string
35
+ end
36
+
37
+ def test_basic_string_arg_with_space_plus_noplus_arg
38
+ assert_equal 0, run_with_args(["--no-plus", "f+oo"])
39
+ assert_equal "f+oo", @stdout_io.string
40
+ end
41
+
42
+ def test_allchars
43
+ allchars_dec = (0..255).map {|c| c.chr}.join
44
+ allchars_enc = "%00%01%02%03%04%05%06%07%08%09%0a%0b%0c%0d%0e%0f%10%11%12%13%14%15%16%17%18%19%1a%1b%1c%1d%1e%1f%20%21%22%23%24%25%26%27%28%29%2a%2b%2c-.%2f0123456789%3a%3b%3c%3d%3e%3f%40ABCDEFGHIJKLMNOPQRSTUVWXYZ%5b%5c%5d%5e_%60abcdefghijklmnopqrstuvwxyz%7b%7c%7d~%7f%80%81%82%83%84%85%86%87%88%89%8a%8b%8c%8d%8e%8f%90%91%92%93%94%95%96%97%98%99%9a%9b%9c%9d%9e%9f%a0%a1%a2%a3%a4%a5%a6%a7%a8%a9%aa%ab%ac%ad%ae%af%b0%b1%b2%b3%b4%b5%b6%b7%b8%b9%ba%bb%bc%bd%be%bf%c0%c1%c2%c3%c4%c5%c6%c7%c8%c9%ca%cb%cc%cd%ce%cf%d0%d1%d2%d3%d4%d5%d6%d7%d8%d9%da%db%dc%dd%de%df%e0%e1%e2%e3%e4%e5%e6%e7%e8%e9%ea%eb%ec%ed%ee%ef%f0%f1%f2%f3%f4%f5%f6%f7%f8%f9%fa%fb%fc%fd%fe%ff"
45
+ assert_equal 0, run_with_args([allchars_enc])
46
+ assert_equal allchars_dec, @stdout_io.string
47
+ end
48
+
49
+
50
+ end
@@ -0,0 +1,44 @@
1
+ require File.join(File.dirname(__FILE__), "test_cli_helper.rb")
2
+ require 'rbkb/cli/urlenc'
3
+
4
+ class TestCliUrlenc < Test::Unit::TestCase
5
+ include CliTest
6
+
7
+ def setup
8
+ @cli_class = Rbkb::Cli::Urlenc
9
+ super()
10
+ end
11
+
12
+ def test_basic_string_arg
13
+ assert_equal 0, run_with_args(["foo"])
14
+ assert_equal "foo\n", @stdout_io.string
15
+ end
16
+
17
+ def test_basic_string_arg_space_default
18
+ assert_equal 0, run_with_args(["fo o"])
19
+ assert_equal "fo%20o\n", @stdout_io.string
20
+ end
21
+
22
+ def test_basic_string_arg_space_with_p
23
+ assert_equal 0, run_with_args(["-p", "fo o"])
24
+ assert_equal "fo+o\n", @stdout_io.string
25
+ end
26
+
27
+ def test_basic_string_arg_space_with_plus
28
+ assert_equal 0, run_with_args(["--plus", "fo o"])
29
+ assert_equal "fo+o\n", @stdout_io.string
30
+ end
31
+
32
+ def test_basic_string_arg_space_with_noplus
33
+ assert_equal 0, run_with_args(["--no-plus", "fo o"])
34
+ assert_equal "fo%20o\n", @stdout_io.string
35
+ end
36
+
37
+ def test_allchars
38
+ allchars_dec = (0..255).map {|c| c.chr}.join
39
+ allchars_enc = "%00%01%02%03%04%05%06%07%08%09%0a%0b%0c%0d%0e%0f%10%11%12%13%14%15%16%17%18%19%1a%1b%1c%1d%1e%1f%20%21%22%23%24%25%26%27%28%29%2a%2b%2c-.%2f0123456789%3a%3b%3c%3d%3e%3f%40ABCDEFGHIJKLMNOPQRSTUVWXYZ%5b%5c%5d%5e_%60abcdefghijklmnopqrstuvwxyz%7b%7c%7d~%7f%80%81%82%83%84%85%86%87%88%89%8a%8b%8c%8d%8e%8f%90%91%92%93%94%95%96%97%98%99%9a%9b%9c%9d%9e%9f%a0%a1%a2%a3%a4%a5%a6%a7%a8%a9%aa%ab%ac%ad%ae%af%b0%b1%b2%b3%b4%b5%b6%b7%b8%b9%ba%bb%bc%bd%be%bf%c0%c1%c2%c3%c4%c5%c6%c7%c8%c9%ca%cb%cc%cd%ce%cf%d0%d1%d2%d3%d4%d5%d6%d7%d8%d9%da%db%dc%dd%de%df%e0%e1%e2%e3%e4%e5%e6%e7%e8%e9%ea%eb%ec%ed%ee%ef%f0%f1%f2%f3%f4%f5%f6%f7%f8%f9%fa%fb%fc%fd%fe%ff"
40
+ assert_equal 0, run_with_args([allchars_dec])
41
+ assert_equal allchars_enc, @stdout_io.string.chomp
42
+ end
43
+
44
+ end
@@ -0,0 +1,71 @@
1
+ require File.join(File.dirname(__FILE__), "test_cli_helper.rb")
2
+ require 'rbkb/cli/xor'
3
+
4
+ class TestCliXor < Test::Unit::TestCase
5
+ include CliTest
6
+
7
+ def setup
8
+ @cli_class = Rbkb::Cli::Xor
9
+ super()
10
+
11
+ @tst_dat = "my secrets are very secret"
12
+ @tst_key_str = "sneaky"
13
+ @tst_key_hex = "736e65616b79"
14
+ @tst_xored = "\036\027E\022\016\032\001\v\021\022K\030\001\vE\027\016\v\nN\026\004\b\v\026\032"
15
+ end
16
+
17
+ def test_string_arg_str_key
18
+ assert_equal 0, go_with_args(["-s", @tst_key_str, @tst_dat])
19
+ assert_equal @tst_xored, @stdout_io.string
20
+ end
21
+
22
+ def test_string_arg_str_key
23
+ assert_equal 0, go_with_args(["-x", @tst_key_hex, @tst_dat])
24
+ assert_equal @tst_xored, @stdout_io.string
25
+ end
26
+
27
+ def test_string_arg_xor_zeroes_out
28
+ assert_equal 0, go_with_args(%w(-s foo foo))
29
+ assert_equal "\x00"*3, @stdout_io.string
30
+ end
31
+
32
+ def test_string_arg_xor_zeroes_out_repeating
33
+ assert_equal 0, go_with_args(%w(-s A AAAAAAAAAA))
34
+ assert_equal "\x00"*10, @stdout_io.string
35
+ end
36
+
37
+ def test_string_arg_str_key_reverse
38
+ assert_equal 0, go_with_args(["-s", @tst_key_str, @tst_xored])
39
+ assert_equal @tst_dat, @stdout_io.string
40
+ end
41
+
42
+ def test_string_arg_str_key_reverse
43
+ assert_equal 0, go_with_args(["-x", @tst_key_hex, @tst_xored])
44
+ assert_equal @tst_dat, @stdout_io.string
45
+ end
46
+
47
+ def test_stdin
48
+ @stdin_io.write(@tst_dat) ; @stdin_io.rewind
49
+ assert_equal 0, go_with_args(["-s", @tst_key_str])
50
+ assert_equal @tst_xored, @stdout_io.string
51
+ end
52
+
53
+ def test_file_input
54
+ with_testfile do |fname, f|
55
+ f.write(@tst_dat); f.close
56
+ assert_equal 0, go_with_args(["-s", @tst_key_str, "-f", fname])
57
+ assert_equal @tst_xored, @stdout_io.string
58
+ end
59
+ end
60
+
61
+ def test_string_arg_no_key_error
62
+ assert_equal 1, go_with_args(%w(foo))
63
+ assert_match(/you must specify a key/i, @stderr_io.string)
64
+ end
65
+
66
+ def test_one_key_opt_error
67
+ assert_equal 1, go_with_args(%w(-x foo -s foo foo))
68
+ assert_match(/only one key option/i, @stderr_io.string)
69
+ end
70
+
71
+ end
@@ -0,0 +1,5 @@
1
+ require 'pp'
2
+ require 'stringio'
3
+ require 'test/unit'
4
+ $:.unshift File.dirname(__FILE__) + '/../lib'
5
+
data/test/test_http.rb ADDED
@@ -0,0 +1,27 @@
1
+ require File.dirname(__FILE__) + '/test_http_helper.rb'
2
+
3
+ class TestHttp < Test::Unit::TestCase
4
+ include Rbkb::Http
5
+
6
+ def test_names
7
+ assert_equal CommonInterface, Rbkb::Http::CommonInterface
8
+ assert_equal Base, Rbkb::Http::Base
9
+
10
+ assert_equal Response, Rbkb::Http::Response
11
+ assert_equal Request, Rbkb::Http::Request
12
+ assert_equal Parameters, Rbkb::Http::Parameters
13
+ assert_equal FormUrlencodedParams, Rbkb::Http::FormUrlencodedParams
14
+
15
+ assert_equal Headers, Rbkb::Http::Headers
16
+ assert_equal RequestHeaders, Rbkb::Http::RequestHeaders
17
+ assert_equal RequestAction, Rbkb::Http::RequestAction
18
+ assert_equal ResponseHeaders, Rbkb::Http::ResponseHeaders
19
+ assert_equal ResponseStatus, Rbkb::Http::ResponseStatus
20
+
21
+ assert_equal Body, Rbkb::Http::Body
22
+ assert_equal BoundBody, Rbkb::Http::BoundBody
23
+ assert_equal ChunkedBody, Rbkb::Http::ChunkedBody
24
+ end
25
+
26
+ end
27
+
@@ -0,0 +1,60 @@
1
+ require File.join(File.dirname(__FILE__), 'test_helper.rb')
2
+ require 'rbkb/http'
3
+
4
+ module HttpTestHelper
5
+ # contains various test cases to test common interface features
6
+ module CommonInterfaceTests
7
+
8
+ def setup()
9
+ raise "Helper stub called. Override setup() in TestCase"
10
+ end
11
+
12
+ def do_type_tests(x)
13
+ raise "Helper stub called. Override do_type_tests() in TestCase"
14
+ end
15
+
16
+ def do_type_tests(x)
17
+ raise "Helper stub called. Override do_capture_value_tests() in TestCase"
18
+ end
19
+
20
+ def test_init_parse
21
+ req = @obj_klass.new(@rawdat, @obj_opts)
22
+ do_capture_value_tests(req)
23
+ do_type_tests(req)
24
+ end
25
+
26
+ def test_parse
27
+ req = @obj_klass.parse(@rawdat, @obj_opts)
28
+ do_capture_value_tests(req)
29
+ do_type_tests(req)
30
+ end
31
+
32
+ def test_capture
33
+ req = @obj.capture(@rawdat)
34
+ do_capture_value_tests(req)
35
+ do_type_tests(req)
36
+ end
37
+
38
+ def test_back_to_raw
39
+ req = @obj.capture(@rawdat)
40
+ assert_equal @rawdat_crlf, req.to_raw
41
+ end
42
+
43
+ def test_capture_and_reuse_nondestructive
44
+ @obj.capture(@rawdat_crlf)
45
+ @obj.reset_capture
46
+ @obj.capture(@rawdat_crlf)
47
+ do_capture_value_tests(@obj)
48
+ do_type_tests(@obj)
49
+ end
50
+
51
+ def test_capture_and_reuse_destructive
52
+ @obj.capture(@rawdat_crlf)
53
+ @obj.reset_capture!
54
+ @obj.capture(@rawdat_crlf)
55
+ do_capture_value_tests(@obj)
56
+ do_type_tests(@obj)
57
+ end
58
+
59
+ end
60
+ end
@@ -0,0 +1,136 @@
1
+ require File.dirname(__FILE__) + '/test_http_helper.rb'
2
+
3
+ class TestHttpRequest < Test::Unit::TestCase
4
+ include HttpTestHelper::CommonInterfaceTests
5
+
6
+ include Rbkb::Http
7
+
8
+ def setup
9
+ @obj_klass = Request
10
+ @obj = @obj_klass.new
11
+
12
+ @rawdat =<<_EOF_
13
+ GET /csi?v=3&s=webhp&action=&tran=undefined HTTP/1.1
14
+ Host: www.google.com
15
+ User-Agent: Mozilla/5.0
16
+ Accept: image/png,image/*;q=0.8,*/*;q=0.5
17
+ Accept-Language: en-us,en;q=0.5
18
+ Accept-Encoding: gzip,deflate
19
+ Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7
20
+ Keep-Alive: 300
21
+ Proxy-Connection: keep-alive
22
+ Referer: http://www.google.com/
23
+ Cookie: PREFID=NNNN:LM=1237996892:S=YYYYY; NID=111
24
+
25
+ _EOF_
26
+
27
+ @hstr, @body = @rawdat.split(/^\n/, 2)
28
+ @rawdat_crlf = @hstr.gsub("\n", "\r\n") + "\r\n" + @body
29
+
30
+ @verb = "GET"
31
+ @uri = "/csi?v=3&s=webhp&action=&tran=undefined"
32
+ @path, @query = @uri.split('?',2)
33
+ @req_parameters = [
34
+ ["v", "3"],
35
+ ["s", "webhp"],
36
+ ["action", ""],
37
+ ["tran", "undefined"]
38
+ ]
39
+ @version = "HTTP/1.1"
40
+
41
+ @headers = [
42
+ ["Host", "www.google.com"],
43
+ ["User-Agent", "Mozilla/5.0"],
44
+ ["Accept", "image/png,image/*;q=0.8,*/*;q=0.5"],
45
+ ["Accept-Language", "en-us,en;q=0.5"],
46
+ ["Accept-Encoding", "gzip,deflate"],
47
+ ["Accept-Charset", "ISO-8859-1,utf-8;q=0.7,*;q=0.7"],
48
+ ["Keep-Alive", "300"],
49
+ ["Proxy-Connection", "keep-alive"],
50
+ ["Referer", "http://www.google.com/"],
51
+ ["Cookie", "PREFID=NNNN:LM=1237996892:S=YYYYY; NID=111"],
52
+ ]
53
+ end
54
+
55
+ def do_type_tests(req)
56
+ assert_kind_of Request, req
57
+ assert_kind_of Headers, req.headers
58
+ assert_kind_of Body, req.body
59
+ assert_kind_of RequestAction, req.action
60
+ assert_kind_of RequestHeaders, req.headers
61
+ end
62
+
63
+ def do_capture_value_tests(req)
64
+ assert_equal @headers, req.headers
65
+ assert_equal @body, req.body.to_s
66
+ assert_equal @uri, req.action.uri.to_s
67
+ assert_equal @path, req.action.uri.path
68
+ assert_equal @query, req.action.uri.query
69
+ assert_equal @verb, req.action.verb
70
+ assert_equal @version, req.action.version
71
+ assert_equal @req_parameters, req.request_parameters
72
+ end
73
+
74
+ def test_capture_crlf_headers
75
+ req = @obj.capture(@rawdat_crlf)
76
+ do_capture_value_tests(req)
77
+ do_type_tests(req)
78
+ assert_equal @rawdat_crlf, req.to_raw
79
+ end
80
+
81
+ def test_captured_body_type
82
+ @obj.capture(@rawdat)
83
+ assert_kind_of Body, @obj.body
84
+ end
85
+
86
+ end
87
+
88
+
89
+ class TestHttpPostRequest < TestHttpRequest
90
+
91
+ def setup
92
+ @obj_klass = Request
93
+ @obj = @obj_klass.new
94
+
95
+ @rawdat =<<_EOF_
96
+ POST /path/script.cgi?qtype=foo HTTP/1.0
97
+ From: frog@jmarshall.com
98
+ HasColon: this_has_a_colon:yikes
99
+ User-Agent: HTTPTool/1.0
100
+ Content-Type: application/x-www-form-urlencoded
101
+ Content-Length: 32
102
+
103
+ home=Cosby&favorite+flavor=flies
104
+ _EOF_
105
+ @rawdat.chomp!
106
+
107
+ @hstr, @body = @rawdat.split(/^\n/, 2)
108
+ @rawdat_crlf = @hstr.gsub("\n", "\r\n") + "\r\n" + @body
109
+
110
+ @verb = "POST"
111
+ @uri = "/path/script.cgi?qtype=foo"
112
+ @path, @query = @uri.split('?',2)
113
+ @req_parameters = [
114
+ ["qtype", "foo"],
115
+ ]
116
+ @version = "HTTP/1.0"
117
+
118
+ @headers = [
119
+ ["From", "frog@jmarshall.com"],
120
+ ["HasColon", "this_has_a_colon:yikes"],
121
+ ["User-Agent", "HTTPTool/1.0"],
122
+ ["Content-Type", "application/x-www-form-urlencoded"],
123
+ ["Content-Length", "32"],
124
+ ]
125
+
126
+ @post_parameters = [["home", "Cosby"], ["favorite+flavor", "flies"]]
127
+ end
128
+
129
+ def test_captured_body_type
130
+ @obj.capture(@rawdat)
131
+ assert_kind_of BoundBody, @obj.body
132
+ end
133
+
134
+
135
+ end
136
+