websocket-driver 0.7.5 → 0.7.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +4 -0
- data/LICENSE.md +1 -1
- data/lib/websocket/driver/client.rb +1 -2
- data/lib/websocket/driver/hybi.rb +2 -0
- data/lib/websocket/driver/proxy.rb +1 -3
- data/lib/websocket/driver.rb +9 -0
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 48624348056a8a90b22cf6844120166be3ec700a80ec4ab23c1d6c1f5e43aa1a
|
4
|
+
data.tar.gz: 0f157eaba15f2cd8c544042700159a692b0bf74f71a03c40b3da04a705409236
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f27c8eafe669ee83b263f56d1b0aeb49bcfba6c5bcc1b027b3bf3a04f71c58e7d9bc6fa99a24f8f4724f6f3d5961a7c90c2fdea978b6f9f1324d5a3f1012d056
|
7
|
+
data.tar.gz: 833502731fc73a3b05664d29343199e4c07e5b77825b5a3b2b851d6742506d7c33207a5da0369f692cc073c0e192583db083ba127abaa85eb9b130b4ac1aeb7f
|
data/CHANGELOG.md
CHANGED
data/LICENSE.md
CHANGED
@@ -23,11 +23,10 @@ module WebSocket
|
|
23
23
|
raise URIError, "#{ socket.url } is not a valid WebSocket URL"
|
24
24
|
end
|
25
25
|
|
26
|
-
host = uri.host + (uri.port ? ":#{ uri.port }" : '')
|
27
26
|
path = (uri.path == '') ? '/' : uri.path
|
28
27
|
@pathname = path + (uri.query ? '?' + uri.query : '')
|
29
28
|
|
30
|
-
@headers['Host'] =
|
29
|
+
@headers['Host'] = Driver.host_header(uri)
|
31
30
|
@headers['Upgrade'] = 'websocket'
|
32
31
|
@headers['Connection'] = 'Upgrade'
|
33
32
|
@headers['Sec-WebSocket-Key'] = @key
|
@@ -4,8 +4,6 @@ module WebSocket
|
|
4
4
|
class Proxy
|
5
5
|
include EventEmitter
|
6
6
|
|
7
|
-
PORTS = { 'ws' => 80, 'wss' => 443 }
|
8
|
-
|
9
7
|
attr_reader :status, :headers
|
10
8
|
|
11
9
|
def initialize(client, origin, options)
|
@@ -20,7 +18,7 @@ module WebSocket
|
|
20
18
|
@state = 0
|
21
19
|
|
22
20
|
@headers = Headers.new
|
23
|
-
@headers['Host'] =
|
21
|
+
@headers['Host'] = Driver.host_header(@origin)
|
24
22
|
@headers['Connection'] = 'keep-alive'
|
25
23
|
@headers['Proxy-Connection'] = 'keep-alive'
|
26
24
|
|
data/lib/websocket/driver.rb
CHANGED
@@ -42,6 +42,7 @@ module WebSocket
|
|
42
42
|
end
|
43
43
|
|
44
44
|
MAX_LENGTH = 0x3ffffff
|
45
|
+
PORTS = { 'ws' => 80, 'wss' => 443 }
|
45
46
|
STATES = [:connecting, :open, :closing, :closed]
|
46
47
|
|
47
48
|
ConnectEvent = Struct.new(nil)
|
@@ -209,6 +210,14 @@ module WebSocket
|
|
209
210
|
data.force_encoding(encoding)
|
210
211
|
end
|
211
212
|
|
213
|
+
def self.host_header(uri)
|
214
|
+
host = uri.host
|
215
|
+
if uri.port and uri.port != PORTS[uri.scheme]
|
216
|
+
host += ":#{uri.port}"
|
217
|
+
end
|
218
|
+
host
|
219
|
+
end
|
220
|
+
|
212
221
|
def self.validate_options(options, valid_keys)
|
213
222
|
options.keys.each do |key|
|
214
223
|
unless valid_keys.include?(key)
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: websocket-driver
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.7.
|
4
|
+
version: 0.7.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- James Coglan
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2023-07-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: websocket-extensions
|
@@ -135,7 +135,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
135
135
|
- !ruby/object:Gem::Version
|
136
136
|
version: '0'
|
137
137
|
requirements: []
|
138
|
-
rubygems_version: 3.
|
138
|
+
rubygems_version: 3.4.10
|
139
139
|
signing_key:
|
140
140
|
specification_version: 4
|
141
141
|
summary: WebSocket protocol handler with pluggable I/O
|