xmlrpc 0.3.0 → 0.3.2

Sign up to get free protection for your applications and to get access to all the features.
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: beb82c31668a9eac6cc5fec044fd06335c42126ce3d4f1f6defda2c987b42ac7
4
+ data.tar.gz: 216663d8c70e048ad6522be02c15e737da9bb4f29ffb268cd65fd8e270d52f15
5
5
  SHA512:
6
- metadata.gz: 104b7bc31e9dc7c700ea986e4e1b9ff76988f376d5ba00c98b17c542c036991ddc8af2110712f4635d75cc9f20ff9550ade7be94c32a2163838115e4cb5a90a6
7
- data.tar.gz: ce6dc27e9a22fb3b3c185ca1415ea5dd92c8bacf8447f4a52ce0d81cf8a04dec066ec6591f4095b58824e78879e130920e05732b695da0888e8b2277ab849a3c
6
+ metadata.gz: f2bc2b1c23323a22e37b5cde407ce06440f16d7b4a7ad733aa996616f04524de93e56b4e4deb37a1bf8a7793234011f4bf88141e4146c1aa5940ffb851de272f
7
+ data.tar.gz: 151dc29ed010ce4610c20d6673dea4ce939fdea3bcf287e7eebf728959768c868afe45a0fa8b0c4393754845efe14d0cf7e86b2c1ce046225aee1c8ca123860e
@@ -0,0 +1,36 @@
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
+ - "3.0"
24
+ - head
25
+ include:
26
+ - { os: windows , ruby: mingw }
27
+ - { os: windows , ruby: mswin }
28
+ exclude:
29
+ - { os: windows , ruby: head }
30
+ steps:
31
+ - uses: actions/checkout@v2
32
+ - uses: ruby/setup-ruby@v1
33
+ with:
34
+ ruby-version: ${{ matrix.ruby }}
35
+ - run: bundle install
36
+ - run: rake
data/NEWS.md ADDED
@@ -0,0 +1,39 @@
1
+ # News
2
+
3
+ ## 0.3.2
4
+
5
+ ### Improvements
6
+
7
+ * Added support for Ruby 3.0.
8
+ [GitHub#27][Reported by Herwin Weststrate]
9
+
10
+ ### Thanks
11
+
12
+ * Herwin Weststrate
13
+
14
+ ## 0.3.1
15
+
16
+ ### Improvements
17
+
18
+ * Added support for comparing `XMLRPC::Base64`.
19
+ [GitHub#14][Patch by Herwin Weststrate]
20
+
21
+ * Added support for `application/xml` as `Content-Type`.
22
+ [GitHub#24][Reported by Reiermeyer]
23
+
24
+ * Added `XMLRPC::Server#port`.
25
+ [GitHub#17][Reported by Harald Sitter]
26
+ [GitHub#18][Patch by Herwin Weststrate]
27
+
28
+ ### Fixes
29
+
30
+ * Fixed a bug that unexpected exception is raised on no data.
31
+ [GitHub#25][Patch by Herwin Weststrate]
32
+
33
+ ### Thanks
34
+
35
+ * Herwin Weststrate
36
+
37
+ * Reiermeyer
38
+
39
+ * Harald Sitter
data/lib/xmlrpc.rb CHANGED
@@ -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.2"
293
293
  end
data/lib/xmlrpc/base64.rb CHANGED
@@ -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)
data/lib/xmlrpc/client.rb CHANGED
@@ -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
 
data/lib/xmlrpc/create.rb CHANGED
@@ -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",
data/lib/xmlrpc/server.rb CHANGED
@@ -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
 
data/xmlrpc.gemspec CHANGED
@@ -6,13 +6,13 @@ require 'xmlrpc'
6
6
  Gem::Specification.new do |spec|
7
7
  spec.name = "xmlrpc"
8
8
  spec.version = XMLRPC::VERSION
9
- spec.authors = ["SHIBATA Hiroshi"]
10
- spec.email = ["hsbt@ruby-lang.org"]
9
+ spec.authors = ["SHIBATA Hiroshi", "Sutou Kouhei"]
10
+ spec.email = ["hsbt@ruby-lang.org", "kou@cozmixng.org"]
11
11
 
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"
@@ -20,6 +20,8 @@ Gem::Specification.new do |spec|
20
20
  spec.require_paths = ["lib"]
21
21
  spec.required_ruby_version = ">= 2.3"
22
22
 
23
+ spec.add_dependency "webrick"
24
+
23
25
  spec.add_development_dependency "bundler"
24
26
  spec.add_development_dependency "rake"
25
27
  spec.add_development_dependency "test-unit"
metadata CHANGED
@@ -1,15 +1,30 @@
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.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - SHIBATA Hiroshi
8
+ - Sutou Kouhei
8
9
  autorequire:
9
10
  bindir: exe
10
11
  cert_chain: []
11
- date: 2017-02-16 00:00:00.000000000 Z
12
+ date: 2021-02-04 00:00:00.000000000 Z
12
13
  dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: webrick
16
+ requirement: !ruby/object:Gem::Requirement
17
+ requirements:
18
+ - - ">="
19
+ - !ruby/object:Gem::Version
20
+ version: '0'
21
+ type: :runtime
22
+ prerelease: false
23
+ version_requirements: !ruby/object:Gem::Requirement
24
+ requirements:
25
+ - - ">="
26
+ - !ruby/object:Gem::Version
27
+ version: '0'
13
28
  - !ruby/object:Gem::Dependency
14
29
  name: bundler
15
30
  requirement: !ruby/object:Gem::Requirement
@@ -56,14 +71,16 @@ description: XMLRPC is a lightweight protocol that enables remote procedure call
56
71
  over HTTP.
57
72
  email:
58
73
  - hsbt@ruby-lang.org
74
+ - kou@cozmixng.org
59
75
  executables: []
60
76
  extensions: []
61
77
  extra_rdoc_files: []
62
78
  files:
79
+ - ".github/workflows/test.yml"
63
80
  - ".gitignore"
64
- - ".travis.yml"
65
81
  - Gemfile
66
82
  - LICENSE.txt
83
+ - NEWS.md
67
84
  - README.md
68
85
  - Rakefile
69
86
  - bin/console
@@ -82,6 +99,7 @@ files:
82
99
  homepage: https://github.com/ruby/xmlrpc
83
100
  licenses:
84
101
  - Ruby
102
+ - BSD-2-Clause
85
103
  metadata: {}
86
104
  post_install_message:
87
105
  rdoc_options: []
@@ -98,8 +116,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
98
116
  - !ruby/object:Gem::Version
99
117
  version: '0'
100
118
  requirements: []
101
- rubyforge_project:
102
- rubygems_version: 2.6.10
119
+ rubygems_version: 3.3.0.dev
103
120
  signing_key:
104
121
  specification_version: 4
105
122
  summary: XMLRPC is a lightweight protocol that enables remote procedure calls over
data/.travis.yml DELETED
@@ -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