xmlrpc 0.1.0 → 0.3.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/.github/workflows/test.yml +35 -0
- data/NEWS.md +28 -0
- data/README.md +2 -0
- data/lib/xmlrpc.rb +1 -1
- data/lib/xmlrpc/base64.rb +6 -0
- data/lib/xmlrpc/client.rb +16 -6
- data/lib/xmlrpc/create.rb +8 -9
- data/lib/xmlrpc/datetime.rb +7 -13
- data/lib/xmlrpc/server.rb +5 -0
- data/xmlrpc.gemspec +2 -2
- metadata +7 -6
- data/.travis.yml +0 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: '033781b41a00cd9ae6a6a5f82fe72f89a94cdfe724c38721c593fa28ee4002c6'
|
4
|
+
data.tar.gz: a6bc844abbc8e8829ebf1c6ca5884f176cbf1caf8d94b1530a2b0b6e60c3ebd7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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
|
data/README.md
CHANGED
data/lib/xmlrpc.rb
CHANGED
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
@@ -237,7 +237,7 @@ module XMLRPC # :nodoc:
|
|
237
237
|
# Each parameter of +args+ must be of one of the following types,
|
238
238
|
# where Hash, Struct and Array can contain any of these listed _types_:
|
239
239
|
#
|
240
|
-
# *
|
240
|
+
# * Integer
|
241
241
|
# * TrueClass, FalseClass, +true+, +false+
|
242
242
|
# * String, Symbol
|
243
243
|
# * Float
|
@@ -255,7 +255,7 @@ module XMLRPC # :nodoc:
|
|
255
255
|
#
|
256
256
|
# The type of the return-value is one of the types shown above.
|
257
257
|
#
|
258
|
-
#
|
258
|
+
# An Integer is only allowed when it fits in 32-bit. A XML-RPC
|
259
259
|
# +dateTime.iso8601+ type is always returned as a XMLRPC::DateTime object.
|
260
260
|
# Struct is never returned, only a Hash, the same for a Symbol, where as a
|
261
261
|
# String is always returned. XMLRPC::Base64 is returned as a String from
|
@@ -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
|
-
|
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 "
|
523
|
+
raise "#{message}:\n#{data}"
|
518
524
|
else
|
519
|
-
raise
|
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.
|
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
|
-
|
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
|
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
|
61
|
+
class XMLParser
|
62
|
+
include Element
|
61
63
|
|
62
64
|
def initialize
|
63
65
|
require "xmltreebuilder"
|
@@ -176,15 +178,15 @@ module XMLRPC # :nodoc:
|
|
176
178
|
def conv2value(param) # :doc:
|
177
179
|
|
178
180
|
val = case param
|
179
|
-
when
|
180
|
-
# XML-RPC's int is 32bit int
|
181
|
+
when Integer
|
182
|
+
# XML-RPC's int is 32bit int
|
181
183
|
if Config::ENABLE_BIGINT
|
182
184
|
@writer.tag("i4", param.to_s)
|
183
185
|
else
|
184
186
|
if param >= -(2**31) and param <= (2**31-1)
|
185
187
|
@writer.tag("i4", param.to_s)
|
186
188
|
else
|
187
|
-
raise "
|
189
|
+
raise "Integer is too big! Must be signed 32-bit integer!"
|
188
190
|
end
|
189
191
|
end
|
190
192
|
when TrueClass, FalseClass
|
@@ -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/datetime.rb
CHANGED
@@ -24,7 +24,7 @@ class DateTime
|
|
24
24
|
#
|
25
25
|
# Raises ArgumentError if the given +value+ is out of range, or in the case
|
26
26
|
# of XMLRPC::DateTime#year= if +value+ is not of type Integer.
|
27
|
-
def year=
|
27
|
+
def year=(value)
|
28
28
|
raise ArgumentError, "date/time out of range" unless value.is_a? Integer
|
29
29
|
@year = value
|
30
30
|
end
|
@@ -32,7 +32,7 @@ class DateTime
|
|
32
32
|
# Set +value+ as the new date/time component.
|
33
33
|
#
|
34
34
|
# Raises an ArgumentError if the given +value+ isn't between 1 and 12.
|
35
|
-
def month=
|
35
|
+
def month=(value)
|
36
36
|
raise ArgumentError, "date/time out of range" unless (1..12).include? value
|
37
37
|
@month = value
|
38
38
|
end
|
@@ -40,7 +40,7 @@ class DateTime
|
|
40
40
|
# Set +value+ as the new date/time component.
|
41
41
|
#
|
42
42
|
# Raises an ArgumentError if the given +value+ isn't between 1 and 31.
|
43
|
-
def day=
|
43
|
+
def day=(value)
|
44
44
|
raise ArgumentError, "date/time out of range" unless (1..31).include? value
|
45
45
|
@day = value
|
46
46
|
end
|
@@ -48,7 +48,7 @@ class DateTime
|
|
48
48
|
# Set +value+ as the new date/time component.
|
49
49
|
#
|
50
50
|
# Raises an ArgumentError if the given +value+ isn't between 0 and 24.
|
51
|
-
def hour=
|
51
|
+
def hour=(value)
|
52
52
|
raise ArgumentError, "date/time out of range" unless (0..24).include? value
|
53
53
|
@hour = value
|
54
54
|
end
|
@@ -56,7 +56,7 @@ class DateTime
|
|
56
56
|
# Set +value+ as the new date/time component.
|
57
57
|
#
|
58
58
|
# Raises an ArgumentError if the given +value+ isn't between 0 and 59.
|
59
|
-
def min=
|
59
|
+
def min=(value)
|
60
60
|
raise ArgumentError, "date/time out of range" unless (0..59).include? value
|
61
61
|
@min = value
|
62
62
|
end
|
@@ -64,7 +64,7 @@ class DateTime
|
|
64
64
|
# Set +value+ as the new date/time component.
|
65
65
|
#
|
66
66
|
# Raises an ArgumentError if the given +value+ isn't between 0 and 59.
|
67
|
-
def sec=
|
67
|
+
def sec=(value)
|
68
68
|
raise ArgumentError, "date/time out of range" unless (0..59).include? value
|
69
69
|
@sec = value
|
70
70
|
end
|
@@ -87,16 +87,10 @@ class DateTime
|
|
87
87
|
end
|
88
88
|
|
89
89
|
# Return a Time object of the date/time which represents +self+.
|
90
|
-
# If the <code>@year</code> is below 1970, this method returns +nil+,
|
91
|
-
# because Time cannot handle years below 1970.
|
92
90
|
#
|
93
91
|
# The timezone used is GMT.
|
94
92
|
def to_time
|
95
|
-
|
96
|
-
Time.gm(*to_a)
|
97
|
-
else
|
98
|
-
nil
|
99
|
-
end
|
93
|
+
Time.gm(*to_a)
|
100
94
|
end
|
101
95
|
|
102
96
|
# Return a Date object of the date which represents +self+.
|
data/lib/xmlrpc/server.rb
CHANGED
data/xmlrpc.gemspec
CHANGED
@@ -12,13 +12,13 @@ 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.
|
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"
|
19
19
|
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
20
20
|
spec.require_paths = ["lib"]
|
21
|
-
spec.required_ruby_version = ">= 2.
|
21
|
+
spec.required_ruby_version = ">= 2.3"
|
22
22
|
|
23
23
|
spec.add_development_dependency "bundler"
|
24
24
|
spec.add_development_dependency "rake"
|
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.1
|
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:
|
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: []
|
@@ -91,15 +93,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
91
93
|
requirements:
|
92
94
|
- - ">="
|
93
95
|
- !ruby/object:Gem::Version
|
94
|
-
version: 2.
|
96
|
+
version: '2.3'
|
95
97
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
96
98
|
requirements:
|
97
99
|
- - ">="
|
98
100
|
- !ruby/object:Gem::Version
|
99
101
|
version: '0'
|
100
102
|
requirements: []
|
101
|
-
|
102
|
-
rubygems_version: 2.6.4
|
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
|
data/.travis.yml
DELETED