websocket_parser 0.1.0 → 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
data/Gemfile CHANGED
@@ -1,4 +1,6 @@
1
- source 'https://rubygems.org'
1
+ source :rubygems
2
+
3
+ gem 'jruby-openssl' if defined? JRUBY_VERSION
2
4
 
3
5
  # Specify your gem's dependencies in websocket_parser.gemspec
4
6
  gemspec
@@ -113,11 +113,11 @@ module WebSocket
113
113
 
114
114
  def read_extended_payload_length
115
115
  if message_size == :medium && @data.size >= 2
116
- size = unpack_bytes(2,'S<')
116
+ size = unpack_bytes(2,'S>')
117
117
  ParserError.new("Wrong payload length. Expected to be greater than 125") unless size > 125
118
118
  size
119
119
  elsif message_size == :large && @data.size >= 4
120
- size = unpack_bytes(8,'Q<')
120
+ size = unpack_bytes(8,'Q>')
121
121
  ParserError.new("Wrong payload length. Expected to be greater than 65535") unless size > 65_535
122
122
  size
123
123
  end
@@ -1,3 +1,3 @@
1
1
  module WebSocket
2
- VERSION = "0.1.0"
2
+ VERSION = "0.1.1"
3
3
  end
@@ -53,9 +53,9 @@ module WebSocket
53
53
  format = 'CC'
54
54
 
55
55
  if payload_length > 65_535
56
- format += 'Q<'
56
+ format += 'Q>'
57
57
  elsif payload_length > 125
58
- format += 'S<'
58
+ format += 'S>'
59
59
  end
60
60
 
61
61
  if masked
@@ -10,7 +10,7 @@ describe WebSocket::Message do
10
10
  # 2 bytes from header + 8 bytes from extended payload length + payload
11
11
  data.size.should == 2 + 8 + text.length
12
12
 
13
- first_byte, second_byte, ext_length, payload = data.unpack("CCQ<a#{text.length}")
13
+ first_byte, second_byte, ext_length, payload = data.unpack("CCQ>a#{text.length}")
14
14
 
15
15
  first_byte.should == 0b10000001 # Text frame with FIN bit set
16
16
  second_byte.should == 0b01111111 # Unmasked. Payload length 127.
@@ -168,14 +168,14 @@ describe WebSocket::Parser do
168
168
 
169
169
  it "recognizes 256 bytes binary message in a single unmasked frame" do
170
170
  data = Array.new(256) { rand(256) }.pack('c*')
171
- parser << [0x82, 0x7E, 0x0100].pack('CCS<') + data
171
+ parser << [0x82, 0x7E, 0x0100].pack('CCS>') + data
172
172
 
173
173
  received_messages.first.should == data
174
174
  end
175
175
 
176
176
  it "recoginzes 64KiB binary message in a single unmasked frame" do
177
177
  data = Array.new(65536) { rand(256) }.pack('c*')
178
- parser << [0x82, 0x7F, 0x0000000000010000].pack('CCQ<') + data
178
+ parser << [0x82, 0x7F, 0x0000000000010000].pack('CCQ>') + data
179
179
 
180
180
  received_messages.first.should == data
181
181
  end
metadata CHANGED
@@ -1,64 +1,64 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: websocket_parser
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
5
- prerelease:
4
+ prerelease:
5
+ version: 0.1.1
6
6
  platform: ruby
7
7
  authors:
8
8
  - Alberto Fernandez-Capel
9
- autorequire:
9
+ autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-08-10 00:00:00.000000000 Z
12
+ date: 2012-10-27 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: http
16
- requirement: !ruby/object:Gem::Requirement
17
- none: false
16
+ version_requirements: !ruby/object:Gem::Requirement
18
17
  requirements:
19
18
  - - ! '>='
20
19
  - !ruby/object:Gem::Version
21
20
  version: '0'
22
- type: :runtime
23
- prerelease: false
24
- version_requirements: !ruby/object:Gem::Requirement
25
21
  none: false
22
+ requirement: !ruby/object:Gem::Requirement
26
23
  requirements:
27
24
  - - ! '>='
28
25
  - !ruby/object:Gem::Version
29
26
  version: '0'
27
+ none: false
28
+ prerelease: false
29
+ type: :runtime
30
30
  - !ruby/object:Gem::Dependency
31
31
  name: rake
32
- requirement: !ruby/object:Gem::Requirement
33
- none: false
32
+ version_requirements: !ruby/object:Gem::Requirement
34
33
  requirements:
35
34
  - - ! '>='
36
35
  - !ruby/object:Gem::Version
37
36
  version: '0'
38
- type: :development
39
- prerelease: false
40
- version_requirements: !ruby/object:Gem::Requirement
41
37
  none: false
38
+ requirement: !ruby/object:Gem::Requirement
42
39
  requirements:
43
40
  - - ! '>='
44
41
  - !ruby/object:Gem::Version
45
42
  version: '0'
43
+ none: false
44
+ prerelease: false
45
+ type: :development
46
46
  - !ruby/object:Gem::Dependency
47
47
  name: rspec
48
- requirement: !ruby/object:Gem::Requirement
49
- none: false
48
+ version_requirements: !ruby/object:Gem::Requirement
50
49
  requirements:
51
50
  - - ! '>='
52
51
  - !ruby/object:Gem::Version
53
52
  version: '0'
54
- type: :development
55
- prerelease: false
56
- version_requirements: !ruby/object:Gem::Requirement
57
53
  none: false
54
+ requirement: !ruby/object:Gem::Requirement
58
55
  requirements:
59
56
  - - ! '>='
60
57
  - !ruby/object:Gem::Version
61
58
  version: '0'
59
+ none: false
60
+ prerelease: false
61
+ type: :development
62
62
  description: WebsocketParser is a RFC6455 compliant parser for websocket messages
63
63
  email:
64
64
  - afcapel@gmail.com
@@ -85,32 +85,32 @@ files:
85
85
  - websocket_parser.gemspec
86
86
  homepage: http://github.com/afcapel/websocket_parser
87
87
  licenses: []
88
- post_install_message:
88
+ post_install_message:
89
89
  rdoc_options: []
90
90
  require_paths:
91
91
  - lib
92
92
  required_ruby_version: !ruby/object:Gem::Requirement
93
- none: false
94
93
  requirements:
95
94
  - - ! '>='
96
95
  - !ruby/object:Gem::Version
97
- version: '0'
98
96
  segments:
99
97
  - 0
100
- hash: -2916391695898748825
101
- required_rubygems_version: !ruby/object:Gem::Requirement
98
+ hash: 2
99
+ version: '0'
102
100
  none: false
101
+ required_rubygems_version: !ruby/object:Gem::Requirement
103
102
  requirements:
104
103
  - - ! '>='
105
104
  - !ruby/object:Gem::Version
106
- version: '0'
107
105
  segments:
108
106
  - 0
109
- hash: -2916391695898748825
107
+ hash: 2
108
+ version: '0'
109
+ none: false
110
110
  requirements: []
111
- rubyforge_project:
112
- rubygems_version: 1.8.23
113
- signing_key:
111
+ rubyforge_project:
112
+ rubygems_version: 1.8.24
113
+ signing_key:
114
114
  specification_version: 3
115
115
  summary: Parse websockets messages in Ruby
116
116
  test_files:
@@ -118,3 +118,4 @@ test_files:
118
118
  - spec/websocket/handshake_spec.rb
119
119
  - spec/websocket/message_spec.rb
120
120
  - spec/websocket/parser_spec.rb
121
+ ...