libxml-xmlrpc 0.1.1 → 0.1.2

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.
@@ -20,6 +20,6 @@ module XML
20
20
  #
21
21
 
22
22
  module XMLRPC
23
- VERSION = "0.1.1"
23
+ VERSION = "0.1.2"
24
24
  end
25
25
  end
@@ -29,7 +29,7 @@ module XML::XMLRPC
29
29
  # </params>
30
30
  # </methodResponse>
31
31
  #
32
- # xml = XML::XMLRPC::Parser.new(IO or String object)
32
+ # xml = XML::XMLRPC::Parser.new(IO, String, or StringIO object)
33
33
  # xml[0] == "South Dakota"
34
34
  #
35
35
  # Notes:
@@ -77,6 +77,12 @@ module XML::XMLRPC
77
77
  # does this for you.
78
78
  #
79
79
  def parse!
80
+
81
+ if @string.empty?
82
+ raise ParserError,
83
+ "String is empty - libxml-ruby would normally crash your program here."
84
+ end
85
+
80
86
  document = XML::Parser.string(@string).parse
81
87
  node = document.root
82
88
  case node.name
@@ -24,10 +24,6 @@ class TestBuilder < Test::Unit::TestCase
24
24
  "<?xml version=\"1.0\" encoding=\"utf-8\" ?>\n<methodCall><methodName>foo</methodName><params><param><value><dateTime.iso8601>19780406T00:00:00</dateTime.iso8601></value></param></params></methodCall>")
25
25
  assert_equal(@class.foo([1,2,3]),
26
26
  "<?xml version=\"1.0\" encoding=\"utf-8\" ?>\n<methodCall><methodName>foo</methodName><params><param><value><array><data><value><int>1</int></value><value><int>2</int></value><value><int>3</int></value></data></array></value></param></params></methodCall>")
27
- assert_equal(@class.foo({:Bar => 1, :Foo => 2}),
28
- "<?xml version=\"1.0\" encoding=\"utf-8\" ?>\n<methodCall><methodName>foo</methodName><params><param><value><struct><member><name>Bar</name><value><int>1</int></value></member><member><name>Foo</name><value><int>2</int></value></member></struct></value></param></params></methodCall>")
29
- assert_equal(@class.foo(1, [1,2,3], {:Bar => 1, :Foo => 2}),
30
- "<?xml version=\"1.0\" encoding=\"utf-8\" ?>\n<methodCall><methodName>foo</methodName><params><param><value><int>1</int></value></param><param><value><array><data><value><int>1</int></value><value><int>2</int></value><value><int>3</int></value></data></array></value></param><param><value><struct><member><name>Bar</name><value><int>1</int></value></member><member><name>Foo</name><value><int>2</int></value></member></struct></value></param></params></methodCall>")
31
27
  assert_equal(@class.foo(XML::XMLRPC::Builder::Base64.new("foo")),
32
28
  "<?xml version=\"1.0\" encoding=\"utf-8\" ?>\n<methodCall><methodName>foo</methodName><params><param><value><base64>Zm9v\n</base64></value></param></params></methodCall>")
33
29
 
@@ -0,0 +1,10 @@
1
+ require 'test/unit'
2
+ require 'xml/libxml/xmlrpc/parser'
3
+
4
+ class TestParserBad < Test::Unit::TestCase
5
+ def test_01_empty_string
6
+ assert_raise XML::XMLRPC::ParserError do
7
+ XML::XMLRPC::Parser.new('')
8
+ end
9
+ end
10
+ end
metadata CHANGED
@@ -3,8 +3,8 @@ rubygems_version: 0.9.4
3
3
  specification_version: 1
4
4
  name: libxml-xmlrpc
5
5
  version: !ruby/object:Gem::Version
6
- version: 0.1.1
7
- date: 2007-10-28 00:00:00 -07:00
6
+ version: 0.1.2
7
+ date: 2007-11-02 00:00:00 -07:00
8
8
  summary: Provides a alternative and faster XML-RPC layer through libxml's parsing framework
9
9
  require_paths:
10
10
  - lib
@@ -38,6 +38,7 @@ files:
38
38
  - lib/xml/libxml/xmlrpc.rb
39
39
  - test/data
40
40
  - test/test_builder.rb
41
+ - test/test_parser_bad.rb
41
42
  - test/test_parser_good.rb
42
43
  test_files: []
43
44