websocket-driver 0.7.4-java → 0.7.5-java

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: cd9397ef6b3c46b55d4f5809f8b359f261b983f5a29442d6cbb9791fb40761d8
4
- data.tar.gz: 871848fa7118981c4543d4533f4a0a845ff848b5da639e42f16f7f5f6762231a
3
+ metadata.gz: 6c493f42d0b99554f08c80a52b3e746933b7641b5e1ff1b4bfd80eeb7c47987b
4
+ data.tar.gz: 1f2cd918f620ded04e91eae7ab235554f42ce7cdde6712c174490f238fda14da
5
5
  SHA512:
6
- metadata.gz: 1d9b3b03d2ada8d5757d7a2ea189097a2b31b4ffbd980317d88176826aa77db2be291a89d8280533d3e3f79c46997d157c540a2d2ef77f3a80c2d00b5bd7965c
7
- data.tar.gz: f87b7664488e57fc8e976809b6554dd05cac016961fef21efa7331917bb247be14f24dbe4642ae909e295d1c61dedb5a5e42d44d298b10921acbd3bf4aa69293
6
+ metadata.gz: 54ee4bbd62e64e87d5b42576a93ca11785b40aa64ad2cf8350f49ccd79c652bf57860e793234e742e7def2d7a4fb8039fcff1cafb7640721811083dd482099df
7
+ data.tar.gz: 807a05150676ded5470934212214839e23c9ea31674d6a765c85af98432a77a43306ceb2a0c0aa4354fc700f5ed92596a76eff9626e7fac40df11490d87cd0f8
data/CHANGELOG.md CHANGED
@@ -1,3 +1,7 @@
1
+ ### 0.7.5 / 2021-06-12
2
+
3
+ - Do not change the encoding of strings passed to `Driver#text`
4
+
1
5
  ### 0.7.4 / 2021-05-24
2
6
 
3
7
  - Optimise conversions between strings and byte arrays and related encoding
@@ -115,7 +115,7 @@ module WebSocket
115
115
  end
116
116
 
117
117
  def text(message)
118
- message = message.encode(Encoding::UTF_8) unless message.encoding == Encoding::UTF_8
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(string, encoding = nil)
198
- case string
199
- when Array then
200
- string = string.pack('C*')
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
- unless string.encoding == encoding
206
- string = string.dup if string.frozen?
207
- string.force_encoding(encoding)
208
- end
209
- string
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, Encoding::BINARY)
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
4
+ version: 0.7.5
5
5
  platform: java
6
6
  authors:
7
7
  - James Coglan
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-05-24 00:00:00.000000000 Z
11
+ date: 2021-06-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  requirement: !ruby/object:Gem::Requirement