websocket 1.2.7 → 1.2.8
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rubocop.yml +8 -1
- data/.travis.yml +2 -0
- data/CHANGELOG.md +4 -0
- data/lib/websocket/frame/handler/handler03.rb +3 -3
- data/lib/websocket/handshake/base.rb +1 -1
- data/lib/websocket/version.rb +1 -1
- data/spec/support/handshake_requests.rb +56 -56
- data/websocket.gemspec +1 -1
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: dc36fa232460616657d774b6ae0d21bac79c8123730812ac1032d185a4fa090a
|
4
|
+
data.tar.gz: 125432097dd592f40606fd4e2d7fb30f1b029b794b832eda0d2f0e9f4b1d824a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 825c8e711023468f699cf0cf0a0f9e1ce462a81bc2ca5ea1a1523b079548bd21d9ac9bc0938d47d154a3e4706c23ff71e9abd93612ec9e83f3b1063651e7e7bb
|
7
|
+
data.tar.gz: 66a68866a9c231658d7cdd203250a4c1cab1d860b4fe2523343d77fd7969f48fc86471cc0920795fe52499ee3aa93825294a1651ab6968ca76839ee2ec34d200
|
data/.rubocop.yml
CHANGED
@@ -2,7 +2,14 @@ require: rubocop-rspec
|
|
2
2
|
|
3
3
|
AllCops:
|
4
4
|
DisplayCopNames: true
|
5
|
-
TargetRubyVersion: 2.
|
5
|
+
TargetRubyVersion: 2.1
|
6
|
+
|
7
|
+
# New version of Rubocop does not support 2.0
|
8
|
+
Gemspec/RequiredRubyVersion:
|
9
|
+
Enabled: false
|
10
|
+
|
11
|
+
Layout/IndentHeredoc:
|
12
|
+
Enabled: false
|
6
13
|
|
7
14
|
# Target: 15
|
8
15
|
Metrics/AbcSize:
|
data/.travis.yml
CHANGED
data/CHANGELOG.md
CHANGED
@@ -90,14 +90,14 @@ module WebSocket
|
|
90
90
|
def encode_header
|
91
91
|
mask = @frame.outgoing_masking? ? 0b10000000 : 0b00000000
|
92
92
|
|
93
|
-
output =
|
93
|
+
output = String.new('')
|
94
94
|
output << (type_to_opcode(@frame.type) | (fin ? 0b10000000 : 0b00000000)) # since more, rsv1-3 are 0 and 0x80 for Draft 4
|
95
95
|
output << encode_payload_length(@frame.data.size, mask)
|
96
96
|
output
|
97
97
|
end
|
98
98
|
|
99
99
|
def encode_payload_length(length, mask)
|
100
|
-
output =
|
100
|
+
output = String.new('')
|
101
101
|
if length <= 125
|
102
102
|
output << (length | mask) # since rsv4 is 0
|
103
103
|
elsif length < 65_536 # write 2 byte length
|
@@ -198,7 +198,7 @@ module WebSocket
|
|
198
198
|
end
|
199
199
|
|
200
200
|
def decode_continuation_frame(application_data, frame_type)
|
201
|
-
@application_data_buffer ||=
|
201
|
+
@application_data_buffer ||= String.new('')
|
202
202
|
@application_data_buffer << application_data
|
203
203
|
@frame_type ||= frame_type
|
204
204
|
end
|
data/lib/websocket/version.rb
CHANGED
@@ -1,88 +1,88 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
def client_handshake_75(args = {})
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
4
|
+
<<-REQUEST
|
5
|
+
GET #{args[:path] || '/demo'}#{"?#{args[:query]}" if args[:query]} HTTP/1.1\r
|
6
|
+
Upgrade: WebSocket\r
|
7
|
+
Connection: Upgrade\r
|
8
|
+
Host: #{args[:host] || 'example.com'}#{":#{args[:port]}" if args[:port]}\r
|
9
|
+
Origin: http://example.com\r
|
10
|
+
#{(args[:headers] || {}).map { |key, value| "#{key}: #{value}\r\n" }.join('')}\r
|
11
11
|
REQUEST
|
12
12
|
end
|
13
13
|
|
14
14
|
def server_handshake_75(args = {})
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
15
|
+
<<-REQUEST
|
16
|
+
HTTP/1.1 101 Web Socket Protocol Handshake\r
|
17
|
+
Upgrade: WebSocket\r
|
18
|
+
Connection: Upgrade\r
|
19
|
+
#{(args[:headers] || {}).map { |key, value| "#{key}: #{value}\r\n" }.join('')}WebSocket-Origin: http://example.com\r
|
20
|
+
WebSocket-Location: ws#{args[:secure] ? 's' : ''}://#{args[:host] || 'example.com'}#{":#{args[:port]}" if args[:port]}#{args[:path] || '/demo'}\r
|
21
|
+
\r
|
22
22
|
REQUEST
|
23
23
|
end
|
24
24
|
|
25
25
|
def client_handshake_76(args = {})
|
26
|
-
request =
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
26
|
+
request = <<-REQUEST
|
27
|
+
GET #{args[:path] || '/demo'}#{"?#{args[:query]}" if args[:query]} HTTP/1.1\r
|
28
|
+
Upgrade: WebSocket\r
|
29
|
+
Connection: Upgrade\r
|
30
|
+
Host: #{args[:host] || 'example.com'}#{":#{args[:port]}" if args[:port]}\r
|
31
|
+
Origin: http://example.com\r
|
32
|
+
#{(args[:headers] || {}).map { |key, value| "#{key}: #{value}\r\n" }.join('')}Sec-WebSocket-Key1: #{args[:key1] || '4 @1 46546xW%0l 1 5'}\r
|
33
|
+
Sec-WebSocket-Key2: #{args[:key2] || '12998 5 Y3 1 .P00'}\r
|
34
|
+
\r
|
35
|
+
#{args[:key3] || '^n:ds[4U'}
|
36
36
|
REQUEST
|
37
37
|
request[0..-2]
|
38
38
|
end
|
39
39
|
|
40
40
|
def server_handshake_76(args = {})
|
41
|
-
request =
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
41
|
+
request = <<-REQUEST
|
42
|
+
HTTP/1.1 101 WebSocket Protocol Handshake\r
|
43
|
+
Upgrade: WebSocket\r
|
44
|
+
Connection: Upgrade\r
|
45
|
+
#{(args[:headers] || {}).map { |key, value| "#{key}: #{value}\r\n" }.join('')}Sec-WebSocket-Origin: http://example.com\r
|
46
|
+
Sec-WebSocket-Location: ws#{args[:secure] ? 's' : ''}://#{args[:host] || 'example.com'}#{":#{args[:port]}" if args[:port]}#{args[:path] || '/demo'}\r
|
47
|
+
\r
|
48
|
+
#{args[:challenge] || "8jKS'y:G*Co,Wxa-"}
|
49
49
|
REQUEST
|
50
50
|
request[0..-2]
|
51
51
|
end
|
52
52
|
|
53
53
|
def client_handshake_04(args = {})
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
54
|
+
<<-REQUEST
|
55
|
+
GET #{args[:path] || '/demo'}#{"?#{args[:query]}" if args[:query]} HTTP/1.1\r
|
56
|
+
Upgrade: websocket\r
|
57
|
+
Connection: Upgrade\r
|
58
|
+
Host: #{args[:host] || 'example.com'}#{":#{args[:port]}" if args[:port]}\r
|
59
|
+
#{(args[:headers] || {}).map { |key, value| "#{key}: #{value}\r\n" }.join('')}Sec-WebSocket-Origin: http://example.com\r
|
60
|
+
Sec-WebSocket-Version: #{args[:version] || '4'}\r
|
61
|
+
Sec-WebSocket-Key: #{args[:key] || 'dGhlIHNhbXBsZSBub25jZQ=='}\r
|
62
|
+
\r
|
63
63
|
REQUEST
|
64
64
|
end
|
65
65
|
|
66
66
|
def server_handshake_04(args = {})
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
67
|
+
<<-REQUEST
|
68
|
+
HTTP/1.1 101 Switching Protocols\r
|
69
|
+
Upgrade: websocket\r
|
70
|
+
Connection: Upgrade\r
|
71
|
+
#{(args[:headers] || {}).map { |key, value| "#{key}: #{value}\r\n" }.join('')}Sec-WebSocket-Accept: #{args[:accept] || 's3pPLMBiTxaQ9kYGzzhZRbK+xOo='}\r
|
72
|
+
\r
|
73
73
|
REQUEST
|
74
74
|
end
|
75
75
|
|
76
76
|
def client_handshake_11(args = {})
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
77
|
+
<<-REQUEST
|
78
|
+
GET #{args[:path] || '/demo'}#{"?#{args[:query]}" if args[:query]} HTTP/1.1\r
|
79
|
+
Upgrade: websocket\r
|
80
|
+
Connection: Upgrade\r
|
81
|
+
Host: #{args[:host] || 'example.com'}#{":#{args[:port]}" if args[:port]}\r
|
82
|
+
#{(args[:headers] || {}).map { |key, value| "#{key}: #{value}\r\n" }.join('')}Origin: http://example.com\r
|
83
|
+
Sec-WebSocket-Version: #{args[:version] || '4'}\r
|
84
|
+
Sec-WebSocket-Key: #{args[:key] || 'dGhlIHNhbXBsZSBub25jZQ=='}\r
|
85
|
+
\r
|
86
86
|
REQUEST
|
87
87
|
end
|
88
88
|
|
data/websocket.gemspec
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: websocket
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.2.
|
4
|
+
version: 1.2.8
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Bernard Potocki
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-05-
|
11
|
+
date: 2018-05-25 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: Universal Ruby library to handle WebSocket protocol
|
14
14
|
email:
|
@@ -103,7 +103,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
103
103
|
requirements:
|
104
104
|
- - ">="
|
105
105
|
- !ruby/object:Gem::Version
|
106
|
-
version: '2.
|
106
|
+
version: '2.0'
|
107
107
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
108
108
|
requirements:
|
109
109
|
- - ">="
|
@@ -111,7 +111,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
111
111
|
version: '0'
|
112
112
|
requirements: []
|
113
113
|
rubyforge_project:
|
114
|
-
rubygems_version: 2.
|
114
|
+
rubygems_version: 2.7.7
|
115
115
|
signing_key:
|
116
116
|
specification_version: 4
|
117
117
|
summary: Universal Ruby library to handle WebSocket protocol
|