msgpack-rpc 0.4.4 → 0.4.5

Sign up to get free protection for your applications and to get access to all the features.
data/ChangeLog CHANGED
@@ -1,4 +1,8 @@
1
1
 
2
+ 2011-04-14 version 0.4.5
3
+
4
+ * Fixes encoding problem of Address.parse_sockaddr(raw) on ruby 1.9
5
+
2
6
  2011-04-06 version 0.4.4
3
7
 
4
8
  * Fixes missing RuntimeError::CODE
@@ -82,16 +82,31 @@ class Address
82
82
  Address.parse(@serial)
83
83
  end
84
84
 
85
- def self.parse_sockaddr(raw)
86
- if raw.length == 6
87
- addr = Socket.pack_sockaddr_in(0, '0.0.0.0')
88
- addr[2,6] = raw[0,6]
89
- else
90
- addr = Socket.pack_sockaddr_in(0, '::')
91
- addr[2,2] = raw[0,2]
92
- addr[8,16] = raw[2,16]
85
+ if "".respond_to?(:encoding)
86
+ def self.parse_sockaddr(raw)
87
+ raw.force_encoding('ASCII-8BIT')
88
+ if raw.length == 6
89
+ addr = Socket.pack_sockaddr_in(0, '0.0.0.0')
90
+ addr[2,6] = raw[0,6]
91
+ else
92
+ addr = Socket.pack_sockaddr_in(0, '::')
93
+ addr[2,2] = raw[0,2]
94
+ addr[8,16] = raw[2,16]
95
+ end
96
+ addr
97
+ end
98
+ else
99
+ def self.parse_sockaddr(raw)
100
+ if raw.length == 6
101
+ addr = Socket.pack_sockaddr_in(0, '0.0.0.0')
102
+ addr[2,6] = raw[0,6]
103
+ else
104
+ addr = Socket.pack_sockaddr_in(0, '::')
105
+ addr[2,2] = raw[0,2]
106
+ addr[8,16] = raw[2,16]
107
+ end
108
+ addr
93
109
  end
94
- addr
95
110
  end
96
111
 
97
112
  def self.parse(raw)
@@ -1,7 +1,7 @@
1
1
  module MessagePack
2
2
  module RPC
3
3
 
4
- VERSION = '0.4.4'
4
+ VERSION = '0.4.5'
5
5
 
6
6
  end
7
7
  end
@@ -285,5 +285,13 @@ class MessagePackRPCTest < Test::Unit::TestCase
285
285
  cli.close
286
286
  lsock.close
287
287
  end
288
+
289
+ def test_address
290
+ addr = MessagePack::RPC::Address.new('172.16.0.11', 18900)
291
+ raw = addr.to_msgpack
292
+ msg = MessagePack.unpack(raw)
293
+ addr2 = MessagePack::RPC::Address.load(msg)
294
+ assert_equal(addr, addr2)
295
+ end
288
296
  end
289
297
 
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: msgpack-rpc
3
3
  version: !ruby/object:Gem::Version
4
- hash: 7
4
+ hash: 5
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 4
9
- - 4
10
- version: 0.4.4
9
+ - 5
10
+ version: 0.4.5
11
11
  platform: ruby
12
12
  authors:
13
13
  - FURUHASHI Sadayuki
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2011-04-06 00:00:00 +09:00
18
+ date: 2011-04-14 00:00:00 +09:00
19
19
  default_executable:
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency