em-websocket-request 0.0.7 → 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
@@ -39,9 +39,13 @@ class WebSocket
|
|
39
39
|
|
40
40
|
@server = params[:server]
|
41
41
|
@socket = arg
|
42
|
-
line = gets()
|
42
|
+
line = gets()
|
43
|
+
if !line
|
44
|
+
raise(WebSocket::Error, "Client disconnected without sending anything.")
|
45
|
+
end
|
46
|
+
line = line.chomp()
|
43
47
|
if !(line =~ /\AGET (\S+) HTTP\/1.1\z/n)
|
44
|
-
raise(WebSocket::Error, "
|
48
|
+
raise(WebSocket::Error, "Invalid request: #{line}")
|
45
49
|
end
|
46
50
|
@path = $1
|
47
51
|
read_header()
|
@@ -300,10 +304,16 @@ class WebSocket
|
|
300
304
|
@header[$1] = $2
|
301
305
|
@header[$1.downcase()] = $2
|
302
306
|
end
|
307
|
+
if !@header["upgrade"]
|
308
|
+
raise(WebSocket::Error, "Upgrade header is missing")
|
309
|
+
end
|
303
310
|
if !(@header["upgrade"] =~ /\AWebSocket\z/i)
|
304
311
|
raise(WebSocket::Error, "invalid Upgrade: " + @header["upgrade"])
|
305
312
|
end
|
306
|
-
if
|
313
|
+
if !@header["connection"]
|
314
|
+
raise(WebSocket::Error, "Connection header is missing")
|
315
|
+
end
|
316
|
+
if @header["connection"].split(/,/).grep(/\A\s*Upgrade\s*\z/i).empty?
|
307
317
|
raise(WebSocket::Error, "invalid Connection: " + @header["connection"])
|
308
318
|
end
|
309
319
|
end
|
@@ -495,7 +505,7 @@ class WebSocketServer
|
|
495
505
|
send_flash_socket_policy_file(socket)
|
496
506
|
return nil
|
497
507
|
else
|
498
|
-
socket.ungetc(ch)
|
508
|
+
socket.ungetc(ch) if ch
|
499
509
|
return WebSocket.new(socket, :server => self)
|
500
510
|
end
|
501
511
|
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
|
4
|
+
version: 0.1.0
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,11 +9,11 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2013-03-15 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: em-http-request
|
16
|
-
requirement:
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ~>
|
@@ -21,7 +21,12 @@ dependencies:
|
|
21
21
|
version: 1.0.0
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
|
-
version_requirements:
|
24
|
+
version_requirements: !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
26
|
+
requirements:
|
27
|
+
- - ~>
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
version: 1.0.0
|
25
30
|
description: EventMachine WebSocket client
|
26
31
|
email:
|
27
32
|
- mrykov@gmail.com
|
@@ -61,7 +66,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
61
66
|
version: '0'
|
62
67
|
requirements: []
|
63
68
|
rubyforge_project:
|
64
|
-
rubygems_version: 1.8.
|
69
|
+
rubygems_version: 1.8.23
|
65
70
|
signing_key:
|
66
71
|
specification_version: 3
|
67
72
|
summary: EventMachine WebSocket client
|