em-websocket-request 0.0.6 → 0.0.7

Sign up to get free protection for your applications and to get access to all the features.
@@ -10,8 +10,9 @@ module EventMachine
10
10
  super
11
11
  @p.on_message_complete = proc do
12
12
  if not client.continue?
13
- if client.state == :websocket
13
+ if client.state == :upgrade
14
14
  client.state = :stream
15
+ client.succeed
15
16
  else
16
17
  client.state = :finished
17
18
  client.on_request_complete
@@ -41,7 +42,7 @@ module EventMachine
41
42
 
42
43
  def send(data, frame_type = :text)
43
44
  @connection = @conn
44
- if state == :stream || state == :websocket # FIXME
45
+ if state == :stream
45
46
  @wswrapper.send_frame(frame_type, data)
46
47
  end
47
48
  end
@@ -85,8 +86,7 @@ module EventMachine
85
86
 
86
87
  fail "websocket handshake failed (mismatched key)"
87
88
  else
88
- @state = :websocket
89
- succeed
89
+ @state = :upgrade
90
90
  end
91
91
  end
92
92
  end
@@ -97,7 +97,7 @@ module EventMachine
97
97
  end
98
98
 
99
99
  def unbind(reason = nil)
100
- if state == :stream || state == :websocket # FIXME
100
+ if state == :stream
101
101
  @disconnect.call(self) if @disconnect
102
102
  on_error(reason) # TODO: Should we really barf on unbind?
103
103
  else
@@ -300,16 +300,10 @@ class WebSocket
300
300
  @header[$1] = $2
301
301
  @header[$1.downcase()] = $2
302
302
  end
303
- if !@header["upgrade"]
304
- raise(WebSocket::Error, "Upgrade header is missing")
305
- end
306
303
  if !(@header["upgrade"] =~ /\AWebSocket\z/i)
307
304
  raise(WebSocket::Error, "invalid Upgrade: " + @header["upgrade"])
308
305
  end
309
- if !@header["connection"]
310
- raise(WebSocket::Error, "Connection header is missing")
311
- end
312
- if @header["connection"].split(/,/).grep(/\A\s*Upgrade\s*\z/i).empty?
306
+ if !(@header["connection"] =~ /\AUpgrade\z/i)
313
307
  raise(WebSocket::Error, "invalid Connection: " + @header["connection"])
314
308
  end
315
309
  end
@@ -1,3 +1,3 @@
1
1
  module EventMachine
2
- WS_REQUEST_VERSION = "0.0.6"
2
+ WS_REQUEST_VERSION = "0.0.7"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: em-websocket-request
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.6
4
+ version: 0.0.7
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -13,7 +13,7 @@ date: 2012-01-12 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: em-http-request
16
- requirement: &70323345919160 !ruby/object:Gem::Requirement
16
+ requirement: &70163894954540 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ~>
@@ -21,7 +21,7 @@ dependencies:
21
21
  version: 1.0.0
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *70323345919160
24
+ version_requirements: *70163894954540
25
25
  description: EventMachine WebSocket client
26
26
  email:
27
27
  - mrykov@gmail.com