websocket-driver 0.5.3 → 0.5.4

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
  SHA1:
3
- metadata.gz: 279ea094c3b56d83654b92d0d2edc2f919a276b8
4
- data.tar.gz: f9cc7d12ec60e7e495f434318e5bf6332ac42ce3
3
+ metadata.gz: 653c1d2f3e93b56720caa2628bb9164d9870a3cf
4
+ data.tar.gz: 3fe00f429a75159cc5c5b6f5104a1a5a8e792e89
5
5
  SHA512:
6
- metadata.gz: 89b8be4c679cdc295e4863706fe340a542e63297195aa853798667852693f2c9917281de3128c935e213a7395696c082cd799d8d76cc6ef8dcce4fdd4f563635
7
- data.tar.gz: be0b80ff9a6c35686fb1157ccb757f8770579c5655ada3f250b701e84f92fa4942510ed073b2c117acf6c07c2b839127fd20b12e5622c403905c50ba8d60649d
6
+ metadata.gz: 7692a1e01a589de14fc6be0992333f2664b8500bbd23ef0c5e182eb17201ba3f0f1ea0d877e3f7907c4e1bac300ca705c0fd363c02a40948478ad2b15f91e065
7
+ data.tar.gz: 1d994b02ccd3ad8b4a560863f272a24daba29cee2a89f02e7e5d48591ba0a17aaf80000fa223cf948e556951502b5ff4f607cca50d55e594314eb6363d505c43
data/CHANGELOG.md CHANGED
@@ -1,3 +1,10 @@
1
+ ### 0.5.4 / 2015-03-29
2
+
3
+ * Don't emit extra close frames if we receive a close frame after we already
4
+ sent one
5
+ * Fail the connection when the driver receives an invalid
6
+ `Sec-WebSocket-Extensions` header
7
+
1
8
  ### 0.5.3 / 2015-02-22
2
9
 
3
10
  * Don't treat incoming data as WebSocket frames if a client driver is closed
@@ -21,7 +28,8 @@
21
28
 
22
29
  ### 0.3.5 / 2014-10-04
23
30
 
24
- * Fix bug where the `Server` driver doesn't pass `ping` callbacks to its delegate
31
+ * Fix bug where the `Server` driver doesn't pass `ping` callbacks to its
32
+ delegate
25
33
  * Fix an arity error when calling `fail_request`
26
34
  * Allow `close` to be called before `start` to close the driver
27
35
 
@@ -29,7 +37,8 @@
29
37
 
30
38
  * Don't hold references to frame buffers after a message has been emitted
31
39
  * Make sure that `protocol` and `version` are exposed properly by the TCP driver
32
- * Correct HTTP header parsing based on RFC 7230; header names cannot contain backslashes
40
+ * Correct HTTP header parsing based on RFC 7230; header names cannot contain
41
+ backslashes
33
42
 
34
43
  ### 0.3.3 / 2014-04-24
35
44
 
@@ -39,7 +48,8 @@
39
48
 
40
49
  ### 0.3.2 / 2013-12-29
41
50
 
42
- * Expand `max_length` to cover sequences of continuation frames and `draft-{75,76}`
51
+ * Expand `max_length` to cover sequences of continuation frames and
52
+ `draft-{75,76}`
43
53
  * Decrease default maximum frame buffer size to 64MB
44
54
  * Stop parsing when the protocol enters a failure mode, to save CPU cycles
45
55
 
data/README.md CHANGED
@@ -311,7 +311,7 @@ the headers are serialized and sent.
311
311
 
312
312
  Initiates the protocol by sending the handshake - either the response for a
313
313
  server-side driver or the request for a client-side one. This should be the
314
- first method you invoke. Returns `true` iff a handshake was sent.
314
+ first method you invoke. Returns `true` if and only if a handshake was sent.
315
315
 
316
316
  #### `driver.parse(string)`
317
317
 
@@ -89,7 +89,9 @@ module WebSocket
89
89
 
90
90
  def start
91
91
  return false unless @ready_state == 0
92
- @socket.write(Driver.encode(handshake_response, :binary))
92
+ response = handshake_response
93
+ return false unless response
94
+ @socket.write(Driver.encode(response, :binary))
93
95
  open unless @stage == -1
94
96
  true
95
97
  end
@@ -237,7 +237,13 @@ module WebSocket
237
237
  end
238
238
 
239
239
  def handshake_response
240
- extensions = @extensions.generate_response(@socket.env['HTTP_SEC_WEBSOCKET_EXTENSIONS'])
240
+ begin
241
+ extensions = @extensions.generate_response(@socket.env['HTTP_SEC_WEBSOCKET_EXTENSIONS'])
242
+ rescue => e
243
+ fail(:protocol_error, e.message)
244
+ return nil
245
+ end
246
+
241
247
  @headers['Sec-WebSocket-Extensions'] = extensions if extensions
242
248
 
243
249
  start = 'HTTP/1.1 101 Switching Protocols'
@@ -246,7 +252,7 @@ module WebSocket
246
252
  end
247
253
 
248
254
  def shutdown(code, reason)
249
- frame(reason, :close, code)
255
+ frame(reason, :close, code) if @ready_state < 2
250
256
  @frame = @message = nil
251
257
  @ready_state = 3
252
258
  @stage = 5
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.5.3
4
+ version: 0.5.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - James Coglan
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-02-22 00:00:00.000000000 Z
11
+ date: 2015-03-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: websocket-extensions