websocket-driver 0.7.4 → 0.7.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +4 -0
- data/lib/websocket/driver.rb +13 -13
- data/lib/websocket/driver/hybi.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 046c514660d2c0dab2cf42bce8314a17e713909377a5da470beaeadf666ff28e
|
4
|
+
data.tar.gz: 9830c412394044d102dd6f313346721076ef0f97284d6182aeb06862e1f427b2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: cea4027f342f51a688c8004a92ca29b68af9a9395b5e7f8d2462b8742067862718d23f4be9ca6162f761774490e4cdf33111bb746f9221d5acace6546a749b35
|
7
|
+
data.tar.gz: d124aa6acf1cbfa498b44d02d6aa659c99e97e177441e8cbd43958db38c6cf03d703d26ae73998a09719c0612f538554049d58b58aa8cc8ab5f0bb458e27c988
|
data/CHANGELOG.md
CHANGED
data/lib/websocket/driver.rb
CHANGED
@@ -115,7 +115,7 @@ module WebSocket
|
|
115
115
|
end
|
116
116
|
|
117
117
|
def text(message)
|
118
|
-
message =
|
118
|
+
message = Driver.encode(message, Encoding::UTF_8)
|
119
119
|
frame(message, :text)
|
120
120
|
end
|
121
121
|
|
@@ -194,19 +194,19 @@ module WebSocket
|
|
194
194
|
end
|
195
195
|
end
|
196
196
|
|
197
|
-
def self.encode(
|
198
|
-
|
199
|
-
|
200
|
-
|
201
|
-
encoding ||= Encoding::BINARY
|
202
|
-
when String then
|
203
|
-
encoding ||= Encoding::UTF_8
|
197
|
+
def self.encode(data, encoding = nil)
|
198
|
+
if Array === data
|
199
|
+
encoding ||= Encoding::BINARY
|
200
|
+
return data.pack('C*').force_encoding(encoding)
|
204
201
|
end
|
205
|
-
|
206
|
-
|
207
|
-
|
208
|
-
|
209
|
-
|
202
|
+
|
203
|
+
encoding ||= Encoding::UTF_8
|
204
|
+
|
205
|
+
return data if data.encoding == encoding
|
206
|
+
return data.encode(encoding) unless data.encoding == Encoding::BINARY
|
207
|
+
|
208
|
+
data = data.dup if data.frozen?
|
209
|
+
data.force_encoding(encoding)
|
210
210
|
end
|
211
211
|
|
212
212
|
def self.validate_options(options, valid_keys)
|
@@ -164,7 +164,7 @@ module WebSocket
|
|
164
164
|
message.rsv1 = message.rsv2 = message.rsv3 = false
|
165
165
|
message.opcode = OPCODES[type || (String === buffer ? :text : :binary)]
|
166
166
|
|
167
|
-
payload = Driver.encode(buffer
|
167
|
+
payload = Driver.encode(buffer)
|
168
168
|
payload = [code, payload].pack('S>a*') if code
|
169
169
|
message.data = payload
|
170
170
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: websocket-driver
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.7.
|
4
|
+
version: 0.7.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- James Coglan
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-
|
11
|
+
date: 2021-06-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: websocket-extensions
|