xmlrpc 0.3.0 → 0.3.1

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: b25bc2795f9797698050df21c2edb45762495b2b
4
- data.tar.gz: b365ee841e1778e048c3d8487634450e4966f332
2
+ SHA256:
3
+ metadata.gz: '033781b41a00cd9ae6a6a5f82fe72f89a94cdfe724c38721c593fa28ee4002c6'
4
+ data.tar.gz: a6bc844abbc8e8829ebf1c6ca5884f176cbf1caf8d94b1530a2b0b6e60c3ebd7
5
5
  SHA512:
6
- metadata.gz: 104b7bc31e9dc7c700ea986e4e1b9ff76988f376d5ba00c98b17c542c036991ddc8af2110712f4635d75cc9f20ff9550ade7be94c32a2163838115e4cb5a90a6
7
- data.tar.gz: ce6dc27e9a22fb3b3c185ca1415ea5dd92c8bacf8447f4a52ce0d81cf8a04dec066ec6591f4095b58824e78879e130920e05732b695da0888e8b2277ab849a3c
6
+ metadata.gz: 0a1ebb33a2e8e9dbf8aabbdbf622f181687582d991acdd258db31a2430162f592393520b8cd73a7340b6bd8cac15bad731c6e7abc2beeffdaff32d4c59bbf72b
7
+ data.tar.gz: cfbff48a3ddf0af2ac256f1dd4596570d86cd65e10b4bef97b785fb4bf27074597e411749a9b919c6f72b9eb8cb2489f1c22368bcaa7dbcf9b99486f6b8693c2
@@ -0,0 +1,35 @@
1
+ name: Test
2
+
3
+ on:
4
+ - push
5
+ - pull_request
6
+
7
+ jobs:
8
+ test:
9
+ name: >-
10
+ ${{ matrix.os }} ${{ matrix.ruby }}
11
+ runs-on: ${{ matrix.os }}-latest
12
+ strategy:
13
+ fail-fast: false
14
+ matrix:
15
+ os:
16
+ - ubuntu
17
+ - macos
18
+ - windows
19
+ ruby:
20
+ - 2.5
21
+ - 2.6
22
+ - 2.7
23
+ - head
24
+ include:
25
+ - { os: windows , ruby: mingw }
26
+ - { os: windows , ruby: mswin }
27
+ exclude:
28
+ - { os: windows , ruby: head }
29
+ steps:
30
+ - uses: actions/checkout@v2
31
+ - uses: ruby/setup-ruby@v1
32
+ with:
33
+ ruby-version: ${{ matrix.ruby }}
34
+ - run: bundle install
35
+ - run: rake
data/NEWS.md ADDED
@@ -0,0 +1,28 @@
1
+ # News
2
+
3
+ ## 0.3.1
4
+
5
+ ### Improvements
6
+
7
+ * Added support for comparing `XMLRPC::Base64`.
8
+ [GitHub#14][Patch by Herwin Weststrate]
9
+
10
+ * Added support for `application/xml` as `Content-Type`.
11
+ [GitHub#24][Reported by Reiermeyer]
12
+
13
+ * Added `XMLRPC::Server#port`.
14
+ [GitHub#17][Reported by Harald Sitter]
15
+ [GitHub#18][Patch by Herwin Weststrate]
16
+
17
+ ### Fixes
18
+
19
+ * Fixed a bug that unexpected exception is raised on no data.
20
+ [GitHub#25][Patch by Herwin Weststrate]
21
+
22
+ ### Thanks
23
+
24
+ * Herwin Weststrate
25
+
26
+ * Reiermeyer
27
+
28
+ * Harald Sitter
@@ -289,5 +289,5 @@
289
289
  #
290
290
  # You can change the XML-writer by calling method ParserWriterChooseMixin#set_writer.
291
291
  module XMLRPC
292
- VERSION = "0.3.0"
292
+ VERSION = "0.3.1"
293
293
  end
@@ -13,6 +13,7 @@ module XMLRPC # :nodoc:
13
13
  # You can use XMLRPC::Base64 on the client and server-side as a
14
14
  # parameter and/or return-value.
15
15
  class Base64
16
+ include Comparable
16
17
 
17
18
  # Creates a new XMLRPC::Base64 instance with string +str+ as the
18
19
  # internal string. When +state+ is +:dec+ it assumes that the
@@ -40,6 +41,11 @@ class Base64
40
41
  Base64.encode(@str)
41
42
  end
42
43
 
44
+ # Compare two base64 values, based on decoded string
45
+ def <=>(other)
46
+ return nil unless other.is_a?(self.class)
47
+ decoded <=> other.decoded
48
+ end
43
49
 
44
50
  # Decodes string +str+ with base64 and returns that value.
45
51
  def Base64.decode(str)
@@ -512,16 +512,26 @@ module XMLRPC # :nodoc:
512
512
  # assume text/xml on instances where Content-Type header is not set
513
513
  ct_expected = resp["Content-Type"] || 'text/xml'
514
514
  ct = parse_content_type(ct_expected).first
515
- if ct != "text/xml"
515
+ case ct
516
+ when "text/xml", "application/xml"
517
+ # OK
518
+ else
519
+ message =
520
+ "Wrong content-type " +
521
+ "(received '#{ct}' but expected 'text/xml' or 'application/xml')"
516
522
  if ct == "text/html"
517
- raise "Wrong content-type (received '#{ct}' but expected 'text/xml'): \n#{data}"
523
+ raise "#{message}:\n#{data}"
518
524
  else
519
- raise "Wrong content-type (received '#{ct}' but expected 'text/xml')"
525
+ raise message
520
526
  end
521
527
  end
522
528
 
529
+ if data.nil?
530
+ raise "No data"
531
+ end
532
+
523
533
  expected = resp["Content-Length"] || "<unknown>"
524
- if data.nil? or data.bytesize == 0
534
+ if data.bytesize == 0
525
535
  raise "Wrong size. Was #{data.bytesize}, should be #{expected}"
526
536
  end
527
537
 
@@ -12,7 +12,7 @@ module XMLRPC # :nodoc:
12
12
 
13
13
  module XMLWriter
14
14
 
15
- class Abstract
15
+ module Element
16
16
  def ele(name, *children)
17
17
  element(name, nil, *children)
18
18
  end
@@ -23,7 +23,8 @@ module XMLRPC # :nodoc:
23
23
  end
24
24
 
25
25
 
26
- class Simple < Abstract
26
+ class Simple
27
+ include Element
27
28
 
28
29
  def document_to_str(doc)
29
30
  doc
@@ -57,7 +58,8 @@ module XMLRPC # :nodoc:
57
58
  end # class Simple
58
59
 
59
60
 
60
- class XMLParser < Abstract
61
+ class XMLParser
62
+ include Element
61
63
 
62
64
  def initialize
63
65
  require "xmltreebuilder"
@@ -219,8 +221,6 @@ module XMLRPC # :nodoc:
219
221
  @writer.ele("struct", *h)
220
222
 
221
223
  when Hash
222
- # TODO: can a Hash be empty?
223
-
224
224
  h = param.collect do |key, value|
225
225
  @writer.ele("member",
226
226
  @writer.tag("name", key.to_s),
@@ -231,7 +231,6 @@ module XMLRPC # :nodoc:
231
231
  @writer.ele("struct", *h)
232
232
 
233
233
  when Array
234
- # TODO: can an Array be empty?
235
234
  a = param.collect {|v| conv2value(v) }
236
235
 
237
236
  @writer.ele("array",
@@ -594,6 +594,11 @@ class Server < WEBrickServlet
594
594
  @server.shutdown
595
595
  end
596
596
 
597
+ # Get the port of the server, useful when started with port=0
598
+ def port
599
+ @server.config[:Port]
600
+ end
601
+
597
602
  end
598
603
 
599
604
 
@@ -12,7 +12,7 @@ Gem::Specification.new do |spec|
12
12
  spec.summary = %q{XMLRPC is a lightweight protocol that enables remote procedure calls over HTTP.}
13
13
  spec.description = %q{XMLRPC is a lightweight protocol that enables remote procedure calls over HTTP.}
14
14
  spec.homepage = "https://github.com/ruby/xmlrpc"
15
- spec.license = "Ruby"
15
+ spec.licenses = ["Ruby", "BSD-2-Clause"]
16
16
 
17
17
  spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
18
18
  spec.bindir = "exe"
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: xmlrpc
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0
4
+ version: 0.3.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - SHIBATA Hiroshi
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2017-02-16 00:00:00.000000000 Z
11
+ date: 2020-11-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -60,10 +60,11 @@ executables: []
60
60
  extensions: []
61
61
  extra_rdoc_files: []
62
62
  files:
63
+ - ".github/workflows/test.yml"
63
64
  - ".gitignore"
64
- - ".travis.yml"
65
65
  - Gemfile
66
66
  - LICENSE.txt
67
+ - NEWS.md
67
68
  - README.md
68
69
  - Rakefile
69
70
  - bin/console
@@ -82,6 +83,7 @@ files:
82
83
  homepage: https://github.com/ruby/xmlrpc
83
84
  licenses:
84
85
  - Ruby
86
+ - BSD-2-Clause
85
87
  metadata: {}
86
88
  post_install_message:
87
89
  rdoc_options: []
@@ -98,8 +100,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
98
100
  - !ruby/object:Gem::Version
99
101
  version: '0'
100
102
  requirements: []
101
- rubyforge_project:
102
- rubygems_version: 2.6.10
103
+ rubygems_version: 3.2.0.rc.2
103
104
  signing_key:
104
105
  specification_version: 4
105
106
  summary: XMLRPC is a lightweight protocol that enables remote procedure calls over
@@ -1,6 +0,0 @@
1
- language: ruby
2
- rvm:
3
- - 2.3.3
4
- - 2.4.0
5
- - ruby-head
6
- before_install: gem update bundler