xmlrpc 0.3.2 → 0.3.4
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 +4 -4
- data/.github/dependabot.yml +6 -0
- data/.github/workflows/release.yml +48 -0
- data/.github/workflows/test.yml +8 -4
- data/Gemfile +10 -0
- data/NEWS.md +46 -0
- data/README.md +1 -1
- data/Rakefile +10 -0
- data/lib/xmlrpc/client.rb +3 -3
- data/lib/xmlrpc/config.rb +22 -0
- data/lib/xmlrpc/create.rb +5 -5
- data/lib/xmlrpc/parser.rb +54 -9
- data/lib/xmlrpc/server.rb +14 -47
- data/lib/xmlrpc/utils.rb +6 -6
- data/lib/xmlrpc.rb +10 -7
- data/xmlrpc.gemspec +1 -6
- metadata +9 -38
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 2f2d8a8c29a5fc8c55bffcb7b56ff6dd3cd4331ba88cd9f6c30da98948296bef
|
|
4
|
+
data.tar.gz: d9480efd703fa30069f31c9c20c29067e560755e704268c2c5d44392a1b8014e
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 939cfd7ea5138f44b25e848bce42d8960cb334d0b3e919b80fa362c37f31457ff76e7525c6744ffca36fd30b69f417329230208cf6e07858a05b9f0b086578ce
|
|
7
|
+
data.tar.gz: 51e4c74654eba96955e151e97cbab7409097f89740de65fdab099673e0da8f4b2d5035af212b939bf2ce983b0964aa69672125bd787291a39a9d63f0ac4ec606
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
name: Release
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
tags:
|
|
6
|
+
- "*"
|
|
7
|
+
|
|
8
|
+
jobs:
|
|
9
|
+
github:
|
|
10
|
+
name: GitHub
|
|
11
|
+
runs-on: ubuntu-latest
|
|
12
|
+
timeout-minutes: 10
|
|
13
|
+
steps:
|
|
14
|
+
- uses: actions/checkout@v6
|
|
15
|
+
- name: Extract release note
|
|
16
|
+
run: |
|
|
17
|
+
ruby \
|
|
18
|
+
-e 'print("## xmlrpc "); \
|
|
19
|
+
puts(ARGF.read.split(/^## /)[1])' \
|
|
20
|
+
NEWS.md > release-note.md
|
|
21
|
+
- name: Upload to release
|
|
22
|
+
run: |
|
|
23
|
+
title=$(head -n1 release-note.md | sed -e 's/^## //')
|
|
24
|
+
tail -n +2 release-note.md > release-note-without-version.md
|
|
25
|
+
gh release create ${GITHUB_REF_NAME} \
|
|
26
|
+
--discussion-category Announcements \
|
|
27
|
+
--notes-file release-note-without-version.md \
|
|
28
|
+
--title "${title}"
|
|
29
|
+
env:
|
|
30
|
+
GH_TOKEN: ${{ github.token }}
|
|
31
|
+
|
|
32
|
+
rubygems:
|
|
33
|
+
name: RubyGems
|
|
34
|
+
runs-on: ubuntu-latest
|
|
35
|
+
timeout-minutes: 10
|
|
36
|
+
permissions:
|
|
37
|
+
id-token: write
|
|
38
|
+
environment: release
|
|
39
|
+
steps:
|
|
40
|
+
- uses: actions/checkout@v6
|
|
41
|
+
- uses: ruby/setup-ruby@v1
|
|
42
|
+
with:
|
|
43
|
+
ruby-version: ruby
|
|
44
|
+
bundler-cache: true
|
|
45
|
+
- uses: rubygems/configure-rubygems-credentials@v1.0.0
|
|
46
|
+
- name: Push gems
|
|
47
|
+
run: |
|
|
48
|
+
bundle exec rake release:rubygem_push
|
data/.github/workflows/test.yml
CHANGED
|
@@ -17,10 +17,14 @@ jobs:
|
|
|
17
17
|
- macos
|
|
18
18
|
- windows
|
|
19
19
|
ruby:
|
|
20
|
-
- "2.5"
|
|
21
20
|
- "2.6"
|
|
22
21
|
- "2.7"
|
|
23
22
|
- "3.0"
|
|
23
|
+
- "3.1"
|
|
24
|
+
- "3.2"
|
|
25
|
+
- "3.3"
|
|
26
|
+
- "3.4"
|
|
27
|
+
- "4.0"
|
|
24
28
|
- head
|
|
25
29
|
include:
|
|
26
30
|
- { os: windows , ruby: mingw }
|
|
@@ -28,9 +32,9 @@ jobs:
|
|
|
28
32
|
exclude:
|
|
29
33
|
- { os: windows , ruby: head }
|
|
30
34
|
steps:
|
|
31
|
-
- uses: actions/checkout@
|
|
35
|
+
- uses: actions/checkout@v6
|
|
32
36
|
- uses: ruby/setup-ruby@v1
|
|
33
37
|
with:
|
|
34
38
|
ruby-version: ${{ matrix.ruby }}
|
|
35
|
-
|
|
36
|
-
- run: rake
|
|
39
|
+
bundler-cache: true # 'bundle install' and cache gems
|
|
40
|
+
- run: bundle exec rake
|
data/Gemfile
CHANGED
data/NEWS.md
CHANGED
|
@@ -1,5 +1,51 @@
|
|
|
1
1
|
# News
|
|
2
2
|
|
|
3
|
+
## 0.3.4
|
|
4
|
+
|
|
5
|
+
### Improvements
|
|
6
|
+
|
|
7
|
+
* GH-40: Added accessor methods to `XMLRPC::Config`.
|
|
8
|
+
* Patch by Herwin Weststrate
|
|
9
|
+
|
|
10
|
+
* Added REXML dependency.
|
|
11
|
+
* Patch by Herwin Weststrate
|
|
12
|
+
|
|
13
|
+
* GH-55: Added support for Nokogiri.
|
|
14
|
+
* Patch by Herwin Weststrate
|
|
15
|
+
|
|
16
|
+
* GH-56: Added support for Rack.
|
|
17
|
+
* Patch by Herwin Weststrate
|
|
18
|
+
|
|
19
|
+
* GH-59: Dropped support for mod_ruby.
|
|
20
|
+
* Patch by Herwin Weststrate
|
|
21
|
+
|
|
22
|
+
* GH-63: Added support for libxml_ruby 6.0.0 or later.
|
|
23
|
+
* Patch by Herwin Weststrate
|
|
24
|
+
|
|
25
|
+
### Fixes
|
|
26
|
+
|
|
27
|
+
* GH-42 GH-43: Fixed a bug that IPv6 address host isn't used.
|
|
28
|
+
* Patch by Herwin Weststrate
|
|
29
|
+
|
|
30
|
+
### Thanks
|
|
31
|
+
|
|
32
|
+
* Herwin Weststrate
|
|
33
|
+
|
|
34
|
+
## 0.3.3
|
|
35
|
+
|
|
36
|
+
### Improvements
|
|
37
|
+
|
|
38
|
+
* GH-36: Stopped to unmarshal all classes. Classes that include
|
|
39
|
+
`XMLRPC::Marshallable` are only allowed.
|
|
40
|
+
|
|
41
|
+
[Patch by ooooooo-q]
|
|
42
|
+
[Found by ooooooo-q and plenumlab separately]
|
|
43
|
+
|
|
44
|
+
### Thanks
|
|
45
|
+
|
|
46
|
+
* ooooooo-q
|
|
47
|
+
* plenumlab
|
|
48
|
+
|
|
3
49
|
## 0.3.2
|
|
4
50
|
|
|
5
51
|
### Improvements
|
data/README.md
CHANGED
|
@@ -39,7 +39,7 @@ Try the following code. It calls a standard demonstration remote procedure.
|
|
|
39
39
|
require 'xmlrpc/client'
|
|
40
40
|
require 'pp'
|
|
41
41
|
|
|
42
|
-
server = XMLRPC::Client.new2("http://
|
|
42
|
+
server = XMLRPC::Client.new2("http://localhost:8080/RPC2")
|
|
43
43
|
result = server.call("sample.sumAndDifference", 5, 3)
|
|
44
44
|
pp result
|
|
45
45
|
```
|
data/Rakefile
CHANGED
|
@@ -8,3 +8,13 @@ Rake::TestTask.new(:test) do |t|
|
|
|
8
8
|
end
|
|
9
9
|
|
|
10
10
|
task :default => :test
|
|
11
|
+
|
|
12
|
+
release_task = Rake.application["release"]
|
|
13
|
+
# We use Trusted Publishing.
|
|
14
|
+
release_task.prerequisites.delete("build")
|
|
15
|
+
release_task.prerequisites.delete("release:rubygem_push")
|
|
16
|
+
release_task_comment = release_task.comment
|
|
17
|
+
if release_task_comment
|
|
18
|
+
release_task.clear_comments
|
|
19
|
+
release_task.comment = release_task_comment.gsub(/ and build.*$/, "")
|
|
20
|
+
end
|
data/lib/xmlrpc/client.rb
CHANGED
|
@@ -44,7 +44,7 @@ module XMLRPC # :nodoc:
|
|
|
44
44
|
#
|
|
45
45
|
# server = XMLRPC::Client.new("www.ruby-lang.org", "/RPC2", 80)
|
|
46
46
|
# ok, param = server.call2("michael.add", 4, 5)
|
|
47
|
-
# if ok
|
|
47
|
+
# if ok
|
|
48
48
|
# puts "4 + 5 = #{param}"
|
|
49
49
|
# else
|
|
50
50
|
# puts "Error:"
|
|
@@ -147,7 +147,7 @@ module XMLRPC # :nodoc:
|
|
|
147
147
|
proto = url.scheme
|
|
148
148
|
user = url.user
|
|
149
149
|
passwd = url.password
|
|
150
|
-
host = url.
|
|
150
|
+
host = url.hostname
|
|
151
151
|
port = url.port
|
|
152
152
|
path = url.path.empty? ? nil : url.request_uri
|
|
153
153
|
|
|
@@ -246,7 +246,7 @@ module XMLRPC # :nodoc:
|
|
|
246
246
|
# * Date, Time, XMLRPC::DateTime
|
|
247
247
|
# * XMLRPC::Base64
|
|
248
248
|
# * A Ruby object which class includes XMLRPC::Marshallable
|
|
249
|
-
# (only if Config
|
|
249
|
+
# (only if Config.enable_marshalling? is +true+).
|
|
250
250
|
# That object is converted into a hash, with one additional key/value
|
|
251
251
|
# pair <code>___class___</code> which contains the class name
|
|
252
252
|
# for restoring that object later.
|
data/lib/xmlrpc/config.rb
CHANGED
|
@@ -15,6 +15,7 @@ module XMLRPC # :nodoc:
|
|
|
15
15
|
#
|
|
16
16
|
# * XMLParser::REXMLStreamParser
|
|
17
17
|
# * XMLParser::LibXMLStreamParser
|
|
18
|
+
# * XMLParser::NokogiriStreamParser
|
|
18
19
|
DEFAULT_PARSER = XMLParser::REXMLStreamParser
|
|
19
20
|
|
|
20
21
|
# enable <code><nil/></code> tag
|
|
@@ -33,6 +34,27 @@ module XMLRPC # :nodoc:
|
|
|
33
34
|
# enable Introspection extension by default
|
|
34
35
|
ENABLE_INTROSPECTION = false
|
|
35
36
|
|
|
37
|
+
[
|
|
38
|
+
:DEFAULT_WRITER,
|
|
39
|
+
:DEFAULT_PARSER,
|
|
40
|
+
:ENABLE_NIL_CREATE,
|
|
41
|
+
:ENABLE_NIL_PARSER,
|
|
42
|
+
:ENABLE_BIGINT,
|
|
43
|
+
:ENABLE_MARSHALLING,
|
|
44
|
+
:ENABLE_MULTICALL,
|
|
45
|
+
:ENABLE_INTROSPECTION
|
|
46
|
+
].each do |option|
|
|
47
|
+
getter = option.to_s.downcase
|
|
48
|
+
getter.concat('?') if [true, false].include?(const_get(option))
|
|
49
|
+
define_singleton_method(getter) do
|
|
50
|
+
const_get(option)
|
|
51
|
+
end
|
|
52
|
+
|
|
53
|
+
define_singleton_method("#{option.downcase}=") do |value|
|
|
54
|
+
remove_const(option)
|
|
55
|
+
const_set(option, value)
|
|
56
|
+
end
|
|
57
|
+
end
|
|
36
58
|
end
|
|
37
59
|
|
|
38
60
|
end
|
data/lib/xmlrpc/create.rb
CHANGED
|
@@ -106,7 +106,7 @@ module XMLRPC # :nodoc:
|
|
|
106
106
|
class Create
|
|
107
107
|
|
|
108
108
|
def initialize(xml_writer = nil)
|
|
109
|
-
@writer = xml_writer || Config
|
|
109
|
+
@writer = xml_writer || Config.default_writer.new
|
|
110
110
|
end
|
|
111
111
|
|
|
112
112
|
|
|
@@ -180,7 +180,7 @@ module XMLRPC # :nodoc:
|
|
|
180
180
|
val = case param
|
|
181
181
|
when Integer
|
|
182
182
|
# XML-RPC's int is 32bit int
|
|
183
|
-
if Config
|
|
183
|
+
if Config.enable_bigint?
|
|
184
184
|
@writer.tag("i4", param.to_s)
|
|
185
185
|
else
|
|
186
186
|
if param >= -(2**31) and param <= (2**31-1)
|
|
@@ -199,7 +199,7 @@ module XMLRPC # :nodoc:
|
|
|
199
199
|
@writer.tag("string", param)
|
|
200
200
|
|
|
201
201
|
when NilClass
|
|
202
|
-
if Config
|
|
202
|
+
if Config.enable_nil_create?
|
|
203
203
|
@writer.ele("nil")
|
|
204
204
|
else
|
|
205
205
|
raise "Wrong type NilClass. Not allowed!"
|
|
@@ -248,7 +248,7 @@ module XMLRPC # :nodoc:
|
|
|
248
248
|
@writer.tag("base64", param.encoded)
|
|
249
249
|
|
|
250
250
|
else
|
|
251
|
-
if Config
|
|
251
|
+
if Config.enable_marshalling? and param.class.included_modules.include? XMLRPC::Marshallable
|
|
252
252
|
# convert Ruby object into Hash
|
|
253
253
|
ret = {"___class___" => param.class.name}
|
|
254
254
|
param.instance_variables.each {|v|
|
|
@@ -256,7 +256,7 @@ module XMLRPC # :nodoc:
|
|
|
256
256
|
val = param.instance_variable_get(v)
|
|
257
257
|
|
|
258
258
|
if val.nil?
|
|
259
|
-
ret[name] = val if Config
|
|
259
|
+
ret[name] = val if Config.enable_nil_create?
|
|
260
260
|
else
|
|
261
261
|
ret[name] = val
|
|
262
262
|
end
|
data/lib/xmlrpc/parser.rb
CHANGED
|
@@ -107,12 +107,13 @@ module XMLRPC # :nodoc:
|
|
|
107
107
|
def self.struct(hash)
|
|
108
108
|
# convert to marshalled object
|
|
109
109
|
klass = hash["___class___"]
|
|
110
|
-
if klass.nil? or Config
|
|
110
|
+
if klass.nil? or not Config.enable_marshalling?
|
|
111
111
|
hash
|
|
112
112
|
else
|
|
113
113
|
begin
|
|
114
114
|
mod = Module
|
|
115
115
|
klass.split("::").each {|const| mod = mod.const_get(const.strip)}
|
|
116
|
+
return hash unless mod.included_modules.include?(XMLRPC::Marshallable)
|
|
116
117
|
|
|
117
118
|
obj = mod.allocate
|
|
118
119
|
|
|
@@ -204,7 +205,7 @@ module XMLRPC # :nodoc:
|
|
|
204
205
|
raise "error"
|
|
205
206
|
end
|
|
206
207
|
|
|
207
|
-
if not cmp
|
|
208
|
+
if not cmp
|
|
208
209
|
raise "wrong xml-rpc (name)"
|
|
209
210
|
end
|
|
210
211
|
|
|
@@ -216,14 +217,14 @@ module XMLRPC # :nodoc:
|
|
|
216
217
|
if node.childNodes.to_a.size != 1
|
|
217
218
|
raise "wrong xml-rpc (size)"
|
|
218
219
|
end
|
|
219
|
-
if name != nil
|
|
220
|
+
if name != nil
|
|
220
221
|
nodeMustBe(node.firstChild, name)
|
|
221
222
|
end
|
|
222
223
|
end
|
|
223
224
|
|
|
224
225
|
|
|
225
226
|
def assert(b)
|
|
226
|
-
if not b
|
|
227
|
+
if not b
|
|
227
228
|
raise "assert-fail"
|
|
228
229
|
end
|
|
229
230
|
end
|
|
@@ -416,7 +417,7 @@ module XMLRPC # :nodoc:
|
|
|
416
417
|
when "struct" then struct(child)
|
|
417
418
|
when "array" then array(child)
|
|
418
419
|
when "nil"
|
|
419
|
-
if Config
|
|
420
|
+
if Config.enable_nil_parser?
|
|
420
421
|
v_nil(child)
|
|
421
422
|
else
|
|
422
423
|
raise "wrong/unknown XML-RPC type 'nil'"
|
|
@@ -435,7 +436,7 @@ module XMLRPC # :nodoc:
|
|
|
435
436
|
assert( (1..2).include?( node.childNodes.to_a.size ) )
|
|
436
437
|
name = methodName(node[0])
|
|
437
438
|
|
|
438
|
-
if node.childNodes.to_a.size == 2
|
|
439
|
+
if node.childNodes.to_a.size == 2
|
|
439
440
|
pa = params(node[1])
|
|
440
441
|
else # no parameters given
|
|
441
442
|
pa = []
|
|
@@ -498,7 +499,7 @@ module XMLRPC # :nodoc:
|
|
|
498
499
|
when "value"
|
|
499
500
|
@value = nil
|
|
500
501
|
when "nil"
|
|
501
|
-
raise "wrong/unknown XML-RPC type 'nil'" unless Config
|
|
502
|
+
raise "wrong/unknown XML-RPC type 'nil'" unless Config.enable_nil_parser?
|
|
502
503
|
@value = :nil
|
|
503
504
|
when "array"
|
|
504
505
|
@val_stack << @values
|
|
@@ -594,7 +595,7 @@ module XMLRPC # :nodoc:
|
|
|
594
595
|
|
|
595
596
|
class LibXMLStreamParser < AbstractStreamParser
|
|
596
597
|
def initialize
|
|
597
|
-
require 'libxml'
|
|
598
|
+
require 'libxml-ruby'
|
|
598
599
|
@parser_class = LibXMLStreamListener
|
|
599
600
|
end
|
|
600
601
|
|
|
@@ -623,7 +624,51 @@ module XMLRPC # :nodoc:
|
|
|
623
624
|
end
|
|
624
625
|
end
|
|
625
626
|
|
|
626
|
-
|
|
627
|
+
class NokogiriStreamParser < AbstractStreamParser
|
|
628
|
+
def initialize
|
|
629
|
+
require 'nokogiri'
|
|
630
|
+
@parser_class = NokogiriStreamListener
|
|
631
|
+
end
|
|
632
|
+
|
|
633
|
+
class NokogiriStreamListener
|
|
634
|
+
include StreamParserMixin
|
|
635
|
+
|
|
636
|
+
def self.handler
|
|
637
|
+
# We need to construct this on first use, since we cannot be sure Nokogiri is available
|
|
638
|
+
@handler ||= begin
|
|
639
|
+
Class.new(Nokogiri::XML::SAX::Document) do
|
|
640
|
+
def initialize(parent)
|
|
641
|
+
super()
|
|
642
|
+
@parent = parent
|
|
643
|
+
end
|
|
644
|
+
|
|
645
|
+
def start_element_namespace(name, attrs = [], prefix = nil, uri = nil, ns = [])
|
|
646
|
+
@parent.startElement(name, attrs)
|
|
647
|
+
end
|
|
648
|
+
|
|
649
|
+
def end_element_namespace(name, prefix = nil, uri = nil)
|
|
650
|
+
@parent.endElement(name)
|
|
651
|
+
end
|
|
652
|
+
|
|
653
|
+
def characters(string)
|
|
654
|
+
@parent.character(string)
|
|
655
|
+
end
|
|
656
|
+
|
|
657
|
+
def cdata_block(string)
|
|
658
|
+
@parent.character(string)
|
|
659
|
+
end
|
|
660
|
+
end
|
|
661
|
+
end
|
|
662
|
+
end
|
|
663
|
+
|
|
664
|
+
def parse(str)
|
|
665
|
+
parser = Nokogiri::XML::SAX::Parser.new(self.class.handler.new(self))
|
|
666
|
+
parser.parse(str)
|
|
667
|
+
end
|
|
668
|
+
end
|
|
669
|
+
end
|
|
670
|
+
|
|
671
|
+
Classes = [REXMLStreamParser, LibXMLStreamParser, NokogiriStreamParser]
|
|
627
672
|
|
|
628
673
|
# yields an instance of each installed parser
|
|
629
674
|
def self.each_installed_parser
|
data/lib/xmlrpc/server.rb
CHANGED
|
@@ -63,8 +63,8 @@ class BasicServer
|
|
|
63
63
|
@create = nil
|
|
64
64
|
@parser = nil
|
|
65
65
|
|
|
66
|
-
add_multicall if Config
|
|
67
|
-
add_introspection if Config
|
|
66
|
+
add_multicall if Config.enable_multicall?
|
|
67
|
+
add_introspection if Config.enable_introspection?
|
|
68
68
|
end
|
|
69
69
|
|
|
70
70
|
# Adds +aBlock+ to the list of handlers, with +name+ as the name of
|
|
@@ -456,42 +456,24 @@ class CGIServer < BasicServer
|
|
|
456
456
|
end
|
|
457
457
|
|
|
458
458
|
|
|
459
|
-
# Implements a XML-RPC
|
|
460
|
-
|
|
461
|
-
# Use it in the same way as XMLRPC::CGIServer!
|
|
462
|
-
class ModRubyServer < BasicServer
|
|
463
|
-
|
|
464
|
-
# Creates a new XMLRPC::ModRubyServer instance.
|
|
465
|
-
#
|
|
466
|
-
# All parameters given are by-passed to XMLRPC::BasicServer.new.
|
|
467
|
-
def initialize(*a)
|
|
468
|
-
@ap = Apache::request
|
|
469
|
-
super(*a)
|
|
470
|
-
end
|
|
459
|
+
# Implements a XML-RPC application, which works with Rack
|
|
460
|
+
class RackApplication < BasicServer
|
|
471
461
|
|
|
472
|
-
# Call this after you have added all you handlers to the server.
|
|
473
|
-
#
|
|
474
462
|
# This method processes a XML-RPC method call and sends the answer
|
|
475
463
|
# back to the client.
|
|
476
|
-
def
|
|
477
|
-
|
|
478
|
-
header = {}
|
|
479
|
-
@ap.headers_in.each {|key, value| header[key.capitalize] = value}
|
|
464
|
+
def call(env)
|
|
465
|
+
length = env['CONTENT_LENGTH'].to_i
|
|
480
466
|
|
|
481
|
-
|
|
467
|
+
return http_error(405, "Method Not Allowed") unless env['REQUEST_METHOD'] == "POST"
|
|
468
|
+
return http_error(400, "Bad Request") unless parse_content_type(env['CONTENT_TYPE']).first == "text/xml"
|
|
469
|
+
return http_error(411, "Length Required") unless length > 0
|
|
482
470
|
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
http_error(411, "Length Required") unless length > 0
|
|
471
|
+
req = Rack::Request.new(env)
|
|
472
|
+
data = req.body.read(length)
|
|
486
473
|
|
|
487
|
-
|
|
488
|
-
@ap.binmode
|
|
489
|
-
data = @ap.read(length)
|
|
474
|
+
return http_error(400, "Bad Request") if data.nil? or data.bytesize != length
|
|
490
475
|
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
http_write(process(data), 200, "Content-type" => "text/xml; charset=utf-8")
|
|
494
|
-
}
|
|
476
|
+
[200, { "Content-type" => "text/xml; charset=utf-8" }, [process(data)]]
|
|
495
477
|
end
|
|
496
478
|
|
|
497
479
|
|
|
@@ -511,22 +493,7 @@ class ModRubyServer < BasicServer
|
|
|
511
493
|
</html>
|
|
512
494
|
MSGEND
|
|
513
495
|
|
|
514
|
-
|
|
515
|
-
throw :exit_serve # exit from the #serve method
|
|
516
|
-
end
|
|
517
|
-
|
|
518
|
-
def http_write(body, status, header)
|
|
519
|
-
h = {}
|
|
520
|
-
header.each {|key, value| h[key.to_s.capitalize] = value}
|
|
521
|
-
h['Status'] ||= "200 OK"
|
|
522
|
-
h['Content-length'] ||= body.bytesize.to_s
|
|
523
|
-
|
|
524
|
-
h.each {|key, value| @ap.headers_out[key] = value }
|
|
525
|
-
@ap.content_type = h["Content-type"]
|
|
526
|
-
@ap.status = status.to_i
|
|
527
|
-
@ap.send_http_header
|
|
528
|
-
|
|
529
|
-
@ap.print body
|
|
496
|
+
[status, { "Content-Type" => "text/html" }, [msg]]
|
|
530
497
|
end
|
|
531
498
|
|
|
532
499
|
end
|
data/lib/xmlrpc/utils.rb
CHANGED
|
@@ -26,7 +26,7 @@ module XMLRPC # :nodoc:
|
|
|
26
26
|
#
|
|
27
27
|
# Should be an instance of a class from module XMLRPC::XMLWriter.
|
|
28
28
|
#
|
|
29
|
-
# If this method is not called, then XMLRPC::Config
|
|
29
|
+
# If this method is not called, then XMLRPC::Config.default_writer is used.
|
|
30
30
|
def set_writer(writer)
|
|
31
31
|
@create = Create.new(writer)
|
|
32
32
|
self
|
|
@@ -36,7 +36,7 @@ module XMLRPC # :nodoc:
|
|
|
36
36
|
#
|
|
37
37
|
# Should be an instance of a class from module XMLRPC::XMLParser.
|
|
38
38
|
#
|
|
39
|
-
# If this method is not called, then XMLRPC::Config
|
|
39
|
+
# If this method is not called, then XMLRPC::Config.default_parser is used.
|
|
40
40
|
def set_parser(parser)
|
|
41
41
|
@parser = parser
|
|
42
42
|
self
|
|
@@ -46,16 +46,16 @@ module XMLRPC # :nodoc:
|
|
|
46
46
|
|
|
47
47
|
def create
|
|
48
48
|
# if set_writer was not already called then call it now
|
|
49
|
-
if @create.nil?
|
|
50
|
-
set_writer(Config
|
|
49
|
+
if @create.nil?
|
|
50
|
+
set_writer(Config.default_writer.new)
|
|
51
51
|
end
|
|
52
52
|
@create
|
|
53
53
|
end
|
|
54
54
|
|
|
55
55
|
def parser
|
|
56
56
|
# if set_parser was not already called then call it now
|
|
57
|
-
if @parser.nil?
|
|
58
|
-
set_parser(Config
|
|
57
|
+
if @parser.nil?
|
|
58
|
+
set_parser(Config.default_parser.new)
|
|
59
59
|
end
|
|
60
60
|
@parser
|
|
61
61
|
end
|
data/lib/xmlrpc.rb
CHANGED
|
@@ -44,7 +44,7 @@
|
|
|
44
44
|
# * Server
|
|
45
45
|
# * Standalone XML-RPC server
|
|
46
46
|
# * CGI-based (works with FastCGI)
|
|
47
|
-
# *
|
|
47
|
+
# * Rack application
|
|
48
48
|
# * WEBrick servlet
|
|
49
49
|
#
|
|
50
50
|
# * Client
|
|
@@ -59,9 +59,12 @@
|
|
|
59
59
|
# * libxml (LibXMLStreamParser)
|
|
60
60
|
# * Compiled
|
|
61
61
|
# * See https://rubygems.org/gems/libxml-ruby/
|
|
62
|
+
# * nokogiri (NokogiriStreamParser)
|
|
63
|
+
# * Compiled
|
|
64
|
+
# * See https://nokogiri.org
|
|
62
65
|
#
|
|
63
66
|
# * General
|
|
64
|
-
# * possible to choose between
|
|
67
|
+
# * possible to choose between REXML (pure Ruby) and LibXML/Nokogiri (compiled) parsers
|
|
65
68
|
# * Marshalling Ruby objects to Hashes and reconstruct them later from a Hash
|
|
66
69
|
# * SandStorm component architecture XMLRPC::Client interface
|
|
67
70
|
#
|
|
@@ -275,19 +278,19 @@
|
|
|
275
278
|
# XMLRPC::Client Example:
|
|
276
279
|
#
|
|
277
280
|
# # ...
|
|
278
|
-
#
|
|
279
|
-
#
|
|
281
|
+
# client = XMLRPC::Client.new( "xmlrpc-c.sourceforge.net", "/api/sample.php")
|
|
282
|
+
# client.set_parser(XMLRPC::XMLParser::XMLParser.new)
|
|
280
283
|
# # ...
|
|
281
284
|
#
|
|
282
285
|
# XMLRPC::Server Example:
|
|
283
286
|
#
|
|
284
287
|
# # ...
|
|
285
|
-
#
|
|
286
|
-
#
|
|
288
|
+
# server = XMLRPC::CGIServer.new
|
|
289
|
+
# server.set_parser(XMLRPC::XMLParser::XMLParser.new)
|
|
287
290
|
# # ...
|
|
288
291
|
#
|
|
289
292
|
#
|
|
290
293
|
# You can change the XML-writer by calling method ParserWriterChooseMixin#set_writer.
|
|
291
294
|
module XMLRPC
|
|
292
|
-
VERSION = "0.3.
|
|
295
|
+
VERSION = "0.3.4"
|
|
293
296
|
end
|
data/xmlrpc.gemspec
CHANGED
|
@@ -15,14 +15,9 @@ Gem::Specification.new do |spec|
|
|
|
15
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
|
-
spec.bindir = "exe"
|
|
19
|
-
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
|
20
18
|
spec.require_paths = ["lib"]
|
|
21
19
|
spec.required_ruby_version = ">= 2.3"
|
|
22
20
|
|
|
21
|
+
spec.add_dependency "rexml"
|
|
23
22
|
spec.add_dependency "webrick"
|
|
24
|
-
|
|
25
|
-
spec.add_development_dependency "bundler"
|
|
26
|
-
spec.add_development_dependency "rake"
|
|
27
|
-
spec.add_development_dependency "test-unit"
|
|
28
23
|
end
|
metadata
CHANGED
|
@@ -1,18 +1,17 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: xmlrpc
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.3.
|
|
4
|
+
version: 0.3.4
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- SHIBATA Hiroshi
|
|
8
8
|
- Sutou Kouhei
|
|
9
|
-
|
|
10
|
-
bindir: exe
|
|
9
|
+
bindir: bin
|
|
11
10
|
cert_chain: []
|
|
12
|
-
date:
|
|
11
|
+
date: 1980-01-02 00:00:00.000000000 Z
|
|
13
12
|
dependencies:
|
|
14
13
|
- !ruby/object:Gem::Dependency
|
|
15
|
-
name:
|
|
14
|
+
name: rexml
|
|
16
15
|
requirement: !ruby/object:Gem::Requirement
|
|
17
16
|
requirements:
|
|
18
17
|
- - ">="
|
|
@@ -26,41 +25,13 @@ dependencies:
|
|
|
26
25
|
- !ruby/object:Gem::Version
|
|
27
26
|
version: '0'
|
|
28
27
|
- !ruby/object:Gem::Dependency
|
|
29
|
-
name:
|
|
30
|
-
requirement: !ruby/object:Gem::Requirement
|
|
31
|
-
requirements:
|
|
32
|
-
- - ">="
|
|
33
|
-
- !ruby/object:Gem::Version
|
|
34
|
-
version: '0'
|
|
35
|
-
type: :development
|
|
36
|
-
prerelease: false
|
|
37
|
-
version_requirements: !ruby/object:Gem::Requirement
|
|
38
|
-
requirements:
|
|
39
|
-
- - ">="
|
|
40
|
-
- !ruby/object:Gem::Version
|
|
41
|
-
version: '0'
|
|
42
|
-
- !ruby/object:Gem::Dependency
|
|
43
|
-
name: rake
|
|
44
|
-
requirement: !ruby/object:Gem::Requirement
|
|
45
|
-
requirements:
|
|
46
|
-
- - ">="
|
|
47
|
-
- !ruby/object:Gem::Version
|
|
48
|
-
version: '0'
|
|
49
|
-
type: :development
|
|
50
|
-
prerelease: false
|
|
51
|
-
version_requirements: !ruby/object:Gem::Requirement
|
|
52
|
-
requirements:
|
|
53
|
-
- - ">="
|
|
54
|
-
- !ruby/object:Gem::Version
|
|
55
|
-
version: '0'
|
|
56
|
-
- !ruby/object:Gem::Dependency
|
|
57
|
-
name: test-unit
|
|
28
|
+
name: webrick
|
|
58
29
|
requirement: !ruby/object:Gem::Requirement
|
|
59
30
|
requirements:
|
|
60
31
|
- - ">="
|
|
61
32
|
- !ruby/object:Gem::Version
|
|
62
33
|
version: '0'
|
|
63
|
-
type: :
|
|
34
|
+
type: :runtime
|
|
64
35
|
prerelease: false
|
|
65
36
|
version_requirements: !ruby/object:Gem::Requirement
|
|
66
37
|
requirements:
|
|
@@ -76,6 +47,8 @@ executables: []
|
|
|
76
47
|
extensions: []
|
|
77
48
|
extra_rdoc_files: []
|
|
78
49
|
files:
|
|
50
|
+
- ".github/dependabot.yml"
|
|
51
|
+
- ".github/workflows/release.yml"
|
|
79
52
|
- ".github/workflows/test.yml"
|
|
80
53
|
- ".gitignore"
|
|
81
54
|
- Gemfile
|
|
@@ -101,7 +74,6 @@ licenses:
|
|
|
101
74
|
- Ruby
|
|
102
75
|
- BSD-2-Clause
|
|
103
76
|
metadata: {}
|
|
104
|
-
post_install_message:
|
|
105
77
|
rdoc_options: []
|
|
106
78
|
require_paths:
|
|
107
79
|
- lib
|
|
@@ -116,8 +88,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
116
88
|
- !ruby/object:Gem::Version
|
|
117
89
|
version: '0'
|
|
118
90
|
requirements: []
|
|
119
|
-
rubygems_version:
|
|
120
|
-
signing_key:
|
|
91
|
+
rubygems_version: 4.0.6
|
|
121
92
|
specification_version: 4
|
|
122
93
|
summary: XMLRPC is a lightweight protocol that enables remote procedure calls over
|
|
123
94
|
HTTP.
|