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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 9fa1e04675b3abf21352767a5b1075b77de4dff1670d6644d65b17d09daef059
4
- data.tar.gz: dbef4fe08a9ba610b68cd6ab92f2674ab18a4833874040207cac63742ead0100
3
+ metadata.gz: dc36fa232460616657d774b6ae0d21bac79c8123730812ac1032d185a4fa090a
4
+ data.tar.gz: 125432097dd592f40606fd4e2d7fb30f1b029b794b832eda0d2f0e9f4b1d824a
5
5
  SHA512:
6
- metadata.gz: 9874d45a9b3bd2e773bc05540de06f1b2e710fa32bc0ac7da582e77f8e20f79f7d3e9863be9bea590e0b6b741e5f8692f39d483061570398cdae3303fb160ac4
7
- data.tar.gz: bac88133308b1f2ce15f27de62ff74309189f2f9ccc9fd9ba006aaa3b936fc13a8e51f92bc2728c1ce52216df4ec2ac9845f8e31a2ef8217dc6e368ae98db515
6
+ metadata.gz: 825c8e711023468f699cf0cf0a0f9e1ce462a81bc2ca5ea1a1523b079548bd21d9ac9bc0938d47d154a3e4706c23ff71e9abd93612ec9e83f3b1063651e7e7bb
7
+ data.tar.gz: 66a68866a9c231658d7cdd203250a4c1cab1d860b4fe2523343d77fd7969f48fc86471cc0920795fe52499ee3aa93825294a1651ab6968ca76839ee2ec34d200
@@ -2,7 +2,14 @@ require: rubocop-rspec
2
2
 
3
3
  AllCops:
4
4
  DisplayCopNames: true
5
- TargetRubyVersion: 2.3
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:
@@ -2,6 +2,8 @@ dist: trusty
2
2
  language: ruby
3
3
  script: "bundle exec rake"
4
4
  rvm:
5
+ - 2.1
6
+ - 2.2
5
7
  - 2.3
6
8
  - 2.4
7
9
  - 2.5
@@ -1,5 +1,9 @@
1
1
  # Changelog
2
2
 
3
+ ## 1.2.8
4
+
5
+ - restore support for Ruby 2.0+
6
+
3
7
  ## 1.2.7
4
8
 
5
9
  - fix bug in previous version for Ruby 2.3
@@ -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
@@ -25,7 +25,7 @@ module WebSocket
25
25
  @state = :new
26
26
  @handler = nil
27
27
 
28
- @data = +''
28
+ @data = String.new('')
29
29
  @headers ||= {}
30
30
  @protocols ||= []
31
31
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module WebSocket
4
- VERSION = '1.2.7'
4
+ VERSION = '1.2.8'.freeze
5
5
  end
@@ -1,88 +1,88 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  def client_handshake_75(args = {})
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
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
- <<~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
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 = <<~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'}
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 = <<~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-"}
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
- <<~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
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
- <<~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
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
- <<~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
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
 
@@ -19,5 +19,5 @@ Gem::Specification.new do |s|
19
19
  s.executables = `git ls-files -- bin/*`.split("\n").map { |f| File.basename(f) }
20
20
  s.require_paths = ['lib']
21
21
 
22
- s.required_ruby_version = '>= 2.3'
22
+ s.required_ruby_version = '>= 2.0'
23
23
  end
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.7
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-22 00:00:00.000000000 Z
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.3'
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.6.14
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