hessian 0.5.1 → 0.5.2
Sign up to get free protection for your applications and to get access to all the features.
- data/Rakefile +1 -1
- data/lib/hessian.rb +7 -4
- metadata +2 -2
data/Rakefile
CHANGED
data/lib/hessian.rb
CHANGED
@@ -1,5 +1,6 @@
|
|
1
1
|
require 'uri'
|
2
2
|
require 'net/http'
|
3
|
+
require 'net/https'
|
3
4
|
|
4
5
|
module Hessian
|
5
6
|
class Binary
|
@@ -17,11 +18,11 @@ module Hessian
|
|
17
18
|
end
|
18
19
|
|
19
20
|
class HessianClient
|
20
|
-
attr_reader :host, :port, :path, :proxy
|
21
|
+
attr_reader :scheme, :host, :port, :path, :proxy
|
21
22
|
def initialize(url, proxy = {})
|
22
23
|
uri = URI.parse(url)
|
23
|
-
@host, @port, @path = uri.host, uri.port, uri.path
|
24
|
-
raise "Unsupported Hessian protocol:
|
24
|
+
@scheme, @host, @port, @path = uri.scheme, uri.host, uri.port, uri.path
|
25
|
+
raise "Unsupported Hessian protocol: #@scheme" unless @scheme == 'http' || @scheme == 'https'
|
25
26
|
@proxy = proxy
|
26
27
|
end
|
27
28
|
|
@@ -33,7 +34,9 @@ module Hessian
|
|
33
34
|
def invoke(method, args)
|
34
35
|
req = HessianWriter.new.write_call method, args
|
35
36
|
header = { 'Content-Type' => 'application/binary' }
|
36
|
-
Net::HTTP.
|
37
|
+
conn = Net::HTTP.new(@host, @port, *@proxy.values_at(:host, :port, :user, :password))
|
38
|
+
conn.use_ssl = true and conn.verify_mode = OpenSSL::SSL::VERIFY_NONE if @scheme == 'https'
|
39
|
+
conn.start do |http|
|
37
40
|
res = http.send_request('POST', @path, req, header)
|
38
41
|
HessianParser.new.parse_response res.body
|
39
42
|
end
|
metadata
CHANGED
@@ -3,8 +3,8 @@ rubygems_version: 0.8.11
|
|
3
3
|
specification_version: 1
|
4
4
|
name: hessian
|
5
5
|
version: !ruby/object:Gem::Version
|
6
|
-
version: 0.5.
|
7
|
-
date: 2006-02-
|
6
|
+
version: 0.5.2
|
7
|
+
date: 2006-02-25 00:00:00 +01:00
|
8
8
|
summary: A Ruby Hessian client.
|
9
9
|
require_paths:
|
10
10
|
- lib
|