ftw 0.0.40 → 0.0.41
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/ftw/agent.rb +53 -40
- data/lib/ftw/agent/configuration.rb +5 -1
- data/lib/ftw/cacert.pem +968 -440
- data/lib/ftw/dns/dns.rb +1 -1
- data/lib/ftw/http/headers.rb +1 -1
- data/lib/ftw/version.rb +1 -1
- data/lib/ftw/websocket.rb +2 -2
- data/lib/ftw/websocket/writer.rb +2 -2
- data/test/ftw/http/headers.rb +9 -0
- metadata +2 -2
data/lib/ftw/dns/dns.rb
CHANGED
@@ -34,7 +34,7 @@ class FTW::DNS::DNS
|
|
34
34
|
if address.length == 16
|
35
35
|
# Unpack 16 bit chunks, convert to hex, join with ":"
|
36
36
|
address.unpack("n8").collect { |p| p.to_s(16) } \
|
37
|
-
.join(":").sub(/(
|
37
|
+
.join(":").sub(/(?:^|:)0:(?:0:)+/, "::")
|
38
38
|
else
|
39
39
|
# assume ipv4
|
40
40
|
# Per the following sites, "::127.0.0.1" is valid and correct
|
data/lib/ftw/http/headers.rb
CHANGED
@@ -117,7 +117,7 @@ class FTW::HTTP::Headers
|
|
117
117
|
def each(&block)
|
118
118
|
@headers.each do |field_name, field_value|
|
119
119
|
if field_value.is_a?(Array)
|
120
|
-
field_value.map { |value| yield field_name,
|
120
|
+
field_value.map { |value| yield field_name, value }
|
121
121
|
else
|
122
122
|
yield field_name, field_value
|
123
123
|
end
|
data/lib/ftw/version.rb
CHANGED
data/lib/ftw/websocket.rb
CHANGED
@@ -102,8 +102,8 @@ class FTW::WebSocket
|
|
102
102
|
def handshake_ok?(response)
|
103
103
|
# See RFC6455 section 4.2.2
|
104
104
|
return false unless response.status == 101 # "Switching Protocols"
|
105
|
-
return false unless response.headers.get("upgrade") == "websocket"
|
106
|
-
return false unless response.headers.get("connection") == "
|
105
|
+
return false unless response.headers.get("upgrade").downcase == "websocket"
|
106
|
+
return false unless response.headers.get("connection").downcase == "upgrade"
|
107
107
|
|
108
108
|
# Now verify Sec-WebSocket-Accept. It should be the SHA-1 of the
|
109
109
|
# Sec-WebSocket-Key (in base64) + WEBSOCKET_ACCEPT_UUID
|
data/lib/ftw/websocket/writer.rb
CHANGED
@@ -68,8 +68,8 @@ class FTW::WebSocket::Writer
|
|
68
68
|
|
69
69
|
# Pack the payload.
|
70
70
|
def pack_payload(data, pack, text, mode)
|
71
|
-
pack_maskbit_and_length(data, pack, text.
|
72
|
-
pack_extended_length(data, pack, text.
|
71
|
+
pack_maskbit_and_length(data, pack, text.bytesize, mode)
|
72
|
+
pack_extended_length(data, pack, text.bytesize) if text.bytesize >= 126
|
73
73
|
if mode == :client
|
74
74
|
mask_key = [rand(1 << 32)].pack("Q")
|
75
75
|
pack_mask(data, pack, mask_key)
|
data/test/ftw/http/headers.rb
CHANGED
@@ -47,4 +47,13 @@ describe FTW::HTTP::Headers do
|
|
47
47
|
@headers.remove("foo", "two")
|
48
48
|
assert_equal("one", @headers.get("foo"))
|
49
49
|
end
|
50
|
+
|
51
|
+
test "duplicate headers return multiple key value pairs" do
|
52
|
+
@headers.add("foo", "bar")
|
53
|
+
@headers.add("foo", "fizz")
|
54
|
+
@headers.each do |key, value|
|
55
|
+
assert_equal("foo", key)
|
56
|
+
assert( value == "bar" || value == "fizz")
|
57
|
+
end
|
58
|
+
end
|
50
59
|
end # describe FTW::HTTP::Headers
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ftw
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.41
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jordan Sissel
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-
|
11
|
+
date: 2014-11-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: cabin
|