websocket 1.0.3 → 1.0.4

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,5 +1,9 @@
1
1
  # Changelog
2
2
 
3
+ ## 1.0.4
4
+
5
+ - nicer inspect - handful during debugging
6
+
3
7
  ## 1.0.3
4
8
 
5
9
  - improve pure ruby implementation performance by ~30%
data/README.md CHANGED
@@ -33,14 +33,14 @@ gem "websocket"
33
33
 
34
34
  # Parse client request
35
35
  @handshake << <<EOF
36
- GET /demo HTTP/1.1
37
- Upgrade: websocket
38
- Connection: Upgrade
39
- Host: example.com
40
- Sec-WebSocket-Origin: http://example.com
41
- Sec-WebSocket-Version: 17
42
- Sec-WebSocket-Key: dGhlIHNhbXBsZSBub25jZQ==
43
-
36
+ GET /demo HTTP/1.1\r
37
+ Upgrade: websocket\r
38
+ Connection: Upgrade\r
39
+ Host: example.com\r
40
+ Sec-WebSocket-Origin: http://example.com\r
41
+ Sec-WebSocket-Version: 13\r
42
+ Sec-WebSocket-Key: dGhlIHNhbXBsZSBub25jZQ==\r
43
+ \r
44
44
  EOF
45
45
 
46
46
  # All data received?
@@ -67,16 +67,16 @@ EOF
67
67
  # Connection: Upgrade
68
68
  # Host: example.com
69
69
  # Sec-WebSocket-Origin: http://example.com
70
- # Sec-WebSocket-Version: 17
70
+ # Sec-WebSocket-Version: 13
71
71
  # Sec-WebSocket-Key: dGhlIHNhbXBsZSBub25jZQ==
72
72
 
73
73
  # Parse server response
74
74
  @handshake << <<EOF
75
- HTTP/1.1 101 Switching Protocols
76
- Upgrade: websocket
77
- Connection: Upgrade
78
- Sec-WebSocket-Accept: s3pPLMBiTxaQ9kYGzzhZRbK+xOo=
79
-
75
+ HTTP/1.1 101 Switching Protocols\r
76
+ Upgrade: websocket\r
77
+ Connection: Upgrade\r
78
+ Sec-WebSocket-Accept: s3pPLMBiTxaQ9kYGzzhZRbK+xOo=\r
79
+ \r
80
80
  EOF
81
81
 
82
82
  # All data received?
@@ -3,8 +3,8 @@
3
3
  "outdir": "./autobahn/server",
4
4
 
5
5
  "servers": [
6
- {"agent": "WebSocket-Ruby<br>(1.0.3 Pure)", "url": "ws://localhost:9001", "options": {"version": 18}},
7
- {"agent": "WebSocket-Ruby<br>(1.0.3 Native)", "url": "ws://localhost:9002", "options": {"version": 18}},
6
+ {"agent": "WebSocket-Ruby<br>(1.0.4 Pure)", "url": "ws://localhost:9001", "options": {"version": 18}},
7
+ {"agent": "WebSocket-Ruby<br>(1.0.4 Native)", "url": "ws://localhost:9002", "options": {"version": 18}},
8
8
  {"agent": "Faye-WebSocket<br>(0.4.6 Thin)", "url": "ws://localhost:7000", "options": {"version": 18}},
9
9
  {"agent": "EM-WebSocket<br>(0.3.8)", "url": "ws://localhost:8080", "options": {"version": 18}}
10
10
  ],
@@ -33,6 +33,13 @@ module WebSocket
33
33
  raise NotImplementedError
34
34
  end
35
35
 
36
+ # Recreate inspect as #to_s was overwritten
37
+ def inspect
38
+ vars = self.instance_variables.map{|v| "#{v}=#{instance_variable_get(v).inspect}"}.join(", ")
39
+ insp = "#{self.class}:0x%08x" % (self.__id__ * 2)
40
+ "<#{insp} #{vars}>"
41
+ end
42
+
36
43
  private
37
44
 
38
45
  # Include set of methods for selected protocol version
@@ -25,6 +25,13 @@ module WebSocket
25
25
  ""
26
26
  end
27
27
 
28
+ # Recreate inspect as #to_s was overwritten
29
+ def inspect
30
+ vars = self.instance_variables.map{|v| "#{v}=#{instance_variable_get(v).inspect}"}.join(", ")
31
+ insp = "#{self.class}:0x%08x" % (self.__id__ * 2)
32
+ "<#{insp} #{vars}>"
33
+ end
34
+
28
35
  # Is parsing of data finished?
29
36
  # @return [Boolena] True if request was completely parsed or error occured. False otherwise
30
37
  def finished?
@@ -13,16 +13,16 @@ module WebSocket
13
13
  # # Connection: Upgrade
14
14
  # # Host: example.com
15
15
  # # Sec-WebSocket-Origin: http://example.com
16
- # # Sec-WebSocket-Version: 17
16
+ # # Sec-WebSocket-Version: 13
17
17
  # # Sec-WebSocket-Key: dGhlIHNhbXBsZSBub25jZQ==
18
18
  #
19
19
  # # Parse server response
20
20
  # @handshake << <<EOF
21
- # HTTP/1.1 101 Switching Protocols
22
- # Upgrade: websocket
23
- # Connection: Upgrade
24
- # Sec-WebSocket-Accept: s3pPLMBiTxaQ9kYGzzhZRbK+xOo=
25
- #
21
+ # HTTP/1.1 101 Switching Protocols\r
22
+ # Upgrade: websocket\r
23
+ # Connection: Upgrade\r
24
+ # Sec-WebSocket-Accept: s3pPLMBiTxaQ9kYGzzhZRbK+xOo=\r
25
+ # \r
26
26
  # EOF
27
27
  #
28
28
  # # All data received?
@@ -7,14 +7,14 @@ module WebSocket
7
7
  #
8
8
  # # Parse client request
9
9
  # @handshake << <<EOF
10
- # GET /demo HTTP/1.1
11
- # Upgrade: websocket
12
- # Connection: Upgrade
13
- # Host: example.com
14
- # Sec-WebSocket-Origin: http://example.com
15
- # Sec-WebSocket-Version: 17
16
- # Sec-WebSocket-Key: dGhlIHNhbXBsZSBub25jZQ==
17
- #
10
+ # GET /demo HTTP/1.1\r
11
+ # Upgrade: websocket\r
12
+ # Connection: Upgrade\r
13
+ # Host: example.com\r
14
+ # Sec-WebSocket-Origin: http://example.com\r
15
+ # Sec-WebSocket-Version: 13\r
16
+ # Sec-WebSocket-Key: dGhlIHNhbXBsZSBub25jZQ==\r
17
+ # \r
18
18
  # EOF
19
19
  #
20
20
  # # All data received?
@@ -1,3 +1,3 @@
1
1
  module WebSocket
2
- VERSION = '1.0.3'
2
+ VERSION = '1.0.4'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: websocket
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.3
4
+ version: 1.0.4
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-11-19 00:00:00.000000000 Z
12
+ date: 2012-11-22 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rspec
@@ -119,18 +119,12 @@ required_ruby_version: !ruby/object:Gem::Requirement
119
119
  - - ! '>='
120
120
  - !ruby/object:Gem::Version
121
121
  version: '0'
122
- segments:
123
- - 0
124
- hash: 159948745568353421
125
122
  required_rubygems_version: !ruby/object:Gem::Requirement
126
123
  none: false
127
124
  requirements:
128
125
  - - ! '>='
129
126
  - !ruby/object:Gem::Version
130
127
  version: '0'
131
- segments:
132
- - 0
133
- hash: 159948745568353421
134
128
  requirements: []
135
129
  rubyforge_project:
136
130
  rubygems_version: 1.8.24